Skip to content

Commit bccec5c

Browse files
author
Kenneth Reitz
committed
Merge pull request heroku#47 from ojno/master
Option to purge and recreate virtualenv
2 parents 9d0bf98 + d6fbb29 commit bccec5c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bin/compile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,14 @@ puts-step "Creating Virtualenv version $(virtualenv --version)"
160160
# Try to create the virtualenv.
161161
OUT=$(virtualenv --python $PYTHON_EXE --distribute --never-download --prompt='(venv) ' $VIRTUALENV_LOC 2>&1)
162162

163-
# If there's an error, purge and recreate.
164-
[ $? -ne 0 ] && {
165-
puts-warn "Virtualenv corrupt, rebuilding."
163+
[ $? -ne 0 -o -n "$CLEAN_VIRTUALENV" ] && {
164+
if [ -n "$CLEAN_VIRTUALENV" ]
165+
then echo " ! CLEAN_VIRTUALENV set, rebuilding virtualenv."
166+
else echo " ! Virtualenv corrupt, rebuilding."
167+
fi
166168
for dir in $VIRTUALENV_DIRS; do
167169
rm -fr $dir &> /dev/null || true
168-
done
170+
done
169171
OUT=$(virtualenv --python $PYTHON_EXE --distribute --never-download --prompt='(venv) ' $VIRTUALENV_LOC )
170172
}
171173
echo "$OUT" | indent
@@ -222,4 +224,4 @@ done
222224
# Experimental post_compile hook.
223225
source $BIN_DIR/steps/hooks/post_compile
224226

225-
# <a href="http://github.com/heroku/heroku-buildpack-python"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://d3nwyuy0nl342s.cloudfront.net/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>
227+
# <a href="http://github.com/heroku/heroku-buildpack-python"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://d3nwyuy0nl342s.cloudfront.net/img/7afbc8b248c68eb468279e8c17986ad46549fb71/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>

0 commit comments

Comments
 (0)