Skip to content

Commit 8d27401

Browse files
committed
Update python-build-standalone, now supporting Python 3.12.9 (default) and 3.13.2
We sue 3.12.9 by default since version 3.13.2 currently fails on `python -m ensurepip`.
1 parent eb6a806 commit 8d27401

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

meson.build

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,18 @@ if build_machine.system() == 'linux'
204204
mm = '@0@.@1@'.format(cpython_distrib_version_major, cpython_distrib_version_minor)
205205
bad_links = [
206206
# (<parent dir>, <symlink name>, <target name>)
207-
['bin', '2to3', '2to3-@0@'.format(mm)],
208207
['bin', 'idle3', 'idle@0@'.format(mm)],
209208
['bin', 'pydoc3', 'pydoc@0@'.format(mm)],
210209
['bin', 'python3', 'python@0@'.format(mm)],
211210
['bin', 'python3-config', 'python@0@-config'.format(mm)],
212211
['lib', 'libpython@0@.so'.format(mm), 'libpython@0@.so.1.0'.format(mm)],
213212
]
213+
# 2to3 was removed in Python 3.13
214+
if cpython_distrib_version_minor.to_int() < 13
215+
bad_links += [
216+
['bin', '2to3', '2to3-@0@'.format(mm)],
217+
]
218+
endif
214219
foreach x: bad_links
215220
parent_dir = x[0]
216221
symlink_name = x[1]

meson_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
option('cpython_distrib_version', type: 'string', value: '3.12.4', description: 'Version of CPython to ship')
1+
option('cpython_distrib_version', type: 'string', value: '3.12.9', description: 'Version of CPython to ship')
22
option('gdextension_path', type: 'string', value: '', description: 'Use GDExtension API at this location instead of generating it from Godot binary')
33
option('godot_version', type: 'string', value: '4.2.2', description: 'Version of Godot to generate GDExtension API from')
44
option('real_is_double', type: 'boolean', value: false, description: 'Built for Godot with 64bits floating point numbers (i.e. double) in builtins instead of 32bits (i.e. float)')

scripts/python_distrib.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import argparse
44
from pathlib import Path
5+
import re
56
from urllib.request import urlopen
67
import shutil
78
import tarfile
@@ -10,8 +11,20 @@
1011
import zstandard
1112

1213

13-
PREBUILDS_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download"
14+
PREBUILDS_BASE_URL = "https://github.com/astral-sh/python-build-standalone/releases/download"
1415
PLATFORM_TO_PREBUILDS = {
16+
"3.13.2": {
17+
"linux-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.13.2+20250205-x86_64_v3-unknown-linux-gnu-pgo+lto-full.tar.zst",
18+
"windows-x86": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.13.2+20250205-i686-pc-windows-msvc-shared-pgo-full.tar.zst",
19+
"windows-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.13.2+20250205-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst",
20+
"macos-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.13.2+20250205-x86_64-apple-darwin-pgo+lto-full.tar.zst",
21+
},
22+
"3.12.9": {
23+
"linux-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.12.9+20250205-x86_64_v3-unknown-linux-gnu-pgo+lto-full.tar.zst",
24+
"windows-x86": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.12.9+20250205-i686-pc-windows-msvc-shared-pgo-full.tar.zst",
25+
"windows-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.12.9+20250205-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst",
26+
"macos-x86_64": f"{PREBUILDS_BASE_URL}/20250205/cpython-3.12.9+20250205-x86_64-apple-darwin-pgo+lto-full.tar.zst",
27+
},
1528
"3.12.4": {
1629
"linux-x86_64": f"{PREBUILDS_BASE_URL}/20240713/cpython-3.12.4+20240713-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst",
1730
"windows-x86": f"{PREBUILDS_BASE_URL}/20240713/cpython-3.12.4+20240713-i686-pc-windows-msvc-shared-pgo-full.tar.zst",
@@ -105,15 +118,19 @@ def _tar_extract(reader):
105118

106119
def load_config(prebuild_dir: Path) -> dict:
107120
conf = json.loads((prebuild_dir / "python/PYTHON.json").read_text())
108-
assert conf["version"] == "7"
121+
assert conf["version"] in (
122+
"7",
123+
"8",
124+
), f"Unsupported PYTHON.json format version {conf['version']}"
109125
assert conf["libpython_link_mode"] == "shared"
110126
return conf
111127

112128

113129
def install_linux(conf: dict, build_dir: Path, prebuild_dir: Path, compressed_stdlib: bool) -> None:
114130
print(f"Create clean distribution {build_dir}...")
115131

116-
if conf["target_triple"] not in ("x86_64-unknown-linux-gnu", "x86-unknown-linux-gnu"):
132+
# See https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions
133+
if not re.match(r"^x86_64(|_v2|_v3|_v4)-unknown-linux-(gnu|musl)$", conf["target_triple"]):
117134
raise RuntimeError(f"Unexpected target_triple `{conf['target_triple']}`")
118135
major, minor = conf["python_major_minor_version"].split(".")
119136

0 commit comments

Comments
 (0)