Skip to content

Commit

Permalink
Always check/adjust the installed versions of setuptools/wheel (#1007)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
edmorley committed Jul 29, 2020
1 parent 0027f23 commit 7279ddd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
9 changes: 2 additions & 7 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 7279ddd

Please sign in to comment.