From 3c64697472eecf8977495a2016ae1ec74956a8e8 Mon Sep 17 00:00:00 2001
From: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
Date: Tue, 1 May 2018 09:27:32 -0500
Subject: [PATCH] Add Python 2.7.15 to the list of runtimes (#692)

* Add Python 2.7.15 to the list of runtimes

Closes #691

* Update the default Python 2 to 2.7.15 everywhere
---
 bin/compile                       |  2 +-
 builds/runtimes/python-2.7.15     | 19 +++++++++++++++++++
 test/fixtures/python2/runtime.txt |  2 +-
 test/run                          |  2 +-
 4 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100755 builds/runtimes/python-2.7.15

diff --git a/bin/compile b/bin/compile
index adfff6ef..f077a591 100755
--- a/bin/compile
+++ b/bin/compile
@@ -42,7 +42,7 @@ export VENDOR_URL
 # Python defaults
 DEFAULT_PYTHON_VERSION="python-3.6.4"
 LATEST_3="python-3.6.4"
-LATEST_2="python-2.7.14"
+LATEST_2="python-2.7.15"
 
 DEFAULT_PYTHON_STACK="cedar-14"
 PIP_UPDATE="9.0.2"
diff --git a/builds/runtimes/python-2.7.15 b/builds/runtimes/python-2.7.15
new file mode 100755
index 00000000..8177f5ea
--- /dev/null
+++ b/builds/runtimes/python-2.7.15
@@ -0,0 +1,19 @@
+#!/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/2.7.15/Python-2.7.15.tgz'
+curl -L $SOURCE_TARBALL | tar xz
+mv Python-2.7.15 src
+cd src
+
+./configure --prefix=$OUT_PREFIX  --enable-unicode=ucs4 --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 '{}' +
diff --git a/test/fixtures/python2/runtime.txt b/test/fixtures/python2/runtime.txt
index 2ce112e3..f27f1cc5 100644
--- a/test/fixtures/python2/runtime.txt
+++ b/test/fixtures/python2/runtime.txt
@@ -1 +1 @@
-python-2.7.14
\ No newline at end of file
+python-2.7.15
diff --git a/test/run b/test/run
index b08d261b..4b54fd6c 100755
--- a/test/run
+++ b/test/run
@@ -77,7 +77,7 @@ testPylibmc() {
 
 testPython2() {
   compile "python2"
-  assertCaptured "python-2.7.14"
+  assertCaptured "python-2.7.15"
   assertCapturedSuccess
 }
 
-- 
GitLab