diff --git a/bin/compile b/bin/compile index 56335c8a153b79ad229c550598948a7dacedefea..f700ed1a0d73d7edf23656537567722fbbc77eeb 100755 --- a/bin/compile +++ b/bin/compile @@ -54,6 +54,11 @@ export PATH=$PATH:$ROOT_DIR/vendor/pip-pop [ ! "$SLUG_ID" ] && SLUG_ID="defaultslug" [ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID [ ! "$STACK" ] && STACK=$DEFAULT_PYTHON_STACK +[[ $BUILD_DIR == "/app" ]] && SKIP_MOVE_BUILD=$1 + +echo $SKIP_MOVE_BUILD +echo $BUILD_DIR +echo '^^^^' # Sanitizing environment variables. unset GIT_DIR PYTHONHOME PYTHONPATH @@ -78,7 +83,7 @@ APP_DIR='/app' TMP_APP_DIR=$CACHE_DIR/tmp_app_dir # Skip these steps for Docker. -if [[ ! "$DOCKER_BUILD" ]]; then +if [[ ! "$SKIP_MOVE_BUILD" ]]; then # Copy Anvil app dir to temporary storage... bpwatch start anvil_appdir_stage @@ -103,10 +108,11 @@ BUILD_DIR=$APP_DIR # Set up outputs under new context PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh" +EXPORT_PATH="$BIN_DIR/../export" GUNICORN_PROFILE_PATH="$BUILD_DIR/.profile.d/python.gunicorn.sh" # We'll need to send these statics to other scripts we `source`. -export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH +export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH EXPORT_PATH # Prepend proper environment variables for Python use. export PATH=$BUILD_DIR/.heroku/python/bin:$BUILD_DIR/.heroku/vendor/bin:$PATH @@ -252,7 +258,7 @@ bpwatch start dump_cache bpwatch stop dump_cache # Fin. -if [[ ! "$DOCKER_BUILD" ]]; then +if [[ ! "$SKIP_MOVE_BUILD" ]]; then bpwatch start appdir_commit deep-rm $ORIG_BUILD_DIR diff --git a/bin/test-compile b/bin/test-compile new file mode 100755 index 0000000000000000000000000000000000000000..50d1933acd6e2ba148880704c23722e23647ab21 --- /dev/null +++ b/bin/test-compile @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Syntax sugar. +BIN_DIR=$(cd $(dirname $0); pwd) # absolute path +source $BIN_DIR/utils + +DISABLE_COLLECTSTATIC=1 "$(dirname ${0:-})/compile" "$1" "$2" "$3" + +if [[ -f "$1/requirements-test.txt" ]]; then + /app/.heroku/python/bin/pip install -r requirements-test.txt --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | cleanup | indent +fi diff --git a/bin/utils b/bin/utils index dd15c6ebd07ec2e37f71639906d87a0dfe8a347c..9ce17218f6171265765b6c1c879358f71bbb2853 100755 --- a/bin/utils +++ b/bin/utils @@ -39,11 +39,13 @@ puts-cmd() { # Usage: $ set-env key value set-env() { echo "export $1=$2" >> $PROFILE_PATH + echo "export $1=$2" >> $EXPORT_PATH } # Usage: $ set-default-env key value set-default-env() { echo "export $1=\${$1:-$2}" >> $PROFILE_PATH + echo "export $1=\${$1:-$2}" >> $EXPORT_PATH } # Usage: $ un-set-env key