Commit bc043e99 authored by Liu Junxiao's avatar Liu Junxiao

Merge remote-tracking branch 'upstream/master'

parents 401a3576 06b7f97e
...@@ -9,6 +9,11 @@ jobs: ...@@ -9,6 +9,11 @@ jobs:
- PATH="/tmp/shellcheck-latest:$PATH" - PATH="/tmp/shellcheck-latest:$PATH"
script: make check script: make check
- stage: "Stack Tests"
services: docker
env: STACK=heroku-18
script: ./tests.sh
- stage: "Stack Tests" - stage: "Stack Tests"
services: docker services: docker
env: STACK=heroku-16 env: STACK=heroku-16
......
# Python Buildpack Changelog # Python Buildpack Changelog
# 136
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
# 135
Upgrade Pipenv to v2018.5.18.
# 134 # 134
Default to 3.6.5, bugfixes. Default to 3.6.5, bugfixes.
......
...@@ -18,6 +18,11 @@ test-heroku-16: ...@@ -18,6 +18,11 @@ test-heroku-16:
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' @docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-16" heroku/heroku:16-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo "" @echo ""
test-heroku-18:
@echo "Running tests in docker (heroku-18)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-18" heroku/heroku:18-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo ""
buildenv-heroku-16: buildenv-heroku-16:
@echo "Creating build environment (heroku-16)..." @echo "Creating build environment (heroku-16)..."
@echo @echo
......
...@@ -23,9 +23,9 @@ Deploying a Python application couldn't be easier: ...@@ -23,9 +23,9 @@ Deploying a Python application couldn't be easier:
$ git push heroku master $ git push heroku master
-----> Python app detected -----> Python app detected
-----> Installing python-3.6.4 -----> Installing python-3.6.6
-----> Installing pip -----> Installing pip
-----> Installing requirements with Pipenv 11.7.1 -----> Installing requirements with Pipenv 2018.5.18
... ...
Installing dependencies from Pipfile… Installing dependencies from Pipfile…
-----> Discovering process types -----> Discovering process types
...@@ -58,7 +58,8 @@ Or, with a `runtime.txt` file: ...@@ -58,7 +58,8 @@ Or, with a `runtime.txt` file:
Runtime options include: Runtime options include:
- `python-3.6.4` - `python-3.7.0`
- `python-3.6.6`
- `python-2.7.15` - `python-2.7.15`
......
...@@ -49,8 +49,9 @@ export VENDOR_URL ...@@ -49,8 +49,9 @@ export VENDOR_URL
# These variables are used to specify which versions of Python to install by default, # These variables are used to specify which versions of Python to install by default,
# as well as prompt the user to upgrade if they are using an un–supported version. # as well as prompt the user to upgrade if they are using an un–supported version.
# Note: When 3.7 lands, I recommend switching to LATEST_36 and LATEST_37. # Note: When 3.7 lands, I recommend switching to LATEST_36 and LATEST_37.
DEFAULT_PYTHON_VERSION="python-3.6.5" DEFAULT_PYTHON_VERSION="python-3.6.6"
LATEST_3="python-3.6.5" LATEST_36="python-3.6.6"
LATEST_37="python-3.7.0"
LATEST_2="python-2.7.15" LATEST_2="python-2.7.15"
# 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)?
...@@ -58,7 +59,7 @@ DEFAULT_PYTHON_STACK="cedar-14" ...@@ -58,7 +59,7 @@ 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_3 export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_36 LATEST_37
# 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`.
......
...@@ -22,7 +22,10 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then ...@@ -22,7 +22,10 @@ if [[ -f $BUILD_DIR/Pipfile ]]; then
echo "$LATEST_2" > "$BUILD_DIR/runtime.txt" echo "$LATEST_2" > "$BUILD_DIR/runtime.txt"
fi fi
if [ "$PYTHON" = 3.6 ]; then if [ "$PYTHON" = 3.6 ]; then
echo "$LATEST_3" > "$BUILD_DIR/runtime.txt" echo "$LATEST_36" > "$BUILD_DIR/runtime.txt"
fi
if [ "$PYTHON" = 3.7 ]; then
echo "$LATEST_37" > "$BUILD_DIR/runtime.txt"
fi fi
fi fi
......
...@@ -14,12 +14,17 @@ if [[ $PYTHON_VERSION =~ ^python-2 ]]; then ...@@ -14,12 +14,17 @@ if [[ $PYTHON_VERSION =~ ^python-2 ]]; then
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi fi
else else
if [[ "$PYTHON_VERSION" != "$LATEST_3" ]]; then if [[ $PYTHON_VERSION =~ ^python-3.7 ]] && [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then
puts-warn "The latest version of Python 3 is $LATEST_3 (you are using $PYTHON_VERSION, which is unsupported)." puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)."
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_3)." puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)."
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
else
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" echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
fi fi
fi
fi fi
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
......
#!/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.6/Python-3.6.6.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.6.6 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
#!/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.7.0/Python-3.7.0.tgz'
curl -L $SOURCE_TARBALL | tar xz
mv Python-3.7.0 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
#!/bin/bash
set -e
BP_NAME=${1:-"heroku/python"}
curVersion=$(heroku buildpacks:versions "$BP_NAME" | awk 'FNR == 3 { print $1 }')
newVersion="v$((curVersion + 1))"
read -p "Deploy as version: $newVersion [y/n]? " choice
case "$choice" in
y|Y ) echo "";;
n|N ) exit 0;;
* ) exit 1;;
esac
originMaster=$(git rev-parse origin/master)
echo "Tagging commit $originMaster with $newVersion... "
git tag "$newVersion" "${originMaster:?}"
git push origin refs/tags/$newVersion
heroku buildpacks:publish "$BP_NAME" "$newVersion"
if [ $(git tag | grep -q previous-version) ]; then
echo "Updating previous-version tag"
git tag -d previous-version
git push origin :previous-version
git tag previous-version latest-version
fi
if [ $(git tag | grep -q latest-version) ]; then
echo "Updating latest-version tag"
git tag -d latest-version
git push origin :latest-version
git tag latest-version "${originMaster:?}"
git push --tags
fi
echo "Done."
python-2.7.13 python-3.6.6
\ No newline at end of file
...@@ -12,7 +12,7 @@ testPipenvLock() { ...@@ -12,7 +12,7 @@ testPipenvLock() {
testPipenvVersion() { testPipenvVersion() {
compile "pipenv-version" compile "pipenv-version"
assertCaptured "3.6.5" assertCaptured "3.6.6"
assertCapturedSuccess assertCapturedSuccess
} }
...@@ -39,6 +39,11 @@ testGEOS() { ...@@ -39,6 +39,11 @@ testGEOS() {
} }
testNLTK() { testNLTK() {
# NOTE: This is a RuntimeWarning emitted by Python 3's runpy.py script
# which is what is used when you call `python -m <module>`. This is due to
# how nltk imports things. It's not actually an error, but it would probably
# be bad to silence in Production.
export PYTHONWARNINGS="ignore::RuntimeWarning"
compile "nltk" compile "nltk"
assertCaptured "Downloading NLTK packages: city_database stopwords" assertCaptured "Downloading NLTK packages: city_database stopwords"
assertCapturedSuccess assertCapturedSuccess
...@@ -76,14 +81,23 @@ testPylibmc() { ...@@ -76,14 +81,23 @@ testPylibmc() {
} }
testPython2() { testPython2() {
if [[ "$STACK" == "heroku-16" ]] || [[ "$STACK" == "cedar-14" ]]; then
compile "python2" compile "python2"
assertCaptured "python-2.7.15" assertCaptured "python-2.7.15"
assertCapturedSuccess assertCapturedSuccess
fi
}
testNoPython2() {
if [[ "$STACK" == "heroku-18" ]]; then
compile "python2"
assertCapturedError
fi
} }
testPython3() { testPython3() {
compile "python3" compile "python3"
assertCaptured "python-3.6.5" assertCaptured "python-3.6.6"
assertCapturedSuccess assertCapturedSuccess
} }
......
...@@ -14,3 +14,8 @@ if [[ "$STACK" == "heroku-16" ]]; then ...@@ -14,3 +14,8 @@ if [[ "$STACK" == "heroku-16" ]]; then
make test-heroku-16 make test-heroku-16
exit $? exit $?
fi fi
if [[ "$STACK" == "heroku-18" ]]; then
make test-heroku-18
exit $?
fi
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