|
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 | + }, |
15 | 22 | "3.12.4": {
|
16 | 23 | "linux-x86_64": f"{PREBUILDS_BASE_URL}/20240713/cpython-3.12.4+20240713-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst",
|
17 | 24 | "windows-x86": f"{PREBUILDS_BASE_URL}/20240713/cpython-3.12.4+20240713-i686-pc-windows-msvc-shared-pgo-full.tar.zst",
|
@@ -105,15 +112,19 @@ def _tar_extract(reader):
|
105 | 112 |
|
106 | 113 | def load_config(prebuild_dir: Path) -> dict:
|
107 | 114 | conf = json.loads((prebuild_dir / "python/PYTHON.json").read_text())
|
108 |
| - assert conf["version"] == "7" |
| 115 | + assert conf["version"] in ( |
| 116 | + "7", |
| 117 | + "8", |
| 118 | + ), f"Unsupported PYTHON.json format version {conf['version']}" |
109 | 119 | assert conf["libpython_link_mode"] == "shared"
|
110 | 120 | return conf
|
111 | 121 |
|
112 | 122 |
|
113 | 123 | def install_linux(conf: dict, build_dir: Path, prebuild_dir: Path, compressed_stdlib: bool) -> None:
|
114 | 124 | print(f"Create clean distribution {build_dir}...")
|
115 | 125 |
|
116 |
| - if conf["target_triple"] not in ("x86_64-unknown-linux-gnu", "x86-unknown-linux-gnu"): |
| 126 | + # See https://gregoryszorc.com/docs/python-build-standalone/main/running.html#obtaining-distributions |
| 127 | + if not re.match(r"^x86_64(|_v2|_v3|_v4)-unknown-linux-(gnu|musl)$", conf["target_triple"]): |
117 | 128 | raise RuntimeError(f"Unexpected target_triple `{conf['target_triple']}`")
|
118 | 129 | major, minor = conf["python_major_minor_version"].split(".")
|
119 | 130 |
|
|
0 commit comments