Skip to content

Commit

Permalink
[Manywheel] Add Python-3.13 compilation from branch (#1827)
Browse files Browse the repository at this point in the history
* [Manywheel] Add Python-3.13 compilation from branch

* fix

* fix

* test

* fix_cpython_build

* Add 3.7.5 back
  • Loading branch information
atalman committed May 22, 2024
1 parent 1d0b405 commit 000114f
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions common/install_cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 000114f

Please sign in to comment.