From 155b5eecb9a18381e8a04acb5c945ae83faae7ac Mon Sep 17 00:00:00 2001 From: Kenneth Reitz <me@kennethreitz.org> Date: Mon, 28 Aug 2017 13:41:32 -0400 Subject: [PATCH] Grep bug fix (#456) * fixed the bug for pypy-5.8.0 * changelog entry Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * use std-lib sub-env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * let's see if this cleans things up Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * try v7 of stdlib Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * use new sub_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * set_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * set_default_env Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * v8 of stdlib Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * v112 Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * oops (merge bug) Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * final merge error resolve Signed-off-by: Kenneth Reitz <me@kennethreitz.org> * final final fix for merge conflict Signed-off-by: Kenneth Reitz <me@kennethreitz.org> --- CHANGELOG.md | 8 +++++++- bin/compile | 22 +++++++++++----------- bin/steps/hooks/post_compile | 2 +- bin/steps/hooks/pre_compile | 2 +- bin/steps/nltk | 2 +- bin/steps/pip-install | 2 +- bin/utils | 26 +------------------------- 7 files changed, 23 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7c3f15..463c9322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Python Buildpack Changelog +# 112 + +Bugfix. + +- Fixed grep output bug. + # 111 -Linting , bugfixes. +Linting, bugfixes. # 110 diff --git a/bin/compile b/bin/compile index ad0ac09f..c2885214 100755 --- a/bin/compile +++ b/bin/compile @@ -182,7 +182,7 @@ source "$BIN_DIR/steps/cryptography" # Support for Geo libraries. # shellcheck source=bin/steps/geo-libs -sub-env "$BIN_DIR/steps/geo-libs" +sub_env "$BIN_DIR/steps/geo-libs" # GDAL support. # shellcheck source=bin/steps/gdal @@ -202,7 +202,7 @@ mtime "pip.install.time" "${start}" # Support for NLTK corpora. let start=$(nowms) -sub-env "$BIN_DIR/steps/nltk" +sub_env "$BIN_DIR/steps/nltk" mtime "nltk.download.time" "${start}" # Support for pip install -e. @@ -215,20 +215,20 @@ fi # Django collectstatic support. let start=$(nowms) -sub-env "$BIN_DIR/steps/collectstatic" +sub_env "$BIN_DIR/steps/collectstatic" mtime "collectstatic.time" "${start}" # Create .profile script for application runtime environment variables. -set-env PATH "\$HOME/.heroku/python/bin:\$PATH" -set-env PYTHONUNBUFFERED true -set-env PYTHONHOME /app/.heroku/python +set_env PATH "\$HOME/.heroku/python/bin:\$PATH" +set_env PYTHONUNBUFFERED true +set_env PYTHONHOME /app/.heroku/python -set-env LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LIBRARY_PATH" -set-env LD_LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LD_LIBRARY_PATH" +set_env LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LIBRARY_PATH" +set_env LD_LIBRARY_PATH "/app/.heroku/vendor/lib:/app/.heroku/python/lib:\$LD_LIBRARY_PATH" -set-default-env LANG en_US.UTF-8 -set-default-env PYTHONHASHSEED random -set-default-env PYTHONPATH /app/ +set_default_env LANG en_US.UTF-8 +set_default_env PYTHONHASHSEED random +set_default_env PYTHONPATH /app/ # Install sane-default script for $WEB_CONCURRENCY and $FORWARDED_ALLOW_IPS. cp "$ROOT_DIR/vendor/WEB_CONCURRENCY.sh" "$WEB_CONCURRENCY_PROFILE_PATH" diff --git a/bin/steps/hooks/post_compile b/bin/steps/hooks/post_compile index e4afc09e..014f791c 100755 --- 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 - sub-env 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 86c706b6..af788d9a 100755 --- 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 - sub-env bin/pre_compile + sub_env bin/pre_compile fi \ No newline at end of file diff --git a/bin/steps/nltk b/bin/steps/nltk index f1557fdc..92f3fff7 100755 --- a/bin/steps/nltk +++ b/bin/steps/nltk @@ -25,7 +25,7 @@ if sp-grep -s nltk; then puts-step "Downloading NLTK packages: $nltk_packages" python -m nltk.downloader -d "$BUILD_DIR/.heroku/python/nltk_data" "$nltk_packages" | indent - set-env NLTK_DATA "/app/.heroku/python/nltk_data" + set_env NLTK_DATA "/app/.heroku/python/nltk_data" else puts-warn "'nltk.txt' not found, not downloading any corpora" diff --git a/bin/steps/pip-install b/bin/steps/pip-install index d0941f2a..c60d5243 100755 --- a/bin/steps/pip-install +++ b/bin/steps/pip-install @@ -6,7 +6,7 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then puts-step "Installing requirements with pip" set +e - sub-env /app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent + sub_env /app/.heroku/python/bin/pip install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src=/app/.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent PIP_STATUS="${PIPESTATUS[0]}" set -e diff --git a/bin/utils b/bin/utils index 4a06a469..b748bbea 100755 --- a/bin/utils +++ b/bin/utils @@ -4,7 +4,7 @@ shopt -s nullglob # The standard library. if [[ ! -f /tmp/stdlib.sh ]]; then - curl --retry 3 -s https://lang-common.s3.amazonaws.com/buildpack-stdlib/v2/stdlib.sh > /tmp/stdlib.sh + curl --retry 3 -s https://lang-common.s3.amazonaws.com/buildpack-stdlib/v8/stdlib.sh > /tmp/stdlib.sh fi # shellcheck source=/dev/null source /tmp/stdlib.sh @@ -53,30 +53,6 @@ deep-cp() { } -sub-env() { - - WHITELIST=${2:-''} - BLACKLIST=${3:-'^(GIT_DIR|STACK|PYTHONHOME|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'} - - # Python-specific variables. - export PYHONHOME=$BUILD_DIR/.heroku/python - export PYTHONPATH=$BUILD_DIR/ - - ( - if [ -d "$ENV_DIR" ]; then - # shellcheck disable=SC2045 - for e in $(ls "$ENV_DIR"); do - echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" && - export "$e=$(cat "$ENV_DIR/$e")" - : - done - fi - - "$@" - - ) -} - # Measure the size of the Python installation. measure-size() { echo "$(du -s .heroku/python 2>/dev/null || echo 0) | awk '{print $1}')" -- GitLab