Skip to content

Commit

Permalink
build(feat): Support pyenv/Python installation on Big Sur (#22257)
Browse files Browse the repository at this point in the history
Installing Python via pyenv on Big Sur for older Python versions requires:
* Setting LDFLAGS for zlib (pyenv/pyenv#1711)
* Patching the source code

Once a new release of pyenv is released and we use a newer Python 3 version
we will not need all these hacks and all Mac versions will be able to use
the same code paths.

Fixes #22497
  • Loading branch information
armenzg authored Dec 11, 2020
1 parent cf75de7 commit 34afba4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ WEBPACK := yarn build-acceptance
# Currently, this is only required to install black via pre-commit.
REQUIRED_PY3_VERSION := $(shell grep "3.6" .python-version)

BIG_SUR := $(shell sw_vers -productVersion | egrep "11\.0\.")

bootstrap: develop init-config run-dependent-services create-db apply-migrations build-platform-assets

develop: ensure-pinned-pip setup-git install-js-dev install-py-dev
Expand Down Expand Up @@ -49,7 +51,19 @@ apply-migrations: ensure-venv
reset-db: drop-db create-db apply-migrations

setup-pyenv:
ifdef BIG_SUR
# NOTE: Once we have a new release of pyenv and once a newer Python version we can remove these
# https://github.com/pyenv/pyenv/pull/1711
# cat is used since pyenv would finish to soon when the Python version is already installed
curl -sSL https://github.com/python/cpython/commit/8ea6353.patch | cat | \
LDFLAGS="-L$(shell xcrun --show-sdk-path)/usr/lib ${LDFLAGS}" \
pyenv install --skip-existing --patch 3.6.10
curl -sSL https://github.com/python/cpython/commit/8ea6353.patch | cat | \
LDFLAGS="-L$(shell xcrun --show-sdk-path)/usr/lib ${LDFLAGS}" \
pyenv install --skip-existing --patch 2.7.16
else
@cat .python-version | xargs -n1 pyenv install --skip-existing
endif

ensure-venv:
@./scripts/ensure-venv.sh
Expand Down

0 comments on commit 34afba4

Please sign in to comment.