Skip to content

Commit 34afba4

Browse files
authored
build(feat): Support pyenv/Python installation on Big Sur (#22257)
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
1 parent cf75de7 commit 34afba4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ WEBPACK := yarn build-acceptance
44
# Currently, this is only required to install black via pre-commit.
55
REQUIRED_PY3_VERSION := $(shell grep "3.6" .python-version)
66

7+
BIG_SUR := $(shell sw_vers -productVersion | egrep "11\.0\.")
8+
79
bootstrap: develop init-config run-dependent-services create-db apply-migrations build-platform-assets
810

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

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

5468
ensure-venv:
5569
@./scripts/ensure-venv.sh

0 commit comments

Comments
 (0)