From f327a00d46a6659d4fa71c36f557d59abbdca1a8 Mon Sep 17 00:00:00 2001 From: Brandon White Date: Thu, 1 Oct 2026 09:21:06 -0500 Subject: [PATCH] fix: include legacy manylinux aliases in --platform tags create_supported_manylinux_platforms normalized the --platform value through LEGACY_MANYLINUX_ALIASES, then emitted only PEP 600 spellings (manylinux_2_N_ARCH). Poetry's chooser matches wheel tags against env.supported_tags by exact string, so a wheel tagged only with a legacy alias never matched: duckdb-extension-httpfs 1.5.5, whose aarch64 wheel is tagged only manylinux2014_aarch64, could not be bundled for --platform manylinux_2_34_aarch64, nor even for --platform manylinux2014_aarch64. Emit each PEP 600 legacy alias (manylinux2014, manylinux2010, manylinux1) right after the tag for the same glibc version, so a wheel built for a newer glibc still ranks first, and at the same glibc version the alias ranks just below the PEP 600 spelling. ai-generated: true Co-Authored-By: Claude Opus 5.5 --- src/poetry_plugin_bundle/utils/platforms.py | 20 ++++++++--- tests/utils/test_platforms.py | 37 +++++++++++++++++++++ 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/poetry_plugin_bundle/utils/platforms.py b/src/poetry_plugin_bundle/utils/platforms.py index 0ee69ae..51d153c 100644 --- a/src/poetry_plugin_bundle/utils/platforms.py +++ b/src/poetry_plugin_bundle/utils/platforms.py @@ -97,16 +97,24 @@ def create_supported_manylinux_platforms(platform: str) -> list[str]: For now, only GLIBCMAJOR "2" is supported. It is unclear if there will be a need to support a future major version like "3" and if specified, how generate the compatible 2.x version tags. + + The legacy aliases (manylinux1, manylinux2010, manylinux2014) are included as well, since wheels may be + tagged with only the alias. See https://peps.python.org/pep-0600/#legacy-manylinux-tags """ # Implementation based on https://peps.python.org/pep-0600/#package-installers tag = normalize_legacy_manylinux_alias(platform) parsed = PlatformTagParseResult.parse(tag) - return [ - f"{parsed.platform}_{parsed.version_major}_{tag_minor}_{parsed.arch}" - for tag_minor in range(parsed.version_minor, -1, -1) - ] + platforms: list[str] = [] + for tag_minor in range(parsed.version_minor, -1, -1): + glibc_tag = f"{parsed.platform}_{parsed.version_major}_{tag_minor}" + platforms.append(f"{glibc_tag}_{parsed.arch}") + # A legacy alias ranks just below the tag for the same glibc version. + legacy_alias = LEGACY_MANYLINUX_ALIASES_BY_GLIBC_TAG.get(glibc_tag) + if legacy_alias: + platforms.append(f"{legacy_alias}_{parsed.arch}") + return platforms LEGACY_MANYLINUX_ALIASES = { @@ -115,6 +123,10 @@ def create_supported_manylinux_platforms(platform: str) -> list[str]: "manylinux2014": "manylinux_2_17", } +LEGACY_MANYLINUX_ALIASES_BY_GLIBC_TAG = { + glibc_tag: alias for alias, glibc_tag in LEGACY_MANYLINUX_ALIASES.items() +} + def normalize_legacy_manylinux_alias(tag: str) -> str: tag_os_index_end = tag.index("_") diff --git a/tests/utils/test_platforms.py b/tests/utils/test_platforms.py index bd2b67e..1b7b547 100644 --- a/tests/utils/test_platforms.py +++ b/tests/utils/test_platforms.py @@ -54,10 +54,12 @@ def test_create_supported_tags_legacy_manylinux_aliases() -> None: python_version_info=(3, 10, 2), expected_tags={ "cp310-cp310-manylinux_2_5_x86_64", + "cp310-cp310-manylinux1_x86_64", "cp310-cp310-manylinux_2_1_x86_64", }, unexpected_tags={ "cp310-cp310-manylinux_2_6_x86_64", + "cp310-cp310-manylinux2010_x86_64", }, ) @@ -66,10 +68,13 @@ def test_create_supported_tags_legacy_manylinux_aliases() -> None: python_version_info=(3, 10, 2), expected_tags={ "cp310-cp310-manylinux_2_12_x86_64", + "cp310-cp310-manylinux2010_x86_64", + "cp310-cp310-manylinux1_x86_64", "cp310-cp310-manylinux_2_1_x86_64", }, unexpected_tags={ "cp310-cp310-manylinux_2_13_x86_64", + "cp310-cp310-manylinux2014_x86_64", }, ) @@ -78,6 +83,9 @@ def test_create_supported_tags_legacy_manylinux_aliases() -> None: python_version_info=(3, 11, 9), expected_tags={ "cp311-cp311-manylinux_2_17_x86_64", + "cp311-cp311-manylinux2014_x86_64", + "cp311-cp311-manylinux2010_x86_64", + "cp311-cp311-manylinux1_x86_64", "cp311-cp311-manylinux_2_1_x86_64", }, unexpected_tags={ @@ -86,6 +94,35 @@ def test_create_supported_tags_legacy_manylinux_aliases() -> None: ) +def test_create_supported_tags_manylinux_includes_legacy_aliases() -> None: + _test_create_supported_tags( + platform="manylinux_2_34_aarch64", + python_version_info=(3, 14, 0), + expected_tags={ + "cp314-cp314-manylinux_2_34_aarch64", + "cp314-cp314-manylinux_2_17_aarch64", + "cp314-cp314-manylinux2014_aarch64", + "cp314-abi3-manylinux2014_aarch64", + "py3-none-manylinux2014_aarch64", + }, + unexpected_tags={ + "cp314-cp314-manylinux_2_35_aarch64", + }, + ) + + +def test_create_supported_tags_ranks_legacy_alias_with_its_glibc_version() -> None: + env = MockEnv(version_info=(3, 14, 0)) + tags = [ + str(tag) + for tag in platforms.create_supported_tags("manylinux_2_34_aarch64", env) + ] + + index = tags.index("cp314-cp314-manylinux2014_aarch64") + assert tags[index - 1] == "cp314-cp314-manylinux_2_17_aarch64" + assert tags[index + 1] == "cp314-cp314-manylinux_2_16_aarch64" + + def test_create_supported_tags_macosx() -> None: _test_create_supported_tags( platform="macosx_11_0_arm64",