Repository navigation
fix: honor manylinux aliases in graft policy selection - #747
Conversation
Match canonical policy names and aliases when deriving the requested graft budget. Add regression coverage for the three legacy manylinux aliases. Prepared with AI assistance, including independent AI technical review.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #747 +/- ##
=======================================
Coverage 96.08% 96.08%
=======================================
Files 23 23
Lines 2041 2041
Branches 390 390
=======================================
Hits 1961 1961
Misses 46 46
Partials 34 34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Franky100-pig
left a comment
There was a problem hiding this comment.
I checked the two pieces that have to line up here and they do: main_repair.py strips the arch suffix off --plat before passing it as requested_policy_base_name, while _Policy.aliases in policy/__init__.py stores aliases with the arch suffix (manylinux2014_x86_64, etc.). So startswith(f"{base}_") matches legacy aliases and canonical names on the same footing — the fix addresses the real asymmetry.
One scenario the test doesn't cover: a wheel whose external refs span more than one policy, where only the alias-named policy contributes libs. Because graft_lib_count is a min() over the matching refs, a wrong count silently lowers graft_policy rather than erroring, so a regression here would be easy to miss. A test with two bundled wheels (one canonical-named, one alias-named) where the alias one is the limiting factor would give the change stronger protection. Otherwise this is a small, targeted fix and the parametrized alias/canonical equivalence test is a good addition.
When a wheel needs an external library, requesting a legacy manylinux alias can drop older compatible output tags. For example,
--plat manylinux2010_x86_64omitsmanylinux1_x86_64/manylinux_2_5_x86_64for a compatible wheel, while the equivalent--plat manylinux_2_12_x86_64includes them.The requested policy's graft budget currently matches only
Policy.name, which contains the canonical name. An alias therefore matches nothing and falls back to zero. Match both the canonical name andPolicy.aliaseswhen calculating that budget. The existing maximum graft count and highest-compatible-policy behavior from #649 and the discussion in #690 are preserved.Adds three regression cases comparing
manylinux1,manylinux2010, andmanylinux2014with their canonical policies using the existing cffi wheel. These assert nonempty external dependencies, a nongeneric canonical graft policy, and alias/canonical equivalence. The tests fail on the base and pass with this change. This concerns policy selection before output tags are written; it is separate from the WHEEL metadata normalization in #745.Validation on Linux with CPython 3.12.15 and patchelf 0.18.0:
tests/integration/test_manylinux.py: 337 passed, 4 skipped on both x86_64 (emulated) and aarch64 (native).--only-plat, and unsupported-alias rejection. An additional x86_64 whitelist-boundary fixture confirmed the graft-count safeguard.The full Docker manylinux/musllinux distribution/toolchain/patcher matrix was not run. The complete Python/architecture matrix, distribution-build sessions, and all-repository pre-commit suite were not run locally. These checks remain for upstream CI; current-Debian loader checks do not establish execution on the oldest advertised glibc versions.
AI assistance was used to prepare the implementation and regression tests.