Skip to content

Pipenv and pip version can be set through env var #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions bin/steps/pipenv
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE"
fi

export PIPENV_VERSION="2018.5.18"
if [[ -r "$ENV_DIR/BUILD_PIPENV_VERSION" ]]; then
BUILD_PIPENV_VERSION="$(cat "$ENV_DIR/BUILD_PIPENV_VERSION")"
fi

export _PIPENV_VERSION="${BUILD_PIPENV_VERSION:-2018.5.18}"


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

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

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

else
pipenv-to-pip Pipfile.lock > requirements.txt
cp requirements.txt .heroku/python/requirements-declared.txt
openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256

puts-step "Installing dependencies with Pipenv $PIPENV_VERSION…"
puts-step "Installing dependencies with Pipenv $_PIPENV_VERSION…"
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
fi
fi
Expand Down
10 changes: 5 additions & 5 deletions bin/steps/python
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ fi

set -e

PIP_VERSION='20.1.1'
if [[ -r "$ENV_DIR/BUILD_PIP_VERSION" ]]; then
BUILD_PIP_VERSION="$(cat "$ENV_DIR/BUILD_PIP_VERSION")"
fi
PIP_VERSION="${BUILD_PIP_VERSION:-20.1.1}"

# Must use setuptools <47.2.0 until we fix:
# https://github.com/heroku/heroku-buildpack-python/issues/1006
SETUPTOOLS_VERSION='47.1.1'
Expand Down Expand Up @@ -176,10 +180,6 @@ if ! curl -sSf "${PIP_WHEEL_URL}" -o "$PIP_WHEEL"; then
fi

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