Skip to content

Commit

Permalink
Allow users to override the version of pipenv used
Browse files Browse the repository at this point in the history
This also starts tracking which Pipenv version users are selecting to
use.

Closes #702
Closes #704
Closes #706
Closes #727
  • Loading branch information
sigmavirus24 committed Jul 10, 2018
1 parent 4d5a532 commit 9190900
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Python Buildpack Changelog

# Unreleased

- Fix bug with the "latest version" message on 3.7.0
- Add an `OVERRIDDEN_PIPENV_VERSION` option to override the version of Pipenv
used in the buildpack
- Upgrade the `DEFAULT_PIPENV_VERSION` to `2018.7.1`

# 136

Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
Expand Down
17 changes: 7 additions & 10 deletions bin/steps/pipenv
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@
source "$BIN_DIR/utils"
set -e

export DEFAULT_PIPENV_VERSION="2018.7.1"

if [[ -f Pipfile.lock ]]; then
if [[ -f .heroku/python/Pipfile.lock.sha256 ]]; then
if [[ $(openssl dgst -sha256 Pipfile.lock) == $(cat .heroku/python/Pipfile.lock.sha256) ]]; then
# Measure that we're using Pipenv.
mcount "tool.pipenv"

# Don't skip installation of there are git deps.
if ! grep -q 'git' Pipfile.lock; then
echo "Skipping installation, as Pipfile.lock hasn't changed since last deploy." | indent

mcount "tool.pipenv"
export SKIP_PIPENV_INSTALL=1
export SKIP_PIP_INSTALL=1
fi

mcount "tool.pipenv"
fi
fi
fi
Expand All @@ -29,9 +27,6 @@ fi
if [ ! "$SKIP_PIPENV_INSTALL" ]; then
# Pipenv support (Generate requriements.txt with pipenv).
if [[ -f Pipfile ]]; then
# Measure that we're using Pipenv.
mcount "tool.pipenv"

# Skip pip install, later.
export SKIP_PIP_INSTALL=1

Expand All @@ -41,10 +36,12 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
export PIP_EXTRA_INDEX_URL
fi

export PIPENV_VERSION="2018.7.1"
export PIPENV_VERSION="${OVERRIDDEN_PIPENV_VERSION:-$DEFAULT_PIPENV_VERSION}"
mcount "tool.pipenv"
mcount "version.pipenv.$PIPENV_VERSION"

# Install pipenv.
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade &> /dev/null
/app/.heroku/python/bin/pip install "pipenv==$PIPENV_VERSION" --upgrade &> /dev/null

# Install the dependencies.
if [[ ! -f Pipfile.lock ]]; then
Expand Down

0 comments on commit 9190900

Please sign in to comment.