Skip to content

Commit 6af14bd

Browse files
authored
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`
1 parent ae659c8 commit 6af14bd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/create-python-mirror.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ def collect_metadata_from_git_history() -> List[Dict]:
8989
return metadata
9090

9191

92+
def check_arch(entry, arch):
93+
"""Checks whether arch entry in metadata matches the provided filter."""
94+
if isinstance(entry, str):
95+
return entry == arch
96+
elif isinstance(entry, dict) and "family" in entry:
97+
return entry["family"] == arch
98+
return False
99+
100+
92101
def filter_metadata(
93102
metadata: List[Dict], name: Optional[str], arch: Optional[str], os: Optional[str]
94103
) -> List[Dict]:
@@ -97,7 +106,7 @@ def filter_metadata(
97106
entry
98107
for entry in metadata
99108
if (not name or entry["name"] == name)
100-
and (not arch or entry["arch"] == arch)
109+
and (not arch or check_arch(entry["arch"], arch))
101110
and (not os or entry["os"] == os)
102111
]
103112
# Use a set to ensure unique URLs

0 commit comments

Comments
 (0)