mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-31 15:57:26 +00:00
Add support for dynamic musl Python distributions on x86-64 Linux (#12121)
Following the upstream release and #12120, removes gating preventing installation of the managed musl Python versions. Of note - The filtering of musl Python distributions has moved from the Rust runtime to the metadata fetcher - The filtering is now conditional on the PBS release date, removing all old static musl distributions - We could support the `+static` musl downloads in the future; right now, they are deprioritized when selecting a variant - I added test to CI which uses Alpine and installs numpy
This commit is contained in:
parent
f3fb1c5a17
commit
553bcccb6a
7 changed files with 52 additions and 10642 deletions
File diff suppressed because it is too large
Load diff
|
@ -61,6 +61,10 @@ import httpx
|
|||
SELF_DIR = Path(__file__).parent
|
||||
VERSIONS_FILE = SELF_DIR / "download-metadata.json"
|
||||
|
||||
# The date at which the default CPython musl builds became dynamically linked
|
||||
# instead of statically.
|
||||
CPYTHON_MUSL_STATIC_RELEASE_END = 20250311
|
||||
|
||||
|
||||
def batched(iterable: Iterable, n: int) -> Generator[tuple, None, None]:
|
||||
"""Batch data into tuples of length n. The last batch may be shorter."""
|
||||
|
@ -142,6 +146,7 @@ class Variant(StrEnum):
|
|||
|
||||
@dataclass
|
||||
class PythonDownload:
|
||||
release: int
|
||||
version: Version
|
||||
triple: PlatformTriple
|
||||
flavor: str
|
||||
|
@ -253,6 +258,11 @@ class CPythonFinder(Finder):
|
|||
download = self._parse_download_url(url)
|
||||
if download is None:
|
||||
continue
|
||||
if (
|
||||
download.release < CPYTHON_MUSL_STATIC_RELEASE_END
|
||||
and download.triple.libc == "musl"
|
||||
):
|
||||
continue
|
||||
logging.debug("Found %s (%s)", download.key(), download.filename)
|
||||
downloads_by_version.setdefault(download.version, []).append(
|
||||
download
|
||||
|
@ -341,6 +351,7 @@ class CPythonFinder(Finder):
|
|||
if url.endswith(".sha256"):
|
||||
return None
|
||||
filename = unquote(url.rsplit("/", maxsplit=1)[-1])
|
||||
release = int(url.rsplit("/")[-2])
|
||||
|
||||
match = self._filename_re.match(filename) or self._legacy_filename_re.match(
|
||||
filename
|
||||
|
@ -370,6 +381,7 @@ class CPythonFinder(Finder):
|
|||
return None
|
||||
|
||||
return PythonDownload(
|
||||
release=release,
|
||||
version=version,
|
||||
triple=triple,
|
||||
flavor=flavor,
|
||||
|
@ -490,6 +502,7 @@ class PyPyFinder(Finder):
|
|||
platform = self._normalize_os(file["platform"])
|
||||
libc = "gnu" if platform == "linux" else "none"
|
||||
download = PythonDownload(
|
||||
release=0,
|
||||
version=python_version,
|
||||
triple=PlatformTriple(
|
||||
platform=platform,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -466,11 +466,7 @@ impl ManagedPythonDownload {
|
|||
|
||||
/// Iterate over all [`ManagedPythonDownload`]s.
|
||||
pub fn iter_all() -> impl Iterator<Item = &'static ManagedPythonDownload> {
|
||||
PYTHON_DOWNLOADS
|
||||
.iter()
|
||||
// TODO(konsti): musl python-build-standalone builds are currently broken (statically
|
||||
// linked), so we pretend they don't exist. https://github.com/astral-sh/uv/issues/4242
|
||||
.filter(|download| download.key.libc != Libc::Some(target_lexicon::Environment::Musl))
|
||||
PYTHON_DOWNLOADS.iter()
|
||||
}
|
||||
|
||||
pub fn url(&self) -> &'static str {
|
||||
|
|
|
@ -126,6 +126,10 @@ impl Arch {
|
|||
pub fn family(&self) -> target_lexicon::Architecture {
|
||||
self.family
|
||||
}
|
||||
|
||||
pub fn is_arm(&self) -> bool {
|
||||
matches!(self.family, target_lexicon::Architecture::Arm(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Libc {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue