mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
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
3 changed files with 2955 additions and 917 deletions
|
@ -59,10 +59,10 @@ HIDDEN_FLAVORS = [
|
|||
]
|
||||
SPECIAL_TRIPLES = {
|
||||
"macos": "x86_64-apple-darwin",
|
||||
"linux64": "x86_64-unknown-linux",
|
||||
"linux64": "x86_64-unknown-linux-gnu",
|
||||
"windows-amd64": "x86_64-pc-windows",
|
||||
"windows-x86": "i686-pc-windows",
|
||||
"linux64-musl": "x86_64-unknown-linux",
|
||||
"linux64-musl": "x86_64-unknown-linux-musl",
|
||||
}
|
||||
|
||||
_filename_re = re.compile(
|
||||
|
@ -107,7 +107,7 @@ def parse_filename(filename):
|
|||
|
||||
|
||||
def normalize_triple(triple):
|
||||
if "-musl" in triple or "-static" in triple:
|
||||
if "-static" in triple:
|
||||
logging.debug("Skipping %r: unknown triple", triple)
|
||||
return
|
||||
triple = SPECIAL_TRIPLES.get(triple, triple)
|
||||
|
@ -117,10 +117,15 @@ def normalize_triple(triple):
|
|||
# Normalize
|
||||
arch = ARCH_MAP.get(arch, arch)
|
||||
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:
|
||||
logging.debug("Skipping %r: unknown triple", triple)
|
||||
return
|
||||
return "%s-%s" % (arch, platform)
|
||||
return "%s-%s-%s" % (arch, platform, libc)
|
||||
|
||||
|
||||
def read_sha256(session, url):
|
||||
|
@ -217,8 +222,8 @@ def find(args):
|
|||
key=lambda x: x[:2],
|
||||
reverse=True,
|
||||
):
|
||||
for (arch, platform), url in sorted(choices.items()):
|
||||
key = "%s-%s.%s.%s-%s-%s" % (interpreter, *py_ver, platform, arch)
|
||||
for (arch, platform, libc), url in sorted(choices.items()):
|
||||
key = "%s-%s.%s.%s-%s-%s-%s" % (interpreter, *py_ver, platform, arch, libc)
|
||||
logging.info("Found %s", key)
|
||||
sha256 = read_sha256(session, url)
|
||||
|
||||
|
@ -226,6 +231,7 @@ def find(args):
|
|||
"name": interpreter,
|
||||
"arch": arch,
|
||||
"os": platform,
|
||||
"libc": libc,
|
||||
"major": py_ver[0],
|
||||
"minor": py_ver[1],
|
||||
"patch": py_ver[2],
|
||||
|
|
|
@ -34,6 +34,7 @@ import os
|
|||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
import sysconfig
|
||||
import tarfile
|
||||
import tempfile
|
||||
import urllib.parse
|
||||
|
@ -102,7 +103,11 @@ if INSTALL_DIR.exists():
|
|||
|
||||
# Install each version
|
||||
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}"
|
||||
print(f"Installing {key}")
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue