Commit f3ef1526 authored by Casey Faist's avatar Casey Faist

update tests to pass, add 3.4

parent ef1f7f69
...@@ -52,14 +52,22 @@ export VENDOR_URL ...@@ -52,14 +52,22 @@ export VENDOR_URL
DEFAULT_PYTHON_VERSION="python-3.6.6" DEFAULT_PYTHON_VERSION="python-3.6.6"
LATEST_36="python-3.6.6" LATEST_36="python-3.6.6"
LATEST_37="python-3.7.0" LATEST_37="python-3.7.0"
LATEST_35="python-3.5.6"
LATEST_2="python-2.7.15" LATEST_2="python-2.7.15"
# Supported Python Branches
PY37="python-3.7"
PY36="python-3.6"
PY35="python-3.5"
PY27="python-2.7"
# Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)? # Which stack is used (for binary downloading), if none is provided (e.g. outside of Heroku)?
DEFAULT_PYTHON_STACK="cedar-14" DEFAULT_PYTHON_STACK="cedar-14"
# If pip doesn't match this version (the version we install), run the installer. # If pip doesn't match this version (the version we install), run the installer.
PIP_UPDATE="9.0.2" PIP_UPDATE="9.0.2"
export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_36 LATEST_37 export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_36 LATEST_37
export PY37 PY36 PY35 PY27
# Common Problem Warnings: # Common Problem Warnings:
# This section creates a temporary file in which to stick the output of `pip install`. # This section creates a temporary file in which to stick the output of `pip install`.
......
...@@ -7,43 +7,47 @@ PYTHON_VERSION=$(cat runtime.txt) ...@@ -7,43 +7,47 @@ PYTHON_VERSION=$(cat runtime.txt)
# The location of the pre-compiled python binary. # The location of the pre-compiled python binary.
VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz" VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz"
if [[ $PYTHON_VERSION =~ ^python-2 ]]; then # "https://lang-python.s3.amazonaws.com/heroku-16/runtimes/python-3.6.6.tar.gz"
if [[ "$PYTHON_VERSION" != "$LATEST_2" ]]; then
puts-warn "The latest version of Python 2 is $LATEST_2 (you are using $PYTHON_VERSION, which is unsupported)." SECURITY_UPDATE="Python has released a security update! Please consider upgrading to "
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_2)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" # check if runtime exists
else if curl --output /dev/null --silent --head --fail $VENDORED_PYTHON; then
echo " Using supported version of Python 2 ($PYTHON_VERSION)" if [[ $PYTHON_VERSION == $PY37* ]]; then
# do things to alert the user of security release available
if [ $PYTHON_VERSION != $LATEST_37 ]; then
puts-warn SECURITY_UPDATE $LATEST_37
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi fi
else if [[ $PYTHON_VERSION == $PY36* ]]; then
if [[ $PYTHON_VERSION =~ ^python-3 ]]; then # security update note
if [[ $PYTHON_VERSION =~ ^python-3.7 ]]; then if [ $PYTHON_VERSION != $LATEST_36 ]; then
if [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then puts-warn SECURITY_UPDATE $LATEST_36
puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)." echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)." fi
fi
if [[ $PYTHON_VERSION == $PY35* ]]; then
# security update note
if [ $PYTHON_VERSION != $LATEST_35 ]; then
puts-warn SECURITY_UPDATE $LATEST_35
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
echo " Using supported version of Python 3.7 ($PYTHON_VERSION)"
fi
else
if [[ $PYTHON_VERSION =~ ^python-3.6 ]]; then
if [[ "$PYTHON_VERSION" != "$LATEST_36" ]]; then
puts-warn "The latest version of Python 3.6 is $LATEST_36 (you are using $PYTHON_VERSION, which is unsupported)."
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_36)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
echo " Using supported version of Python 3.6 ($PYTHON_VERSION)"
fi
else
puts-warn "Heroku supports runtime versions $LATEST_37, $LATEST_36 and $LATEST_2."
puts-warn "You are using $PYTHON_VERSION, which is unsupported."
puts-warn "We recommend upgrading by specifying the default supported version ($LATEST_36)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi fi
fi fi
if [[ $PYTHON_VERSION == $PY27* ]]; then
# security update note
if [ $PYTHON_VERSION != $LATEST_27 ]; then
puts-warn SECURITY_UPDATE $LATEST_27
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi
fi
else
puts-warn "Requested runtime ($PYTHON_VERSION) is not available for this stack ($STACK)."
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
exit 1
fi fi
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
puts-step "Stack has changed from $CACHED_PYTHON_STACK to $STACK, clearing cache" puts-step "Stack has changed from $CACHED_PYTHON_STACK to $STACK, clearing cache"
rm -fr .heroku/python-stack .heroku/python-version .heroku/python .heroku/vendor .heroku/python .heroku/python-sqlite3-version rm -fr .heroku/python-stack .heroku/python-version .heroku/python .heroku/vendor .heroku/python .heroku/python-sqlite3-version
......
#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
OUT_PREFIX=$1
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
export BIN_DIR
# shellcheck source=bin/utils
source "$BIN_DIR/steps/sqlite3"
sqlite3_version
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
echo "Building Python…"
SOURCE_TARBALL='https://python.org/ftp/python/3.4.9/Python-3.4.9.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.4.9 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 '{}' +
# Remove spare /
LOCATION=${OUT_PREFIX%?}
ln $LOCATION/bin/python3 $LOCATION/bin/python
...@@ -93,24 +93,46 @@ testPython2() { ...@@ -93,24 +93,46 @@ testPython2() {
assertCapturedSuccess assertCapturedSuccess
} }
# This will succeed on Cedar-14 and fail on 16 and 18
testPython3_4() {
compile "python3_4"
assertCaptured "python-3.4.9"
assertCapturedError
}
# This will fail
testPython3_5() { testPython3_5() {
compile "python3_5" compile "python3_5"
assertCaptured "python-3.5.6" assertCaptured "python-3.5.6"
assertCapturedSuccess assertCapturedError
} }
testPython3_6() { testPython3_6() {
compile "python3_6" compile "python3_6"
assertCaptured "python-3.6.7" assertCaptured "python-3.6.6"
assertCapturedSuccess assertCapturedSuccess
} }
# This will fail
testPython3_6_7() {
compile "python3_6_7"
assertCaptured "python-3.6.7"
assertCapturedError
}
testPython3_7() { testPython3_7() {
compile "python3_7" compile "python3_7"
assertCaptured "python-3.7.1" assertCaptured "python-3.7.0"
assertCapturedSuccess assertCapturedSuccess
} }
# This will fail
testPython3_7_1() {
compile "python3_7_1"
assertCaptured "python-3.7.1"
assertCapturedError
}
testGitEgg() { testGitEgg() {
compile "git-egg" compile "git-egg"
assertCaptured "requests" assertCaptured "requests"
......
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