From 6010d1f3edaa684faef5732be2ad0bb55093d48b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 26 Sep 2017 09:34:58 -0400 Subject: [PATCH] warn when using an older version of python Signed-off-by: Kenneth Reitz --- bin/compile | 5 ++++- bin/steps/python | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/compile b/bin/compile index c288521..4b7682d 100755 --- a/bin/compile +++ b/bin/compile @@ -35,10 +35,13 @@ export BUILD_DIR CACHE_DIR ENV_DIR # Python defaults DEFAULT_PYTHON_VERSION="python-3.6.2" +LATEST_3="python-3.6.2" +LATEST_2="python-2.7.14" + DEFAULT_PYTHON_STACK="cedar-14" PIP_UPDATE="9.0.1" -export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE +export DEFAULT_PYTHON_VERSION DEFAULT_PYTHON_STACK PIP_UPDATE LATEST_2 LATEST_3 # Common Problem Warnings WARNINGS_LOG=$(mktemp) diff --git a/bin/steps/python b/bin/steps/python index 908d1b2..c2fd625 100755 --- a/bin/steps/python +++ b/bin/steps/python @@ -4,6 +4,19 @@ set +e runtime-fixer runtime.txt PYTHON_VERSION=$(cat runtime.txt) +if [[ $PYTHON_VERSION == "python-2*" ]]; then + if [[ "$PYTHON_VERSION" != "$LATEST_2" ]]; then + puts-warn "The latest version of Python 2 is $LATEST_2. We recommend upgrading by specifying this version in a runtime.txt file." + puts " Learn More: https://devcenter.heroku.com/articles/python-runtimes" + fi +else + if [[ "$PYTHON_VERSION" != "$LATEST_3" ]]; then + puts-warn "The latest version of Python 3 is $LATEST_2. We recommend upgrading by specifying this version in a runtime.txt file." + puts " Learn More: https://devcenter.heroku.com/articles/python-runtimes" + fi + +fi + if [[ "$STACK" != "$CACHED_PYTHON_STACK" ]]; then 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