Skip to content

Commit b304308

Browse files
committed
expand normalize_isa aliases and update KNOWN_ARCHITECTURES
1 parent 6ad6a96 commit b304308

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

src/python_discovery/_py_info.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,13 @@ def _possible_base(self) -> Generator[str, None, None]:
770770

771771
KNOWN_ARCHITECTURES: frozenset[str] = frozenset({
772772
"arm64",
773-
"i686",
774773
"loongarch64",
774+
"ppc",
775775
"ppc64",
776776
"ppc64le",
777777
"riscv64",
778778
"s390x",
779+
"sparc64",
779780
"x86",
780781
"x86_64",
781782
})
@@ -794,7 +795,18 @@ def normalize_isa(isa: str) -> str:
794795
Unrecognized values are lowercased and returned as-is.
795796
"""
796797
low = isa.lower()
797-
return {"amd64": "x86_64", "aarch64": "arm64", "i386": "x86", "i586": "x86"}.get(low, low)
798+
return {
799+
"amd64": "x86_64",
800+
"aarch64": "arm64",
801+
"i386": "x86",
802+
"i486": "x86",
803+
"i586": "x86",
804+
"i686": "x86",
805+
"powerpc": "ppc",
806+
"powerpc64": "ppc64",
807+
"powerpc64le": "ppc64le",
808+
"sparcv9": "sparc64",
809+
}.get(low, low)
798810

799811

800812
def _main() -> None: # pragma: no cover

tests/test_py_spec.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,19 @@ def test_spec_satisfies_machine(left: str, right: str, expected: bool) -> None:
217217
pytest.param("x86_64", "x86_64", id="x86_64"),
218218
pytest.param("arm64", "arm64", id="arm64"),
219219
pytest.param("x86", "x86", id="x86"),
220+
pytest.param("i386", "x86", id="i386"),
221+
pytest.param("i486", "x86", id="i486"),
222+
pytest.param("i586", "x86", id="i586"),
223+
pytest.param("i686", "x86", id="i686"),
220224
pytest.param("ppc64le", "ppc64le", id="ppc64le"),
225+
pytest.param("powerpc", "ppc", id="powerpc"),
226+
pytest.param("powerpc64", "ppc64", id="powerpc64"),
227+
pytest.param("powerpc64le", "ppc64le", id="powerpc64le"),
221228
pytest.param("riscv64", "riscv64", id="riscv64"),
222229
pytest.param("s390x", "s390x", id="s390x"),
230+
pytest.param("sparcv9", "sparc64", id="sparcv9"),
231+
pytest.param("sparc64", "sparc64", id="sparc64"),
232+
pytest.param("alpha", "alpha", id="alpha-passthrough"),
223233
],
224234
)
225235
def test_normalize_isa(isa: str, normalized: str) -> None:

0 commit comments

Comments
 (0)