Skip to content

Commit 783c2e2

Browse files
committed
ensure and add comments to base python formulas
1 parent 06694bb commit 783c2e2

File tree

2 files changed

+39
-5
lines changed

2 files changed

+39
-5
lines changed

builds/runtimes/python2

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# Build Path: /app/.heroku/python/
3+
4+
OUT_PREFIX=$1
5+
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
6+
export BIN_DIR
7+
8+
# Orient ourselves and build download link
9+
dep_formula=${0#$WORKSPACE_DIR/} # this is the original script, e.g. pypy-5.3.1
10+
BASE=${dep_formula##*/} # this gives us relative path
11+
python_version=${BASE^} # this gives us only the filename with version number
12+
version_number=$(echo "$python_version" | cut -d- -f2) # this returns just X.X.X
13+
dep_url=https://python.org/ftp/python/${version_number}/${python_version}.tgz
14+
15+
# shellcheck source=bin/utils
16+
source "$BIN_DIR/steps/sqlite3"
17+
18+
sqlite3_version
19+
echo "Setting up SQLite3 Headers for $SQLITE3_VERSION"
20+
sqlite3_install "$OUT_PREFIX" "$SQLITE3_VERSION" 1
21+
22+
echo "Building Python 3..."
23+
echo "Pulling from source: ${dep_url}"
24+
25+
curl -L "${dep_url}" | tar xz -C "${OUT_PREFIX}"
26+
mv "${OUT_PREFIX}/${python_version}" src
27+
cd src
28+
29+
./configure --prefix=$OUT_PREFIX --enable-unicode=ucs4 --with-ensurepip=no
30+
make
31+
make install
32+
33+
# Remove unneeded test directories, similar to the official Docker Python images:
34+
# https://github.com/docker-library/python
35+
find "${OUT_PREFIX}" \( -type d -a \( -name test -o -name tests \) \) -exec rm -rf '{}' +

builds/runtimes/python3

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ OUT_PREFIX=$1
99
BIN_DIR="$(cd "$(dirname "$0")"/../.. || exit; pwd)/bin"
1010
export BIN_DIR
1111

12+
# Orient ourselves and build download link
1213
dep_formula=${0#$WORKSPACE_DIR/} # this is the original script, e.g. pypy-5.3.1
13-
dep_name=$(basename $BASH_SOURCE) # this is us
14-
15-
BASE=${dep_formula##*/}
16-
python_version=${BASE^}
17-
version_number=$(echo "$python_version" | cut -d- -f2)
14+
BASE=${dep_formula##*/} # this gives us relative path
15+
python_version=${BASE^} # this gives us only the filename with version number
16+
version_number=$(echo "$python_version" | cut -d- -f2) # this returns just X.X.X
1817
dep_url=https://python.org/ftp/python/${version_number}/${python_version}.tgz
1918

2019
# shellcheck source=bin/utils

0 commit comments

Comments
 (0)