mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Reduce the number of env vars exposed to subprocess (#1011)
The following env vars are no longer exposed to subprocesses run by the buildpack (such as the `bin/pre_compile` and `bin/post_compile` hooks): * `BPLOG_PREFIX` * `CACHED_PYTHON_STACK` * `DEFAULT_PYTHON_STACK` * `DEFAULT_PYTHON_VERSION` * `LATEST_27` * `LATEST_34` * `LATEST_35` * `LATEST_36` * `LATEST_37` * `LATEST_38` * `PIP_UPDATE` * `PY27` * `PY34` * `PY35` * `PY36` * `PY37` * `PYPY_27` * `PYPY_36` * `RECOMMENDED_PYTHON_VERSION` * `WARNINGS_LOG` There were previously no tests at all for the pre/post-compile hooks, so I've added some now. Fixes #1010.
This commit is contained in:
+4
-8
@@ -16,7 +16,9 @@
|
||||
set -eo pipefail
|
||||
|
||||
# Boostrap the Buildpack Standard Library.
|
||||
export BPLOG_PREFIX="buildpack.python"
|
||||
# Disable unused env var warning since shellcheck doesn't know about the stdlib.
|
||||
# shellcheck disable=2034
|
||||
BPLOG_PREFIX="buildpack.python"
|
||||
export BUILDPACK_LOG_FILE=${BUILDPACK_LOG_FILE:-/dev/null}
|
||||
|
||||
[ "$BUILDPACK_XTRACE" ] && set -o xtrace
|
||||
@@ -84,16 +86,12 @@ if [[ -f "$BUILD_DIR/Pipfile" ]]; then
|
||||
PIP_UPDATE="9.0.2"
|
||||
fi
|
||||
|
||||
export DEFAULT_PYTHON_STACK PIP_UPDATE
|
||||
export PY37 PY36 PY35 PY27 PY34
|
||||
|
||||
# Common Problem Warnings:
|
||||
# This section creates a temporary file in which to stick the output of `pip install`.
|
||||
# The `warnings` subscript then greps through this for common problems and guides
|
||||
# the user towards resolution of known issues.
|
||||
WARNINGS_LOG=$(mktemp)
|
||||
export WARNINGS_LOG
|
||||
export RECOMMENDED_PYTHON_VERSION=$DEFAULT_PYTHON_VERSION
|
||||
RECOMMENDED_PYTHON_VERSION=$DEFAULT_PYTHON_VERSION
|
||||
|
||||
# The buildpack ships with a few executable tools (e.g. pip-grep, etc).
|
||||
# This installs them into the path, so we can execute them directly.
|
||||
@@ -217,8 +215,6 @@ else
|
||||
CACHED_PYTHON_STACK=$STACK
|
||||
fi
|
||||
|
||||
export CACHED_PYTHON_STACK
|
||||
|
||||
# Pipenv Python version support.
|
||||
# Detect the version of Python requested from a Pipfile (e.g. python_version or python_full_version).
|
||||
# Convert it to a runtime.txt file.
|
||||
|
||||
+5
-10
@@ -1,5 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Disable unused env var warning, since shellcheck doesn't take into account
|
||||
# that this file is sourced. We don't want to use export since it exposes
|
||||
# the env vars to subprocesses.
|
||||
# shellcheck disable=2034
|
||||
|
||||
DEFAULT_PYTHON_VERSION="python-3.6.11"
|
||||
LATEST_38="python-3.8.5"
|
||||
LATEST_37="python-3.7.8"
|
||||
@@ -9,13 +14,3 @@ LATEST_34="python-3.4.10"
|
||||
LATEST_27="python-2.7.18"
|
||||
PYPY_36="pypy3.6-7.3.1"
|
||||
PYPY_27="pypy2.7-7.3.1"
|
||||
|
||||
export DEFAULT_PYTHON_VERSION \
|
||||
LATEST_38 \
|
||||
LATEST_37 \
|
||||
LATEST_36 \
|
||||
LATEST_35 \
|
||||
LATEST_34 \
|
||||
LATEST_27 \
|
||||
PYPY_36 \
|
||||
PYPY_27
|
||||
|
||||
Reference in New Issue
Block a user