From 7cbca2f5c5491d555eda480b64ff58e68249fd7d Mon Sep 17 00:00:00 2001
From: Kenneth Reitz <me@kennethreitz.org>
Date: Wed, 7 Mar 2018 10:54:09 -0500
Subject: [PATCH] always use pipenv if it's there

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
---
 bin/steps/pipenv | 57 +++++++++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/bin/steps/pipenv b/bin/steps/pipenv
index e1ce2bdf..20bb5bd8 100755
--- a/bin/steps/pipenv
+++ b/bin/steps/pipenv
@@ -26,42 +26,39 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
 
     # Pipenv support (Generate requriements.txt with pipenv).
     if [[ -f Pipfile ]]; then
-        if [[ ! -f requirements.txt ]]; then
+        # Measure that we're using Pipenv.
+        mcount "tool.pipenv"
 
-            # Measure that we're using Pipenv.
-            mcount "tool.pipenv"
+        # Skip pip install, later.
+        export SKIP_PIP_INSTALL=1
 
-            # Skip pip install, later.
-            export SKIP_PIP_INSTALL=1
-
-            # Set PIP_EXTRA_INDEX_URL
-            if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
-                PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
-                export PIP_EXTRA_INDEX_URL
-            fi
+        # Set PIP_EXTRA_INDEX_URL
+        if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then
+            PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")"
+            export PIP_EXTRA_INDEX_URL
+        fi
 
-            # Install pipenv.
-            /app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
+        # Install pipenv.
+        /app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
 
-            # Install the dependencies.
-            if [[ ! -f Pipfile.lock ]]; then
-                puts-step "Installing dependencies with latest Pipenv…"
-                /app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
-            else
-                pipenv-to-pip Pipfile.lock > requirements.txt
-                "$BIN_DIR/steps/pip-uninstall"
-                cp requirements.txt .heroku/python/requirements-declared.txt
-                openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
+        # Install the dependencies.
+        if [[ ! -f Pipfile.lock ]]; then
+            puts-step "Installing dependencies with latest Pipenv…"
+            /app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
+        else
+            pipenv-to-pip Pipfile.lock > requirements.txt
+            "$BIN_DIR/steps/pip-uninstall"
+            cp requirements.txt .heroku/python/requirements-declared.txt
+            openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
 
-                puts-step "Installing dependencies with latest Pipenv…"
-                /app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
-            fi
+            puts-step "Installing dependencies with latest Pipenv…"
+            /app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
+        fi
 
-            # Install the test dependencies, for CI.
-            if [ "$INSTALL_TEST" ]; then
-                puts-step "Installing test dependencies…"
-                /app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
-            fi
+        # Install the test dependencies, for CI.
+        if [ "$INSTALL_TEST" ]; then
+            puts-step "Installing test dependencies…"
+            /app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
         fi
     fi
 else
-- 
GitLab