Commit 06946d36 authored by Kenneth Reitz's avatar Kenneth Reitz

step/warn functions

parent cd8530a5
...@@ -67,6 +67,14 @@ function virtualenv (){ ...@@ -67,6 +67,14 @@ function virtualenv (){
python "$ROOT_DIR/vendor/virtualenv-1.7/virtualenv.py" "$@" python "$ROOT_DIR/vendor/virtualenv-1.7/virtualenv.py" "$@"
} }
function puts-step (){
echo "-----> $@"
}
function puts-warn (){
echo " ! $@"
}
# ## Build Time # ## Build Time
# #
...@@ -79,19 +87,19 @@ cd $BUILD_DIR ...@@ -79,19 +87,19 @@ cd $BUILD_DIR
# Reject a Django app that appears to be packaged incorrectly. # Reject a Django app that appears to be packaged incorrectly.
if [ "$NAME" = "Python" ]; then if [ "$NAME" = "Python" ]; then
[ -f settings.py ] && { echo " ! Django settings must be in a package subdirectory"; exit 1; } [ -f settings.py ] && { puts-warn "Django settings must be in a package subdirectory"; exit 1; }
(grep -Fiq "django" requirements.txt) && [ -f settings.py ] && { echo " ! Django app must be in a package subdirectory"; exit 1; } (grep -Fiq "django" requirements.txt) && [ -f settings.py ] && { puts-warn "Django app must be in a package subdirectory"; exit 1; }
fi fi
# Warn for a checked-in virtualenv. # Warn for a checked-in virtualenv.
if [ -d "lib" ] || [ -d "bin" ]; then if [ -d "lib" ] || [ -d "bin" ]; then
echo " ! You have a virtualenv checked in. You should ignore the appropriate paths in your repo. See http://devcenter.heroku.com/articles/gitignore for more info."; puts-warn "You have a virtualenv checked in. You should ignore the appropriate paths in your repo. See http://devcenter.heroku.com/articles/gitignore for more info.";
fi fi
# Reject a conflicting checked-in virtualenv. # Reject a conflicting checked-in virtualenv.
if [ -f "lib/python2.7" ]; then if [ -f "lib/python2.7" ]; then
echo " ! Checked-in virtualenv conflict." puts-warn "Checked-in virtualenv conflict."
exit 1; exit 1;
fi fi
...@@ -108,15 +116,15 @@ done ...@@ -108,15 +116,15 @@ done
# TODO: Bootstrap a bottled Python VM... # TODO: Bootstrap a bottled Python VM...
set +e set +e
echo "-----> Preparing Python interpreter ($PYTHON_VERSION)" puts-step "Preparing Python interpreter ($PYTHON_VERSION)"
echo "-----> Creating Virtualenv version $(virtualenv --version)" puts-step "Creating Virtualenv version $(virtualenv --version)"
# Try to create the virtualenv. # Try to create the virtualenv.
OUT=$(virtualenv --python $PYTHON_EXE --distribute --never-download --prompt=venv . 2>&1) OUT=$(virtualenv --python $PYTHON_EXE --distribute --never-download --prompt=venv . 2>&1)
# If there's an error, purge and recreate. # If there's an error, purge and recreate.
[ $? -ne 0 ] && { [ $? -ne 0 ] && {
echo " ! Virtualenv corrupt, rebuilding." puts-warn "Virtualenv corrupt, rebuilding."
for dir in $VIRTUALENV_DIRS; do for dir in $VIRTUALENV_DIRS; do
rm -fr $dir &> /dev/null || true rm -fr $dir &> /dev/null || true
done done
...@@ -134,7 +142,7 @@ mkdir -p .heroku ...@@ -134,7 +142,7 @@ mkdir -p .heroku
source $BIN_DIR/steps/pylibmc source $BIN_DIR/steps/pylibmc
# Activate the Virtualenv. # Activate the Virtualenv.
echo "-----> Activating virtualenv" puts-step "Activating virtualenv"
source bin/activate source bin/activate
...@@ -149,7 +157,7 @@ if (grep -Fiq "hg+" requirements.txt) then ...@@ -149,7 +157,7 @@ if (grep -Fiq "hg+" requirements.txt) then
fi fi
# Install dependencies with Pip. # Install dependencies with Pip.
echo "-----> Installing dependencies using Pip version $(pip --version | awk '{print $2}')" puts-step "Installing dependencies using Pip version $(pip --version | awk '{print $2}')"
pip install --use-mirrors -r requirements.txt --src ./.heroku/src | indent pip install --use-mirrors -r requirements.txt --src ./.heroku/src | indent
# Do additional application hackery if applications appears to be a Django app. # Do additional application hackery if applications appears to be a Django app.
...@@ -165,7 +173,7 @@ fi ...@@ -165,7 +173,7 @@ fi
set +e set +e
OUT=$(virtualenv --python $PYTHON_EXE --relocatable .) OUT=$(virtualenv --python $PYTHON_EXE --relocatable .)
[ $? -ne 0 ] && { [ $? -ne 0 ] && {
echo " ! Error making virtualenv relocatable" puts-warn "Error making virtualenv relocatable"
echo "$OUT" | indent echo "$OUT" | indent
exit 1 exit 1
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment