From cadc33708a393567f568f13666c98a4399fbf85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Wed, 27 May 2026 14:10:28 -0700 Subject: [PATCH] Allow dots in machine/ISA specifier The regex for parsing machine names only accepted `[a-zA-Z0-9_]`, which rejected platforms like OpenIndiana where `platform.machine()` returns `i86pc.64bit`. Fixes #75 --- src/python_discovery/_py_spec.py | 2 +- tests/test_py_spec.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python_discovery/_py_spec.py b/src/python_discovery/_py_spec.py index 937d075..f0fb53e 100644 --- a/src/python_discovery/_py_spec.py +++ b/src/python_discovery/_py_spec.py @@ -17,7 +17,7 @@ (?P[0-9.]+)? # version (e.g. 3.12, 3.12.1) (?Pt)? # free-threaded flag (?:-(?P32|64))? # architecture bitness - (?:-(?P[a-zA-Z0-9_]+))? # ISA (e.g. arm64, x86_64) + (?:-(?P[a-zA-Z0-9_.]+))? # ISA (e.g. arm64, x86_64, i86pc.64bit) $ """, re.VERBOSE, diff --git a/tests/test_py_spec.py b/tests/test_py_spec.py index b89fd2a..a616622 100644 --- a/tests/test_py_spec.py +++ b/tests/test_py_spec.py @@ -180,6 +180,7 @@ def test_specifier_satisfies_with_partial_information() -> None: pytest.param("cpython3.12-64", None, id="no-machine"), pytest.param("cpython3.12", None, id="no-arch-no-machine"), pytest.param("python3.12-64-arm64", "arm64", id="python-impl"), + pytest.param("cpython3.14-64-i86pc.64bit", "i86pc.64bit", id="dotted-machine"), ], ) def test_spec_parse_machine(spec_str: str, expected_machine: str | None) -> None: