mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Fix mirror script to handle newer metadata format. (#10050)
## Summary The architecture details in `crates/uv-python/download-metadata.json` is now a dictionary with family and variant data, whereas it used to be a string. This patches the architecture filter in `scripts/create-python-mirror.py` to support both scenarios. ## Test Plan Tested manually using `uv run ./scripts/create-python-mirror.py --name cpython --arch x86_64 --os linux --from-all-history`
This commit is contained in:
parent
ae659c8bfe
commit
6af14bddca
1 changed files with 10 additions and 1 deletions
|
@ -89,6 +89,15 @@ def collect_metadata_from_git_history() -> List[Dict]:
|
|||
return metadata
|
||||
|
||||
|
||||
def check_arch(entry, arch):
|
||||
"""Checks whether arch entry in metadata matches the provided filter."""
|
||||
if isinstance(entry, str):
|
||||
return entry == arch
|
||||
elif isinstance(entry, dict) and "family" in entry:
|
||||
return entry["family"] == arch
|
||||
return False
|
||||
|
||||
|
||||
def filter_metadata(
|
||||
metadata: List[Dict], name: Optional[str], arch: Optional[str], os: Optional[str]
|
||||
) -> List[Dict]:
|
||||
|
@ -97,7 +106,7 @@ def filter_metadata(
|
|||
entry
|
||||
for entry in metadata
|
||||
if (not name or entry["name"] == name)
|
||||
and (not arch or entry["arch"] == arch)
|
||||
and (not arch or check_arch(entry["arch"], arch))
|
||||
and (not os or entry["os"] == os)
|
||||
]
|
||||
# Use a set to ensure unique URLs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue