2
2
set -uex -o pipefail
3
3
4
4
PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python
5
+ PYTHON_DOWNLOAD_GITHUB_BRANCH=https://github.com/python/cpython/archive/refs/heads
5
6
GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
6
7
7
8
# Python versions to be installed in /opt/$VERSION_NO
8
- CPYTHON_VERSIONS=${CPYTHON_VERSIONS:- " 3.7.5 3.8.1 3.9.0 3.10.1 3.11.0 3.12.0" }
9
+ CPYTHON_VERSIONS=${CPYTHON_VERSIONS:- " 3.7.5 3.8.1 3.9.0 3.10.1 3.11.0 3.12.0 3.13.0 " }
9
10
10
11
function check_var {
11
12
if [ -z " $1 " ]; then
@@ -16,9 +17,11 @@ function check_var {
16
17
17
18
function do_cpython_build {
18
19
local py_ver=$1
20
+ local py_folder=$2
19
21
check_var $py_ver
22
+ check_var $py_folder
20
23
tar -xzf Python-$py_ver .tgz
21
- pushd Python- $py_ver
24
+ pushd $py_folder
22
25
23
26
local prefix=" /opt/_internal/cpython-${py_ver} "
24
27
mkdir -p ${prefix} /lib
@@ -44,7 +47,7 @@ function do_cpython_build {
44
47
fi
45
48
46
49
popd
47
- rm -rf Python- $py_ver
50
+ rm -rf $py_folder
48
51
# Some python's install as bin/python3. Make them available as
49
52
# bin/python.
50
53
if [ -e ${prefix} /bin/python3 ]; then
@@ -64,8 +67,16 @@ function build_cpython {
64
67
check_var $py_ver
65
68
check_var $PYTHON_DOWNLOAD_URL
66
69
local py_ver_folder=$py_ver
67
- wget -q $PYTHON_DOWNLOAD_URL /$py_ver_folder /Python-$py_ver .tgz
68
- do_cpython_build $py_ver none
70
+ if [ " $py_ver " = " 3.13.0" ]; then
71
+ PY_VER_SHORT=" 3.13"
72
+ check_var $PYTHON_DOWNLOAD_GITHUB_BRANCH
73
+ wget $PYTHON_DOWNLOAD_GITHUB_BRANCH /$PY_VER_SHORT .tar.gz -O Python-$py_ver .tgz
74
+ do_cpython_build $py_ver cpython-$PY_VER_SHORT
75
+ else
76
+ wget -q $PYTHON_DOWNLOAD_URL /$py_ver_folder /Python-$py_ver .tgz
77
+ do_cpython_build $py_ver Python-$py_ver
78
+ fi
79
+
69
80
rm -f Python-$py_ver .tgz
70
81
}
71
82
0 commit comments