diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6d9cc05..7e444dc09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Updated pip from 23.0.1 to 23.1.2. ([#1441](https://github.com/heroku/heroku-buildpack-python/pull/1441)) - Updated setuptools from 67.6.1 to 67.7.2. ([#1441](https://github.com/heroku/heroku-buildpack-python/pull/1441)) -- The pip bootstrap step is now performed using the pip wheel bundled with the Python stdlib, rather than one downloaded from S3. ([#1442](https://github.com/heroku/heroku-buildpack-python/pull/1442)) +- The pip bootstrap step is now performed using the pip wheel bundled with the Python stdlib, rather than one downloaded from S3. ([#1442](https://github.com/heroku/heroku-buildpack-python/pull/1442) and [#1444](https://github.com/heroku/heroku-buildpack-python/pull/1444)) ## v231 (2023-04-12) diff --git a/bin/steps/python b/bin/steps/python index 9ec44a3cf..e00b142da 100755 --- a/bin/steps/python +++ b/bin/steps/python @@ -182,8 +182,12 @@ puts-step "Installing pip ${PIP_VERSION}, setuptools ${SETUPTOOLS_VERSION} and w # Python bundles Pip within its standard library, which we can use to install our chosen # pip version from PyPI, saving us from having to download the usual pip bootstrap script. # We have to use a glob since the bundled wheel filename contains the pip version, which -# differs between Python versions. -BUNDLED_PIP_WHEEL="$(compgen -G ".heroku/python/lib/python*/ensurepip/_bundled/pip-*.whl" || true)" +# differs between Python versions. We also have to handle the case where there are multiple +# matching pip wheels, since in some versions of Python (eg 3.9.0) multiple versions of pip +# were accidentally bundled upstream. Note: This implementation relies upon `nullglob` being +# set, which is the case thanks to the `bin/utils` that was run earlier. +BUNDLED_PIP_WHEEL_LIST=(.heroku/python/lib/python*/ensurepip/_bundled/pip-*.whl) +BUNDLED_PIP_WHEEL="${BUNDLED_PIP_WHEEL_LIST[0]}" if [[ -z "${BUNDLED_PIP_WHEEL}" ]]; then mcount "failure.python.locate-bundled-pip-wheel"