|
2 | 2 |
|
3 | 3 | import argparse |
4 | 4 | from pathlib import Path |
| 5 | +import re |
5 | 6 | from urllib.request import urlopen |
6 | 7 | import shutil |
7 | 8 | import tarfile |
|
10 | 11 | import zstandard |
11 | 12 |
|
12 | 13 |
|
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" |
14 | 15 | 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 | + }, |
15 | 28 | "3.12.4": { |
16 | 29 | "linux-x86_64": f"{PREBUILDS_BASE_URL}/20240713/cpython-3.12.4+20240713-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst", |
17 | 30 | "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): |
105 | 118 |
|
106 | 119 | def load_config(prebuild_dir: Path) -> dict: |
107 | 120 | 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']}" |
109 | 125 | assert conf["libpython_link_mode"] == "shared" |
110 | 126 | return conf |
111 | 127 |
|
112 | 128 |
|
113 | 129 | def install_linux(conf: dict, build_dir: Path, prebuild_dir: Path, compressed_stdlib: bool) -> None: |
114 | 130 | print(f"Create clean distribution {build_dir}...") |
115 | 131 |
|
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"]): |
117 | 134 | raise RuntimeError(f"Unexpected target_triple `{conf['target_triple']}`") |
118 | 135 | major, minor = conf["python_major_minor_version"].split(".") |
119 | 136 |
|
|
0 commit comments