From 4669f804d82678ca1c2fbc64e952840a1b36fd1c Mon Sep 17 00:00:00 2001 From: Kaunil Dhruv Date: Fri, 26 May 2023 16:51:35 -0700 Subject: [PATCH 1/2] Update install_python_toolchain.sh --- scripts/install_python_toolchain.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/install_python_toolchain.sh b/scripts/install_python_toolchain.sh index 05e87ad41d..1ba907bac4 100755 --- a/scripts/install_python_toolchain.sh +++ b/scripts/install_python_toolchain.sh @@ -12,10 +12,15 @@ source deps/env/bin/activate PYTHON="${PWD}/deps/env/bin/python" PIP="${PYTHON} -m pip" +# python version PYTHON_MAJOR_VERSION=$(${PYTHON} -c 'import sys; print(sys.version_info.major)') PYTHON_MINOR_VERSION=$(${PYTHON} -c 'import sys; print(sys.version_info.minor)') PYTHON_VERSION="python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}" +# pip version +PIP_MAJOR_VERSION=$(${PYTHON} -c 'import pip; print(pip.__version__.split(".")[0])') +PIP_MINOR_VERSION=$(${PYTHON} -c 'import pip; print(pip.__version__.split(".")[1])') + # TODO - not sure why 'm' is necessary here (and not in 2.7) # note that PYTHON_VERSION includes the word "python", like "python2.7" or "python3.6" PYTHON_FULL_NAME=${PYTHON_VERSION}m @@ -34,11 +39,18 @@ function linux_patch_sigfpe_handler { fi } +function get_pip_version{ + pip_version=$(pip -V).trim() + echo $pip_version +} + $PIP install --upgrade "pip" + +DEP_RESOLVER= if [[ "$USE_MINIMAL" -eq 1 ]]; then - $PIP install -r scripts/requirements-minimal.txt --prefer-binary --use-feature=2020-resolver + $PIP install -r scripts/requirements-minimal.txt --prefer-binary else - $PIP install -r scripts/requirements.txt --prefer-binary --use-feature=2020-resolver + $PIP install -r scripts/requirements.txt --prefer-binary fi # install pre-commit hooks for git From c5606b2585d824f84628b17059b5a0189aef3ddd Mon Sep 17 00:00:00 2001 From: Kaunil Dhruv Date: Fri, 26 May 2023 16:59:04 -0700 Subject: [PATCH 2/2] resolver flag --- scripts/install_python_toolchain.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/install_python_toolchain.sh b/scripts/install_python_toolchain.sh index 1ba907bac4..e33e88b9cf 100755 --- a/scripts/install_python_toolchain.sh +++ b/scripts/install_python_toolchain.sh @@ -39,18 +39,16 @@ function linux_patch_sigfpe_handler { fi } -function get_pip_version{ - pip_version=$(pip -V).trim() - echo $pip_version -} - $PIP install --upgrade "pip" +DEPS_RESOLVER_FLAG="" +if [["$PIP_MAJOR_VERSION" -lt 20 && "$PIP_MINOR_VERSION" -lt 2]]; then + DEPS_RESOLVER_FLAG="--use-feature=2020-resolver" +fi -DEP_RESOLVER= if [[ "$USE_MINIMAL" -eq 1 ]]; then - $PIP install -r scripts/requirements-minimal.txt --prefer-binary + $PIP install -r scripts/requirements-minimal.txt --prefer-binary $DEPS_RESOLVER_FLAG else - $PIP install -r scripts/requirements.txt --prefer-binary + $PIP install -r scripts/requirements.txt --prefer-binary $DEPS_RESOLVER_FLAG fi # install pre-commit hooks for git