Skip to content

Commit 8e0a38a

Browse files
authored
Merge pull request #1 from poulainv/main
Pipenv and pip version can be set through env var
2 parents 41c5a93 + ecb1631 commit 8e0a38a

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

bin/steps/pipenv

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
4949
mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE"
5050
fi
5151

52-
export PIPENV_VERSION="2018.5.18"
52+
if [[ -r "$ENV_DIR/BUILD_PIPENV_VERSION" ]]; then
53+
BUILD_PIPENV_VERSION="$(cat "$ENV_DIR/BUILD_PIPENV_VERSION")"
54+
fi
55+
56+
export _PIPENV_VERSION="${BUILD_PIPENV_VERSION:-2018.5.18}"
57+
5358

5459
# Install pipenv.
5560
# Due to weird old pip behavior and pipenv behavior, pipenv upgrades pip
5661
# to latest if only --upgrade is specified. Specify upgrade strategy to
5762
# avoid this eager behavior.
58-
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
63+
/app/.heroku/python/bin/pip install pipenv==$_PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
5964

6065
# Install the test dependencies, for CI.
6166
if [ "$INSTALL_TEST" ]; then
@@ -64,15 +69,15 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
6469

6570
# Install the dependencies.
6671
elif [[ ! -f Pipfile.lock ]]; then
67-
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION"
72+
puts-step "Installing dependencies with Pipenv $_PIPENV_VERSION"
6873
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
6974

7075
else
7176
pipenv-to-pip Pipfile.lock > requirements.txt
7277
cp requirements.txt .heroku/python/requirements-declared.txt
7378
openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
7479

75-
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION"
80+
puts-step "Installing dependencies with Pipenv $_PIPENV_VERSION"
7681
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
7782
fi
7883
fi

bin/steps/python

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ fi
142142

143143
set -e
144144

145-
PIP_VERSION='20.1.1'
145+
if [[ -r "$ENV_DIR/BUILD_PIP_VERSION" ]]; then
146+
BUILD_PIP_VERSION="$(cat "$ENV_DIR/BUILD_PIP_VERSION")"
147+
fi
148+
PIP_VERSION="${BUILD_PIP_VERSION:-20.1.1}"
149+
146150
# Must use setuptools <47.2.0 until we fix:
147151
# https://github.com/heroku/heroku-buildpack-python/issues/1006
148152
SETUPTOOLS_VERSION='47.1.1'
@@ -176,10 +180,6 @@ if ! curl -sSf "${PIP_WHEEL_URL}" -o "$PIP_WHEEL"; then
176180
fi
177181

178182
if [[ -f "$BUILD_DIR/Pipfile" ]]; then
179-
# The buildpack is pinned to old pipenv, which requires older pip.
180-
# Pip 9.0.2 doesn't support installing itself from a wheel, so we have to use split
181-
# versions here (ie: installer pip version different from target pip version).
182-
PIP_VERSION='9.0.2'
183183
PIP_TO_INSTALL="pip==${PIP_VERSION}"
184184
else
185185
PIP_TO_INSTALL="${PIP_WHEEL}"

0 commit comments

Comments
 (0)