mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-24 13:43:45 +00:00
Allow download of Python distribution variants with newer CPU instruction sets (#9781)
Supersedes https://github.com/astral-sh/uv/pull/8517 with an alternative approach of making all the variants available instead of replacing the x86_64 (v1) variant with x86_64_v2. Doesn't add automatic inference of the supported instructions, but that should be doable per @charliermarsh's comment there. Going to do it as a follow-up since this has been pretty time consuming. e.g., ``` ❯ cargo run -q -- python install cpython-3.12.8-linux-x86_64_v3-gnu Installed Python 3.12.8 in 2.72s + cpython-3.12.8-linux-x86_64_v3-gnu ``` Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
This commit is contained in:
parent
fd420db197
commit
761dafd0d1
6 changed files with 23040 additions and 2044 deletions
|
@ -62,17 +62,23 @@ def prepare_variant(variant: str | None) -> str | None:
|
|||
raise ValueError(f"Unknown variant: {variant}")
|
||||
|
||||
|
||||
def prepare_arch(arch: str) -> str:
|
||||
match arch:
|
||||
def prepare_arch(arch: dict) -> tuple[str, str]:
|
||||
match arch["family"]:
|
||||
# Special constructors
|
||||
case "i686":
|
||||
return "X86_32(target_lexicon::X86_32Architecture::I686)"
|
||||
family = "X86_32(target_lexicon::X86_32Architecture::I686)"
|
||||
case "aarch64":
|
||||
return "Aarch64(target_lexicon::Aarch64Architecture::Aarch64)"
|
||||
family = "Aarch64(target_lexicon::Aarch64Architecture::Aarch64)"
|
||||
case "armv7":
|
||||
return "Arm(target_lexicon::ArmArchitecture::Armv7)"
|
||||
case _:
|
||||
return arch.capitalize()
|
||||
family = "Arm(target_lexicon::ArmArchitecture::Armv7)"
|
||||
case value:
|
||||
family = value.capitalize()
|
||||
variant = (
|
||||
f"Some(ArchVariant::{arch['variant'].capitalize()})"
|
||||
if arch["variant"]
|
||||
else "None"
|
||||
)
|
||||
return family, variant
|
||||
|
||||
|
||||
def prepare_prerelease(prerelease: str) -> str:
|
||||
|
@ -86,7 +92,7 @@ def prepare_prerelease(prerelease: str) -> str:
|
|||
|
||||
def prepare_value(value: dict) -> dict:
|
||||
value["os"] = value["os"].title()
|
||||
value["arch"] = prepare_arch(value["arch"])
|
||||
value["arch_family"], value["arch_variant"] = prepare_arch(value["arch"])
|
||||
value["name"] = prepare_name(value["name"])
|
||||
value["libc"] = prepare_libc(value["libc"])
|
||||
value["prerelease"] = prepare_prerelease(value["prerelease"])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue