Organize downloads by prioritizing the platform, then the architecture. (#7900)

## Summary

PythonDownloadKey (cpython-3.13.0rc3-darwin-aarch64-none) and
PlatformTriple in `fetch-download-metadata.py` have a slight
inconsistency in the ordering of `os` and `arch`. In PythonDownloadKey,
`os` precedes `arch`, while in PlatformTriple, `arch` comes before
`platform` (equivalent to os). This difference in ordering affects the
sorting logic, giving arch higher priority than platform in the
`download-metadata.json` file, leading to a little bit of unexpected
order of entries.

Before:
<img width="676" alt="image"
src="https://github.com/user-attachments/assets/adb24a2e-da70-4a09-a702-4b5d71600b2c">
After:
<img width="725" alt="image"
src="https://github.com/user-attachments/assets/c6c76e6a-d3fd-43dc-bfb0-b3a4a3fe2b6b">
This commit is contained in:
Jo 2024-10-03 23:51:21 +08:00 committed by GitHub
parent 8962bcb028
commit 172bff4aec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3940 additions and 3940 deletions

File diff suppressed because it is too large Load Diff

View File

@ -73,8 +73,8 @@ def batched(iterable: Iterable, n: int) -> Generator[tuple, None, None]:
class PlatformTriple(NamedTuple):
arch: str
platform: str
arch: str
libc: str
@ -335,7 +335,7 @@ class CPythonFinder(Finder):
logging.debug("Skipping %r: unknown triple", triple)
return None
return PlatformTriple(arch, operating_system, libc)
return PlatformTriple(operating_system, arch, libc)
def _normalize_arch(self, arch: str) -> str:
arch = self.ARCH_MAP.get(arch, arch)
@ -410,8 +410,8 @@ class PyPyFinder(Finder):
download = PythonDownload(
version=python_version,
triple=PlatformTriple(
arch=arch,
platform=platform,
arch=arch,
libc=libc,
),
flavor="",

File diff suppressed because it is too large Load Diff