mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Move Pip version handling to bin/steps/python (#1007)
And use the `$PYTHON_VERSION` calculated in `bin/steps/python` instead of re-implementing the Python version handling.
This commit is contained in:
-20
@@ -65,26 +65,6 @@ PYPY36="pypy3.6"
|
||||
|
||||
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
|
||||
DEFAULT_PYTHON_STACK="cedar-14"
|
||||
# If pip doesn't match this version (the version we install), run the installer.
|
||||
PIP_UPDATE="20.0.2"
|
||||
|
||||
for file in "$BUILD_DIR/runtime.txt" "$CACHE_DIR/.heroku/python-version" ; do
|
||||
[ -f "$file" ] || continue
|
||||
|
||||
version=$(tr -d '[:space:]' < "$file")
|
||||
|
||||
case "$version" in "$PY34"*)
|
||||
# Python 3.4 support was dropped in pip >= 19.2.
|
||||
PIP_UPDATE="19.1.1"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -f "$BUILD_DIR/Pipfile" ]]; then
|
||||
# Do not force pipenv users to re-install pipenv locally.
|
||||
PIP_UPDATE="9.0.2"
|
||||
fi
|
||||
|
||||
# Common Problem Warnings:
|
||||
# This section creates a temporary file in which to stick the output of `pip install`.
|
||||
|
||||
+15
-3
@@ -136,6 +136,18 @@ if [ ! "$SKIP_INSTALL" ]; then
|
||||
hash -r
|
||||
fi
|
||||
|
||||
PIP_VERSION='20.0.2'
|
||||
|
||||
if [[ "${PYTHON_VERSION}" == ${PY34}* ]]; then
|
||||
# Python 3.4 support was dropped in pip 19.2+.
|
||||
PIP_VERSION='19.1.1'
|
||||
fi
|
||||
|
||||
if [[ -f "$BUILD_DIR/Pipfile" ]]; then
|
||||
# The buildpack is pinned to old pipenv, which requires older pip.
|
||||
PIP_VERSION='9.0.2'
|
||||
fi
|
||||
|
||||
# Heroku uses the get-pip utility maintained by the Python community to vendor Pip.
|
||||
# https://github.com/pypa/get-pip
|
||||
GETPIP_URL="https://lang-python.s3.amazonaws.com/etc/get-pip.py"
|
||||
@@ -148,15 +160,15 @@ if ! curl -s "${GETPIP_URL}" -o "$GETPIP_PY" &> /dev/null; then
|
||||
fi
|
||||
|
||||
# If a new Python has been installed or Pip isn't up to date:
|
||||
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
|
||||
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *${PIP_VERSION}* ]]; then
|
||||
|
||||
puts-step "Installing pip ${PIP_UPDATE}"
|
||||
puts-step "Installing pip ${PIP_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_UPDATE" &> /dev/null
|
||||
/app/.heroku/python/bin/python "$GETPIP_PY" pip=="${PIP_VERSION}" &> /dev/null
|
||||
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user