Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Install an explicit version of wheel rather than latest (heroku#1007)
Browse files Browse the repository at this point in the history
Before:
- if `wheel` was not already installed, then `get-pip.py` would
  automatically install the latest version on PyPI, which is `0.34.2`
  (or `0.33.6` for Python 3.4).
- if `wheel` was already installed, then it was left unchanged
  regardless of the version installed.

Now:
- if `wheel` is not already installed, then the same versions will be
  installed as before, except these versions are pinned and will now not
  change unexpectedly after future `wheel` releases.
- if `wheel` is already installed, then it's upgraded/downgraded to the
  target version as needed.

Partly addresses heroku#1000, though this change only helps builds where the
pip/setuptools/wheel install flow is triggered (currently only new apps
or ones where Python was purged or pip was not the correct version).

Since the wheel version is now known, it's output to the build log to
ease debugging and for parity with pip/setuptools.

The rest of heroku#1000 will be fixed in later commits.
  • Loading branch information
edmorley authored and dryan committed Nov 19, 2020
1 parent 83f4b37 commit 15821f8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# Master

- Output the installed version of pip and setuptools in the build log (#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).
- Reduce the number of environment variables exposed to `bin/{pre,post}_compile` and other subprocesses (#1011)

Expand Down
8 changes: 5 additions & 3 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,12 @@ fi

PIP_VERSION='20.0.2'
SETUPTOOLS_VERSION='39.0.1'
WHEEL_VERSION='0.34.2'

if [[ "${PYTHON_VERSION}" == ${PY34}* ]]; then
# Python 3.4 support was dropped in pip 19.2+.
# Python 3.4 support was dropped in pip 19.2+ and wheel 0.34.0+.
PIP_VERSION='19.1.1'
WHEEL_VERSION='0.33.6'
fi

if [[ -f "$BUILD_DIR/Pipfile" ]]; then
Expand All @@ -163,13 +165,13 @@ 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} and setuptools ${SETUPTOOLS_VERSION}"
puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and wheel ${WHEEL_VERSION}"

# Remove old installations.
rm -fr /app/.heroku/python/lib/python*/site-packages/pip-*
rm -fr /app/.heroku/python/lib/python*/site-packages/setuptools-*

/app/.heroku/python/bin/python "$GETPIP_PY" pip=="${PIP_VERSION}" "setuptools==${SETUPTOOLS_VERSION}" &> /dev/null
/app/.heroku/python/bin/python "$GETPIP_PY" pip=="${PIP_VERSION}" "setuptools==${SETUPTOOLS_VERSION}" "wheel==${WHEEL_VERSION}" &> /dev/null
fi

set -e
Expand Down
2 changes: 1 addition & 1 deletion test/run-features
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ testStandardRequirements() {

testPipenv() {
compile "pipenv"
assertCaptured "Installing pip 9.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 9.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCapturedSuccess
}

Expand Down
18 changes: 9 additions & 9 deletions test/run-versions
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ testPythonDefault() {
compile "pythonDefault"
assertCaptured $DEFAULT_PYTHON_VERSION
assertNotCaptured "security update"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
}
Expand All @@ -25,7 +25,7 @@ testPython2() {
assertNotCaptured "python-2-7-eol-faq";
fi
assertNotCaptured "security update"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
}
Expand Down Expand Up @@ -53,7 +53,7 @@ testPython3_4() {
compile "python3_4"
assertCaptured $LATEST_34
assertNotCaptured "security update"
assertCaptured "Installing pip 19.1.1 and setuptools 39.0.1"
assertCaptured "Installing pip 19.1.1, setuptools 39.0.1 and wheel 0.33.6"
# if cedar 14 and legacy binaries, fail. if cedar 14 and staging, succeed.
if [[ ! -n $USE_STAGING_BINARIES ]] && [[ $STACK == "cedar-14" ]]; then
assertCapturedError
Expand Down Expand Up @@ -89,7 +89,7 @@ testPython3_5() {
compile "python3_5"
assertCaptured $LATEST_35
assertNotCaptured "security update"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
}
Expand All @@ -112,7 +112,7 @@ testPython3_6() {
compile "python3_6"
assertCaptured $LATEST_36
assertNotCaptured "security update"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
}
Expand All @@ -139,7 +139,7 @@ testPython3_7() {
else
assertNotCaptured "security update"
assertCaptured $LATEST_37
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
fi
Expand Down Expand Up @@ -183,7 +183,7 @@ testPython3_8() {
else
assertNotCaptured "security update"
assertCaptured $LATEST_38
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCaptured "Installing SQLite3"
assertCapturedSuccess
fi
Expand All @@ -202,7 +202,7 @@ testPypy3_6() {
else
assertCaptured "Installing pypy"
assertCaptured "$PYPY_36"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCapturedSuccess
fi
}
Expand All @@ -214,7 +214,7 @@ testPypy2_7() {
else
assertCaptured "Installing pypy"
assertCaptured "$PYPY_27"
assertCaptured "Installing pip 20.0.2 and setuptools 39.0.1"
assertCaptured "Installing pip 20.0.2, setuptools 39.0.1 and wheel 0.34.2"
assertCapturedSuccess
fi
}
Expand Down

0 comments on commit 15821f8

Please sign in to comment.