diff --git a/common/install_cpython.sh b/common/install_cpython.sh index 67bffe36f..44ad3a4b7 100755 --- a/common/install_cpython.sh +++ b/common/install_cpython.sh @@ -2,10 +2,11 @@ set -uex -o pipefail PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python +PYTHON_DOWNLOAD_GITHUB_BRANCH=https://github.com/python/cpython/archive/refs/heads GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py # Python versions to be installed in /opt/$VERSION_NO -CPYTHON_VERSIONS=${CPYTHON_VERSIONS:-"3.7.5 3.8.1 3.9.0 3.10.1 3.11.0 3.12.0"} +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"} function check_var { if [ -z "$1" ]; then @@ -16,9 +17,11 @@ function check_var { function do_cpython_build { local py_ver=$1 + local py_folder=$2 check_var $py_ver + check_var $py_folder tar -xzf Python-$py_ver.tgz - pushd Python-$py_ver + pushd $py_folder local prefix="/opt/_internal/cpython-${py_ver}" mkdir -p ${prefix}/lib @@ -44,7 +47,7 @@ function do_cpython_build { fi popd - rm -rf Python-$py_ver + rm -rf $py_folder # Some python's install as bin/python3. Make them available as # bin/python. if [ -e ${prefix}/bin/python3 ]; then @@ -64,8 +67,16 @@ function build_cpython { check_var $py_ver check_var $PYTHON_DOWNLOAD_URL local py_ver_folder=$py_ver - wget -q $PYTHON_DOWNLOAD_URL/$py_ver_folder/Python-$py_ver.tgz - do_cpython_build $py_ver none + if [ "$py_ver" = "3.13.0" ]; then + PY_VER_SHORT="3.13" + check_var $PYTHON_DOWNLOAD_GITHUB_BRANCH + wget $PYTHON_DOWNLOAD_GITHUB_BRANCH/$PY_VER_SHORT.tar.gz -O Python-$py_ver.tgz + do_cpython_build $py_ver cpython-$PY_VER_SHORT + else + wget -q $PYTHON_DOWNLOAD_URL/$py_ver_folder/Python-$py_ver.tgz + do_cpython_build $py_ver Python-$py_ver + fi + rm -f Python-$py_ver.tgz }