mirror of https://github.com/astral-sh/uv
Add musl to python bootstrapping script (#1758)
Previously, only glibc builds were tracked in the bootstrap script. A new field `libc` tracks if `gnu` or `musl` are used on linux, while it is `"none"` everywhere else. I've confirmed that the updated script works on ubuntu and alpine.
This commit is contained in:
parent
af06a6fe0a
commit
e97b094bc9
|
|
@ -59,10 +59,10 @@ HIDDEN_FLAVORS = [
|
||||||
]
|
]
|
||||||
SPECIAL_TRIPLES = {
|
SPECIAL_TRIPLES = {
|
||||||
"macos": "x86_64-apple-darwin",
|
"macos": "x86_64-apple-darwin",
|
||||||
"linux64": "x86_64-unknown-linux",
|
"linux64": "x86_64-unknown-linux-gnu",
|
||||||
"windows-amd64": "x86_64-pc-windows",
|
"windows-amd64": "x86_64-pc-windows",
|
||||||
"windows-x86": "i686-pc-windows",
|
"windows-x86": "i686-pc-windows",
|
||||||
"linux64-musl": "x86_64-unknown-linux",
|
"linux64-musl": "x86_64-unknown-linux-musl",
|
||||||
}
|
}
|
||||||
|
|
||||||
_filename_re = re.compile(
|
_filename_re = re.compile(
|
||||||
|
|
@ -107,7 +107,7 @@ def parse_filename(filename):
|
||||||
|
|
||||||
|
|
||||||
def normalize_triple(triple):
|
def normalize_triple(triple):
|
||||||
if "-musl" in triple or "-static" in triple:
|
if "-static" in triple:
|
||||||
logging.debug("Skipping %r: unknown triple", triple)
|
logging.debug("Skipping %r: unknown triple", triple)
|
||||||
return
|
return
|
||||||
triple = SPECIAL_TRIPLES.get(triple, triple)
|
triple = SPECIAL_TRIPLES.get(triple, triple)
|
||||||
|
|
@ -117,10 +117,15 @@ def normalize_triple(triple):
|
||||||
# Normalize
|
# Normalize
|
||||||
arch = ARCH_MAP.get(arch, arch)
|
arch = ARCH_MAP.get(arch, arch)
|
||||||
platform = pieces[2]
|
platform = pieces[2]
|
||||||
|
if pieces[2] == "linux":
|
||||||
|
# On linux, the triple has four segments, the last one is the libc
|
||||||
|
libc = pieces[3]
|
||||||
|
else:
|
||||||
|
libc = "none"
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logging.debug("Skipping %r: unknown triple", triple)
|
logging.debug("Skipping %r: unknown triple", triple)
|
||||||
return
|
return
|
||||||
return "%s-%s" % (arch, platform)
|
return "%s-%s-%s" % (arch, platform, libc)
|
||||||
|
|
||||||
|
|
||||||
def read_sha256(session, url):
|
def read_sha256(session, url):
|
||||||
|
|
@ -217,8 +222,8 @@ def find(args):
|
||||||
key=lambda x: x[:2],
|
key=lambda x: x[:2],
|
||||||
reverse=True,
|
reverse=True,
|
||||||
):
|
):
|
||||||
for (arch, platform), url in sorted(choices.items()):
|
for (arch, platform, libc), url in sorted(choices.items()):
|
||||||
key = "%s-%s.%s.%s-%s-%s" % (interpreter, *py_ver, platform, arch)
|
key = "%s-%s.%s.%s-%s-%s-%s" % (interpreter, *py_ver, platform, arch, libc)
|
||||||
logging.info("Found %s", key)
|
logging.info("Found %s", key)
|
||||||
sha256 = read_sha256(session, url)
|
sha256 = read_sha256(session, url)
|
||||||
|
|
||||||
|
|
@ -226,6 +231,7 @@ def find(args):
|
||||||
"name": interpreter,
|
"name": interpreter,
|
||||||
"arch": arch,
|
"arch": arch,
|
||||||
"os": platform,
|
"os": platform,
|
||||||
|
"libc": libc,
|
||||||
"major": py_ver[0],
|
"major": py_ver[0],
|
||||||
"minor": py_ver[1],
|
"minor": py_ver[1],
|
||||||
"patch": py_ver[2],
|
"patch": py_ver[2],
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ import os
|
||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import sysconfig
|
||||||
import tarfile
|
import tarfile
|
||||||
import tempfile
|
import tempfile
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
@ -102,7 +103,11 @@ if INSTALL_DIR.exists():
|
||||||
|
|
||||||
# Install each version
|
# Install each version
|
||||||
for version in versions:
|
for version in versions:
|
||||||
key = f"{INTERPRETER}-{version}-{PLATFORM_MAP.get(PLATFORM, PLATFORM)}-{ARCH_MAP.get(ARCH, ARCH)}"
|
if platform.system() == "Linux":
|
||||||
|
libc = sysconfig.get_config_var("SOABI").split("-")[-1]
|
||||||
|
else:
|
||||||
|
libc = "none"
|
||||||
|
key = f"{INTERPRETER}-{version}-{PLATFORM_MAP.get(PLATFORM, PLATFORM)}-{ARCH_MAP.get(ARCH, ARCH)}-{libc}"
|
||||||
install_dir = INSTALL_DIR / f"{INTERPRETER}@{version}"
|
install_dir = INSTALL_DIR / f"{INTERPRETER}@{version}"
|
||||||
print(f"Installing {key}")
|
print(f"Installing {key}")
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue