From 4f82a7cb11f433934b4b5c8f5ea79654009e165d Mon Sep 17 00:00:00 2001 From: Armen Zambrano G Date: Thu, 7 Oct 2021 08:55:39 -0400 Subject: [PATCH] fix(dev): Install Python 3.6.x with --patch on Big Sur Fixes regression introduced in #29058. On Big Sur, we cannot install Python 3.6.x without patching the source code first. --- scripts/pyenv_setup.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/pyenv_setup.sh b/scripts/pyenv_setup.sh index ddf00f333f974e..2c5d4af40d8224 100755 --- a/scripts/pyenv_setup.sh +++ b/scripts/pyenv_setup.sh @@ -94,13 +94,15 @@ install_pyenv() { exit 1 fi - if query-apple-m1; then - pyenv install --skip-existing "${PYENV_VERSION}" - elif query-big-sur && [ "${PYENV_VERSION}" = 3.6.10 ]; then - # TODO(joshuarli): Can be removed when 3.6 is removed. - curl -sSL https://github.com/python/cpython/commit/8ea6353.patch | \ - cat | \ - pyenv install --skip-existing --patch "${PYENV_VERSION}" + # I'm assuming that SENTRY_PYTHON_VERSION won't be used to specify a 3.6 version to simplify the condition + # When a user sets a SENTRY_PYTHON_VERSION they intend to use a non-default version that I assume + # is newer, thus, can install with the non-source-patched default pyenv install command + if query-big-sur && [[ -z "${SENTRY_PYTHON_VERSION:-}" ]]; then + # For Python 3.6.x, we need to patch the source code on Big Sur before building Python + # We can remove this once we upgrade to newer versions of Python + # 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 | + pyenv install --skip-existing --patch "${PYENV_VERSION}" else pyenv install --skip-existing "${PYENV_VERSION}" fi