mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Revert "Refactor: $BUILD_DIR"
This commit is contained in:
@@ -30,11 +30,12 @@ if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ] && [ "$DJANGO_INSTALL
|
||||
puts-step "$ python $MANAGE_FILE collectstatic --noinput"
|
||||
|
||||
# Run collectstatic, cleanup some of the noisy output.
|
||||
PYTHONPATH=${PYTHONPATH:-$BUILD_DIR}
|
||||
PYTHONPATH=${PYTHONPATH:-.}
|
||||
export PYTHONPATH
|
||||
|
||||
# Create a temporary file for collecting the collectstaic logs.
|
||||
COLLECTSTATIC_LOG=$(mktemp)
|
||||
|
||||
python "$MANAGE_FILE" collectstatic --noinput --traceback 2>&1 | tee "$COLLECTSTATIC_LOG" | sed '/^Post-processed/d;/^Copying/d;/^$/d' | indent
|
||||
COLLECTSTATIC_STATUS="${PIPESTATUS[0]}"
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
# The location of the pre-compiled cryptography binary.
|
||||
VENDORED_GDAL="${VENDOR_URL}/libraries/vendor/gdal.tar.gz"
|
||||
|
||||
PKG_CONFIG_PATH="$BUILD_DIR/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
|
||||
# Syntax sugar.
|
||||
# shellcheck source=bin/utils
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ VENDORED_GDAL="${VENDOR_URL}/libraries/vendor/gdal.tar.gz"
|
||||
VENDORED_GEOS="${VENDOR_URL}/libraries/vendor/geos.tar.gz"
|
||||
VENDORED_PROJ="${VENDOR_URL}/libraries/vendor/proj.tar.gz"
|
||||
|
||||
PKG_CONFIG_PATH="$BUILD_DIR/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
PKG_CONFIG_PATH="/app/.heroku/vendor/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
|
||||
# Syntax sugar.
|
||||
# shellcheck source=bin/utils
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
# Install Mercurial if it appears to be required.
|
||||
if [[ -f "requirements.txt" ]]; then
|
||||
if (grep -Fiq "hg+" requirements.txt) then
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" install mercurial | cleanup | indent
|
||||
/app/.heroku/python/bin/pip install mercurial | cleanup | indent
|
||||
mcount "steps.mercurial"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -41,8 +41,7 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
||||
if [ ! -f "$BUILD_DIR/.heroku/python/bin/pip" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" install -r "$BUILD_DIR/requirements.txt" --exists-action=w --src="$BUILD_DIR/.heroku/src" --disable-pip-version-check --no-cache-dir 2>&1 | tee "$WARNINGS_LOG" | cleanup | indent
|
||||
/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
|
||||
|
||||
@@ -55,7 +54,7 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
||||
|
||||
# Smart Requirements handling
|
||||
cp requirements.txt .heroku/python/requirements-declared.txt
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt
|
||||
/app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt
|
||||
|
||||
echo
|
||||
|
||||
@@ -63,7 +62,7 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
||||
if [ "$INSTALL_TEST" ]; then
|
||||
if [[ -f "$1/requirements-test.txt" ]]; then
|
||||
puts-step "Installing test dependencies…"
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" install -r "$1/requirements-test.txt" --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | cleanup | indent
|
||||
/app/.heroku/python/bin/pip install -r "$1/requirements-test.txt" --exists-action=w --src=./.heroku/src --disable-pip-version-check --no-cache-dir 2>&1 | cleanup | indent
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -20,7 +20,7 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
|
||||
|
||||
if [[ -s .heroku/python/requirements-stale.txt ]]; then
|
||||
puts-step "Uninstalling stale dependencies"
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" uninstall -r .heroku/python/requirements-stale.txt -y --exists-action=w --disable-pip-version-check | cleanup | indent
|
||||
/app/.heroku/python/bin/pip uninstall -r .heroku/python/requirements-stale.txt -y --exists-action=w --disable-pip-version-check | cleanup | indent
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
+6
-5
@@ -12,7 +12,7 @@ if [[ -f Pipfile.lock ]]; then
|
||||
# Measure that we're using Pipenv.
|
||||
mcount "tool.pipenv"
|
||||
|
||||
# Don't skip installation if there are git deps.
|
||||
# Don't skip installation of there are git deps.
|
||||
if ! grep -q 'git' Pipfile.lock; then
|
||||
echo "Skipping installation, as Pipfile.lock hasn't changed since last deploy." | indent
|
||||
|
||||
@@ -58,17 +58,18 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
|
||||
# Due to weird old pip behavior and pipenv behavior, pipenv upgrades pip
|
||||
# to latest if only --upgrade is specified. Specify upgrade strategy to
|
||||
# avoid this eager behavior.
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" install pipenv==$PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
|
||||
/app/.heroku/python/bin/pip install pipenv==$PIPENV_VERSION --upgrade --upgrade-strategy only-if-needed &> /dev/null
|
||||
|
||||
# Install the test dependencies, for CI.
|
||||
if [ "$INSTALL_TEST" ]; then
|
||||
puts-step "Installing test dependencies…"
|
||||
"$BUILD_DIR/.heroku/python/bin/pipenv" install --dev --system --deploy 2>&1 | cleanup | indent
|
||||
/app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
|
||||
|
||||
# Install the dependencies.
|
||||
elif [[ ! -f Pipfile.lock ]]; then
|
||||
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION…"
|
||||
"$BUILD_DIR/.heroku/python/bin/pipenv" install --system --skip-lock 2>&1 | indent
|
||||
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
|
||||
|
||||
else
|
||||
pipenv-to-pip Pipfile.lock > requirements.txt
|
||||
"$BIN_DIR/steps/pip-uninstall"
|
||||
@@ -76,7 +77,7 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then
|
||||
openssl dgst -sha256 Pipfile.lock > .heroku/python/Pipfile.lock.sha256
|
||||
|
||||
puts-step "Installing dependencies with Pipenv $PIPENV_VERSION…"
|
||||
"$BUILD_DIR/.heroku/python/bin/pipenv" install --system --deploy 2>&1 | indent
|
||||
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
|
||||
fi
|
||||
fi
|
||||
else
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
# Detect Python-version with Pipenv.
|
||||
|
||||
if [[ -f "$BUILD_DIR/Pipfile" ]]; then
|
||||
if [[ -f $BUILD_DIR/Pipfile ]]; then
|
||||
|
||||
if [[ ! -f "$BUILD_DIR/runtime.txt" ]]; then
|
||||
if [[ ! -f "$BUILD_DIR/Pipfile.lock" ]]; then
|
||||
if [[ ! -f $BUILD_DIR/runtime.txt ]]; then
|
||||
if [[ ! -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
puts-warn "No 'Pipfile.lock' found! We recommend you commit this into your repository."
|
||||
fi
|
||||
if [[ -f "$BUILD_DIR/Pipfile.lock" ]]; then
|
||||
if [[ -f $BUILD_DIR/Pipfile.lock ]]; then
|
||||
set +e
|
||||
PYTHON=$(jq -r '._meta.requires.python_full_version' "$BUILD_DIR/Pipfile.lock")
|
||||
if [[ "$PYTHON" != "null" ]]; then
|
||||
|
||||
+4
-4
@@ -113,11 +113,11 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
|
||||
puts-step "Installing pip"
|
||||
|
||||
# Remove old installations.
|
||||
rm -fr "$BUILD_DIR/.heroku/python/lib/python*/site-packages/pip-*"
|
||||
rm -fr "$BUILD_DIR/.heroku/python/lib/python*/site-packages/setuptools-*"
|
||||
rm -fr /app/.heroku/python/lib/python*/site-packages/pip-*
|
||||
rm -fr /app/.heroku/python/lib/python*/site-packages/setuptools-*
|
||||
|
||||
"$BUILD_DIR/.heroku/python/bin/python" "$ROOT_DIR/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
|
||||
"$BUILD_DIR/.heroku/python/bin/pip" install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
|
||||
/app/.heroku/python/bin/python "$ROOT_DIR/get-pip.py" pip=="$PIP_UPDATE" &> /dev/null
|
||||
/app/.heroku/python/bin/pip install "$ROOT_DIR/vendor/setuptools-39.0.1-py2.py3-none-any.whl" &> /dev/null
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
Reference in New Issue
Block a user