Commit 566f7f45 authored by Kenneth Reitz's avatar Kenneth Reitz

new buildpack env standard

parent 4ff62b2b
......@@ -15,7 +15,7 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
ROOT_DIR=$(dirname $BIN_DIR)
BUILD_DIR=$1
CACHE_DIR=$2
ENV_FILE=$3
ENV_DIR=$3
CACHED_DIRS=".heroku"
......
......@@ -59,10 +59,22 @@ function deep-rm (){
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
}
function sub-env (){
if [[ -f $ENV_FILE ]]; then
(export $(egrep -v '^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)' -f $ENV_FILE); $1)
else
sub-env() {
WHITELIST=${2:-''}
BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'}
(
if [ -d "$ENV_DIR" ]; then
for e in $(ls $ENV_DIR); do
echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" &&
export "$e=$(cat $ENV_DIR/$e)"
:
done
fi
$1
fi
}
)
}
\ No newline at end of file
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