From f189df54151839a90973f361d787976ef28427ad Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Mon, 23 Dec 2019 00:13:54 -0500 Subject: [PATCH] Warn about EOL on Python 2 install --- bin/steps/python | 10 +++++++++- test/run-versions | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/bin/steps/python b/bin/steps/python index 2625b44..9046552 100755 --- a/bin/steps/python +++ b/bin/steps/python @@ -9,6 +9,10 @@ VENDORED_PYTHON="${VENDOR_URL}/runtimes/$PYTHON_VERSION.tar.gz" SECURITY_UPDATE="Python has released a security update! Please consider upgrading to" +ONLY_SUPPORTED_2_VERSION="Only the latest version of Python 2 is supported on the platform. Please consider upgrading to" + +PYTHON_2_EOL_UPDATE="Python 2 has reached it's community EOL. Upgrade your Python runtime to maintain a secure application as soon as possible." + # check if runtime exists if curl --output /dev/null --silent --head --fail "$VENDORED_PYTHON"; then if [[ "$PYTHON_VERSION" == $PY38* ]]; then @@ -48,8 +52,12 @@ if curl --output /dev/null --silent --head --fail "$VENDORED_PYTHON"; then fi if [[ "$PYTHON_VERSION" == $PY27* ]]; then # security update note + if [[ $(date "+%Y") > "2019" ]]; then + puts-warn "$PYTHON_2_EOL_UPDATE" + echo " Learn More: https://devcenter.heroku.com/articles/python-2-7-eol-faq" + fi if [ "$PYTHON_VERSION" != "$LATEST_27" ]; then - puts-warn "$SECURITY_UPDATE" "$LATEST_27" + puts-warn "$ONLY_SUPPORTED_2_VERSION" "$LATEST_27" echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes" fi fi diff --git a/test/run-versions b/test/run-versions index 0698b7c..f9fbc66 100755 --- a/test/run-versions +++ b/test/run-versions @@ -18,6 +18,7 @@ testPython2() { echo $LATEST_27 > "runtime.txt" compile "python2" assertCaptured $LATEST_27 + assertCaptured "python-2-7-eol-faq" assertNotCaptured "security update" assertCaptured "Installing SQLite3" assertCapturedSuccess @@ -26,7 +27,8 @@ testPython2() { testPython2_warn() { compile "python2_warn" assertCaptured "python-2.7.15" - assertCaptured "security update!" + assertCaptured "python-2-7-eol-faq" + assertCaptured "Only the latest version" assertCaptured "Installing SQLite3" assertCapturedSuccess }