diff --git a/bin/compile b/bin/compile index 0267f0f..dfc655e 100755 --- a/bin/compile +++ b/bin/compile @@ -2,8 +2,9 @@ # bin/compile set -e +set -o pipefail -BIN_DIR=$(dirname $0) +BIN_DIR=$(cd $(dirname $0); pwd) # absolute path BUILD_DIR=$1 CACHE_DIR=$2 @@ -24,44 +25,27 @@ for dir in $VIRTUALENV_DIRS; do cp -R $CACHE_DIR/$dir . &> /dev/null || true done -echo "-----> Preparing virtualenv" +echo "-----> $NAME app detected" + +echo "-----> Preparing virtualenv version $(virtualenv --version)" virtualenv --no-site-packages . | sed -u 's/^/ /' -[ "${PIPESTATUS[*]}" == "0 0" ] echo "-----> Byte-compiling code" find . -name "*.py" | xargs bin/python -m py_compile -[ "${PIPESTATUS[*]}" == "0 0" ] # if Django, inject psycopg and append settings -if [ "$NAME" = "Django" ]; then - grep -q ^psycopg2 requirements.txt || ( - echo "-----> Injecting psycopg2 into requirements for PostgreSQL support" - echo "psycopg2==2.3.1" >> requirements.txt - ) +if [ "$NAME" = "Python/Django" ]; then + echo "-----> Django settings injection" SETTINGS_FILE=$(ls **/settings.py | head -1) - echo "-----> Appending code to $SETTINGS_FILE to read from DATABASE_URL" - - cat >>$SETTINGS_FILE < Installing dependencies with pip" +echo "-----> Installing dependencies using pip version $(pip --version | awk '{print $2}')" PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install -r requirements.txt | sed -u 's/^/ /' -[ "${PIPESTATUS[*]}" == "0 0" ] # store new artifacts in cache for dir in $VIRTUALENV_DIRS; do