From 206a2dbc0476a44f5c916b564ec9f6e36c8d59d7 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz <me@kennethreitz.com> Date: Fri, 13 Dec 2013 15:48:39 -0800 Subject: [PATCH] third argument support for envs in compile --- bin/compile | 9 +++++---- bin/steps/hooks/post_compile | 2 +- bin/steps/hooks/pre_compile | 2 +- bin/utils | 4 +++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bin/compile b/bin/compile index 01ae6aa6..a2baaf03 100755 --- a/bin/compile +++ b/bin/compile @@ -2,8 +2,7 @@ # Usage: # -# $ bin/compile <build-dir> <cache-dir> - +# $ bin/compile <build-dir> <cache-dir> <env-path> # Fail fast and fail hard. set -eo pipefail @@ -16,6 +15,8 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path ROOT_DIR=$(dirname $BIN_DIR) BUILD_DIR=$1 CACHE_DIR=$2 +ENV_FILE=$3 + CACHED_DIRS=".heroku" @@ -222,7 +223,7 @@ puts-step "Installing dependencies using Pip ($PIP_VERSION)" # Django collectstatic support. bpwatch start collectstatic - source $BIN_DIR/steps/collectstatic + sub-env $BIN_DIR/steps/collectstatic bpwatch stop collectstatic # ### Finalize @@ -261,6 +262,6 @@ bpwatch start anvil_appdir_commit if [ "$SLUG_ID" ]; then deep-mv $TMP_APP_DIR $APP_DIR fi -bpwatch stop anvil_appdir_commit +bpwatch stop anvil_appdir_commit bpwatch stop compile diff --git a/bin/steps/hooks/post_compile b/bin/steps/hooks/post_compile index a5f4c5a2..e4afc09e 100644 --- a/bin/steps/hooks/post_compile +++ b/bin/steps/hooks/post_compile @@ -3,5 +3,5 @@ if [ -f bin/post_compile ]; then echo "-----> Running post-compile hook" chmod +x bin/post_compile - bin/post_compile + sub-env bin/post_compile fi \ No newline at end of file diff --git a/bin/steps/hooks/pre_compile b/bin/steps/hooks/pre_compile index e5eeddf5..86c706b6 100644 --- a/bin/steps/hooks/pre_compile +++ b/bin/steps/hooks/pre_compile @@ -3,5 +3,5 @@ if [ -f bin/pre_compile ]; then echo "-----> Running pre-compile hook" chmod +x bin/pre_compile - bin/pre_compile + sub-env bin/pre_compile fi \ No newline at end of file diff --git a/bin/utils b/bin/utils index ce7f6324..f1e3e6b9 100755 --- a/bin/utils +++ b/bin/utils @@ -59,4 +59,6 @@ function deep-rm (){ find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \; } - +function sub-env (){ + (export $(egrep -v '^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)' $ENV_FILE); $1) +} -- GitLab