From e805cb131064ce61fdefc5a0d2327758dc317dd7 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 29 Jul 2020 00:50:28 +0100 Subject: [PATCH] Always check/adjust the installed versions of setuptools/wheel (#1007) Previously the pip/setuptools/wheel install step was skipped so long as Python hadn't just been clean installed (ie so long as not a new app, emptied cache, Python upgrade, stack change) and pip was the expected version. This meant that setuptool/wheel could be the wrong version (or even just not installed at all), and this would not be corrected. Now, we now use pip itself to determine whether the installed packages are up to date, since parsing pip's output is fragile (eg #1003) and would be tedious given there would be three packages to check. Unfortunately `get-pip.py` uses `--force-reinstall` which means performing this step every time is not the no-op it would otherwise be, but this will be resolved by switching away from `get-pip.py` in the next commit. Fixes #1000. Fixes #1003. Closes #999. --- CHANGELOG.md | 1 + bin/steps/python | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f87b81b8f..22865fbac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ # Master +- For repeat builds, also manage the installed versions of setuptools/wheel, rather than just that of pip (#1007). - Install an explicit version of wheel rather than the latest release at the time (#1007). - Output the installed version of pip, setuptools and wheel in the build log (#1007). - Install setuptools from PyPI rather than a vendored copy (#1007). diff --git a/bin/steps/python b/bin/steps/python index 60564fc0c..88328fcbb 100755 --- a/bin/steps/python +++ b/bin/steps/python @@ -131,7 +131,6 @@ if [ ! "$SKIP_INSTALL" ]; then # Record for future reference. echo "$PYTHON_VERSION" > .heroku/python-version echo "$STACK" > .heroku/python-stack - FRESH_PYTHON=true hash -r fi @@ -162,13 +161,9 @@ if ! curl -s "${GETPIP_URL}" -o "$GETPIP_PY" &> /dev/null; then exit 1 fi -# If a new Python has been installed or Pip isn't up to date: -if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *${PIP_VERSION}* ]]; then +puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and wheel ${WHEEL_VERSION}" - puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and wheel ${WHEEL_VERSION}" - - /app/.heroku/python/bin/python "$GETPIP_PY" pip=="${PIP_VERSION}" "setuptools==${SETUPTOOLS_VERSION}" "wheel==${WHEEL_VERSION}" &> /dev/null -fi +/app/.heroku/python/bin/python "$GETPIP_PY" pip=="${PIP_VERSION}" "setuptools==${SETUPTOOLS_VERSION}" "wheel==${WHEEL_VERSION}" &> /dev/null set -e hash -r