From 4070f765a3f8e793e24b6de06e88cb54c77abb1c Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Mon, 23 Sep 2024 22:14:02 +0100 Subject: [PATCH] handle compressed tag sets --- test/qpy_compat/get_versions.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/qpy_compat/get_versions.py b/test/qpy_compat/get_versions.py index 46b5a9a269c5..ba86c266a011 100644 --- a/test/qpy_compat/get_versions.py +++ b/test/qpy_compat/get_versions.py @@ -22,11 +22,16 @@ import qiskit -def tag_from_wheel_name(wheel: str) -> packaging.tags.Tag: +def tags_from_wheel_name(wheel: str): """Extract the wheel tag from its filename.""" assert wheel.lower().endswith(".whl") - _prefix, interpreter, abi, platform = wheel[:-4].rsplit("-", 3) - return packaging.tags.Tag(interpreter, abi, platform) + _prefix, interpreters, abis, platforms = wheel[:-4].rsplit("-", 3) + yield from ( + packaging.tags.Tag(interpreter, abi, platform) + for interpreter in interpreters.split(".") + for abi in abis.split(".") + for platform in platforms.split(".") + ) def available_versions(): @@ -52,9 +57,10 @@ def available_versions_for_package(package, min_version=None, max_version=None): # Python version that's too new, which can be a problem for the oldest Terras, # especially from before we built for abi3. if not any( - tag_from_wheel_name(release["filename"]) in supported_tags + tag in supported_tags for release in payload if release["packagetype"] == "bdist_wheel" + for tag in tags_from_wheel_name(release["filename"]) ): print( f"skipping '{other_version}', which has no installable binary artifacts",