mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e5930047 | |||
| f51dfb5eb4 | |||
| 06b7f97eff | |||
| 74873b5b71 | |||
| 731876d6e8 | |||
| a775b06d2f | |||
| 2d290e94e9 | |||
| 179e6287b1 | |||
| 18945ff1a9 | |||
| 2e630ab55c |
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# Python Buildpack Changelog
|
# Python Buildpack Changelog
|
||||||
|
|
||||||
|
# 137
|
||||||
|
|
||||||
|
Prevent 3.7.0 from appearing as unsupported in buildpack messaging.
|
||||||
|
|
||||||
# 136
|
# 136
|
||||||
|
|
||||||
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
|
Upgrade to 3.6.6 and support 3.7.0 on all runtimes.
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
+3
-2
@@ -50,7 +50,8 @@ export VENDOR_URL
|
|||||||
# 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.6"
|
DEFAULT_PYTHON_VERSION="python-3.6.6"
|
||||||
LATEST_3="python-3.6.6"
|
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"
|
|||||||
# 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
|
|||||||
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
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -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"
|
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"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#!/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."
|
||||||
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
python-2.7.13
|
python-3.6.6
|
||||||
|
|||||||
@@ -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,9 +81,18 @@ testPylibmc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
testPython2() {
|
testPython2() {
|
||||||
compile "python2"
|
if [[ "$STACK" == "heroku-16" ]] || [[ "$STACK" == "cedar-14" ]]; then
|
||||||
assertCaptured "python-2.7.15"
|
compile "python2"
|
||||||
assertCapturedSuccess
|
assertCaptured "python-2.7.15"
|
||||||
|
assertCapturedSuccess
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testNoPython2() {
|
||||||
|
if [[ "$STACK" == "heroku-18" ]]; then
|
||||||
|
compile "python2"
|
||||||
|
assertCapturedError
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
testPython3() {
|
testPython3() {
|
||||||
|
|||||||
Reference in New Issue
Block a user