Skip to content

Commit 9c2bbd1

Browse files
authored
Merge pull request #741 from heroku/fix-python-check
Fix Python 3.6 message when using Python 3.7
2 parents 567cf2c + e5d9ed2 commit 9c2bbd1

File tree

2 files changed

+31
-8
lines changed

2 files changed

+31
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Python Buildpack Changelog
22

3+
# 139
4+
5+
Improvements to Python install messaging
6+
37
# 138 (2018-08-01)
48

59
Use stack image SQLite3 instead of vendoring

bin/steps/python

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,34 @@ if [[ $PYTHON_VERSION =~ ^python-2 ]]; then
1212
puts-warn "The latest version of Python 2 is $LATEST_2 (you are using $PYTHON_VERSION, which is unsupported)."
1313
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_2)."
1414
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
15+
else
16+
echo " Using supported version of Python 2 ($PYTHON_VERSION)"
1517
fi
1618
else
17-
if [[ $PYTHON_VERSION =~ ^python-3.7 ]] && [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then
18-
puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)."
19-
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)."
20-
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
21-
else
22-
if [[ "$PYTHON_VERSION" != "$LATEST_36" ]]; then
23-
puts-warn "The latest version of Python 3.6 is $LATEST_36 (you are using $PYTHON_VERSION, which is unsupported)."
24-
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_36)."
19+
if [[ $PYTHON_VERSION =~ ^python-3 ]]; then
20+
if [[ $PYTHON_VERSION =~ ^python-3.7 ]]; then
21+
if [[ "$PYTHON_VERSION" != "$LATEST_37" ]]; then
22+
puts-warn "The latest version of Python 3.7 is $LATEST_37 (you are using $PYTHON_VERSION, which is unsupported)."
23+
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_37)."
2524
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
25+
else
26+
echo " Using supported version of Python 3.7 ($PYTHON_VERSION)"
27+
fi
28+
else
29+
if [[ $PYTHON_VERSION =~ ^python-3.6 ]]; then
30+
if [[ "$PYTHON_VERSION" != "$LATEST_36" ]]; then
31+
puts-warn "The latest version of Python 3.6 is $LATEST_36 (you are using $PYTHON_VERSION, which is unsupported)."
32+
puts-warn "We recommend upgrading by specifying the latest version ($LATEST_36)."
33+
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
34+
else
35+
echo " Using supported version of Python 3.6 ($PYTHON_VERSION)"
36+
fi
37+
else
38+
puts-warn "Heroku supports runtime versions $LATEST_37, $LATEST_36 and $LATEST_2."
39+
puts-warn "You are using $PYTHON_VERSION, which is unsupported."
40+
puts-warn "We recommend upgrading by specifying the default supported version ($LATEST_36)."
41+
echo " Learn More: https://devcenter.heroku.com/articles/python-runtimes"
42+
fi
2643
fi
2744
fi
2845
fi
@@ -49,6 +66,7 @@ if [ -f .heroku/python-version ]; then
4966
fi
5067
fi
5168

69+
5270
if [ ! "$SKIP_INSTALL" ]; then
5371
puts-step "Installing $PYTHON_VERSION"
5472

@@ -71,6 +89,7 @@ if [ ! "$SKIP_INSTALL" ]; then
7189
hash -r
7290
fi
7391

92+
7493
# If Pip isn't up to date:
7594
if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_UPDATE* ]]; then
7695

0 commit comments

Comments
 (0)