Skip to content
Snippets Groups Projects
Commit 5bd3d075 authored by Kenneth Reitz's avatar Kenneth Reitz
Browse files

Merge branch 'master' into versions

parents 3b58eefc 500daaf6
No related branches found
No related tags found
No related merge requests found
# Python Buildpack Changelog
# 124
Update buildpack to automatically install [dev-packages] (Pipenv) during Heroku CI builds.
# 123
Update gunicorn init.d script to allow overrides.
# 122
Update default Python to v3.6.4.
# 121
Update default Python to v3.6.3.
......
......@@ -23,7 +23,7 @@ Deploying a Python application couldn't be easier:
$ git push heroku master
-----> Python app detected
-----> Installing python-3.6.3
-----> Installing python-3.6.4
-----> Installing pip
-----> Installing requirements with latest pipenv…
...
......@@ -58,7 +58,7 @@ Or, more specifically:
Runtime options include:
- `python-3.6.3`
- `python-3.6.4`
- `python-2.7.14`
- `pypy-5.7.1` (unsupported, experimental)
- `pypy3-5.5.1` (unsupported, experimental)
......@@ -34,8 +34,8 @@ ENV_DIR=$3
export BUILD_DIR CACHE_DIR ENV_DIR
# Python defaults
DEFAULT_PYTHON_VERSION="python-3.6.3"
LATEST_3="python-3.6.3"
DEFAULT_PYTHON_VERSION="python-3.6.4"
LATEST_3="python-3.6.4"
LATEST_2="python-2.7.14"
DEFAULT_PYTHON_STACK="cedar-14"
......
#!/usr/bin/env bash
# shellcheck source=bin/utils
source $BIN_DIR/utils
if [ ! "$SKIP_PIP_INSTALL" ]; then
# Install dependencies with Pip.
puts-step "Installing requirements with pip"
set +e
# Measure that we're using pip.
mcount "tool.pip"
/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]}"
......@@ -23,4 +29,12 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then
/app/.heroku/python/bin/pip freeze --disable-pip-version-check > .heroku/python/requirements-installed.txt
echo
# Install test dependencies, for CI.
if [ "$INSTALL_TEST" ]; then
if [[ -f "$1/requirements-test.txt" ]]; then
puts-step "Installing test dependencies…"
/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
......@@ -2,22 +2,32 @@
# export CLINT_FORCE_COLOR=1
# export PIPENV_FORCE_COLOR=1
# shellcheck source=bin/utils
source $BIN_DIR/utils
# Pipenv support (Generate requriements.txt with pipenv).
if [[ -f Pipfile ]]; then
if [[ ! -f requirements.txt ]]; then
puts-step "Installing requirements with latest Pipenv…"
# Measure that we're using Pipenv.
mcount "tool.pipenv"
# Install pipenv.
/app/.heroku/python/bin/pip install pipenv --upgrade &> /dev/null
# Install the dependencies.
if [[ ! -f Pipfile.lock ]]; then
/app/.heroku/python/bin/pipenv install --system --skip-lock 2>&1 | indent
else
/app/.heroku/python/bin/pipenv install --system --deploy 2>&1 | indent
fi
# Install the dependencies.
# Install the test dependencies, for CI.
if [ "$INSTALL_TEST" ]; then
puts-step "Installing test dependencies…"
/app/.heroku/python/bin/pipenv install --dev --system --deploy 2>&1 | cleanup | indent
fi
# Skip pip install, later.
export SKIP_PIP_INSTALL=1
......
......@@ -6,8 +6,8 @@ BIN_DIR=$(cd "$(dirname "$0")" || return; pwd) # absolute path
# shellcheck source=bin/utils
source "$BIN_DIR/utils"
DISABLE_COLLECTSTATIC=1 "$(dirname "${0:-}")/compile" "$1" "$2" "$3"
# Locale support for Pipenv.
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
if [[ -f "$1/requirements-test.txt" ]]; then
/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
DISABLE_COLLECTSTATIC=1 INSTALL_TEST=1 "$(dirname "${0:-}")/compile" "$1" "$2" "$3"
\ No newline at end of file
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
# Build Deps: libraries/sqlite
OUT_PREFIX=$1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.6.4/Python-3.6.4.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.4 src
cd src
./configure --prefix=$OUT_PREFIX --with-ensurepip=no
make
make install
# Remove unneeded test directories, similar to the official Docker Python images:
# https://github.com/docker-library/python
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +
ln $OUT_PREFIX/bin/python3 $OUT_PREFIX/bin/python
......@@ -12,7 +12,7 @@ testPipenvLock() {
testPipenvVersion() {
compile "pipenv-version"
assertCaptured "3.6.3"
assertCaptured "3.6.4"
assertCapturedSuccess
}
......@@ -78,7 +78,7 @@ testPython2() {
testPython3() {
compile "python3"
assertCaptured "python-3.6.3"
assertCaptured "python-3.6.4"
assertCapturedSuccess
}
......
......@@ -25,9 +25,9 @@ SHUNIT_ERROR=2
# enable strict mode by default
SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}}
_shunit_warn() { echo "shunit2:WARN $@" >&2; }
_shunit_error() { echo "shunit2:ERROR $@" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; }
_shunit_warn() { echo "shunit2:WARN $*" >&2; }
_shunit_error() { echo "shunit2:ERROR $*" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $*" >&2; exit ${SHUNIT_ERROR}; }
# specific shell checks
if [ -n "${ZSH_VERSION:-}" ]; then
......
......@@ -36,7 +36,7 @@ capture()
LAST_COMMAND="$@"
$@ >${STD_OUT} 2>${STD_ERR}
"$@" >${STD_OUT} 2>${STD_ERR}
RETURN=$?
rtrn=${RETURN} # deprecated
}
......
# Automatic configuration for Gunicorn's ForwardedAllowIPS setting.
export FORWARDED_ALLOW_IPS='*'
# Automatic configuration for Gunicorn's stdout access log setting.
export GUNICORN_CMD_ARGS=${GUNICORN_CMD_ARGS:-"--access-logfile -"}
......@@ -25,9 +25,9 @@ SHUNIT_ERROR=2
# enable strict mode by default
SHUNIT_STRICT=${SHUNIT_STRICT:-${SHUNIT_TRUE}}
_shunit_warn() { echo "shunit2:WARN $@" >&2; }
_shunit_error() { echo "shunit2:ERROR $@" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $@" >&2; exit ${SHUNIT_ERROR}; }
_shunit_warn() { echo "shunit2:WARN $*" >&2; }
_shunit_error() { echo "shunit2:ERROR $*" >&2; }
_shunit_fatal() { echo "shunit2:FATAL $*" >&2; exit ${SHUNIT_ERROR}; }
# specific shell checks
if [ -n "${ZSH_VERSION:-}" ]; then
......
......@@ -36,7 +36,7 @@ capture()
LAST_COMMAND="$@"
$@ >${STD_OUT} 2>${STD_ERR}
"$@" >${STD_OUT} 2>${STD_ERR}
RETURN=$?
rtrn=${RETURN} # deprecated
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment