fix: only shim bin wheels during auditwheel repair#3197
Merged
Conversation
`auditwheel=warn` detects external libraries but does not graft them into the wheel. Keep bin artifacts in `.data/scripts/` unless `auditwheel=repair` will copy libraries, avoiding shim-only wheel layout changes on macOS and Windows warn builds.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refines when maturin uses the “bin wheel shim” layout for binary wheels so that wheel contents only change when auditwheel=repair will actually bundle external libraries, avoiding unexpected layout changes in warn/check/skip modes (notably on macOS/Windows where default is warn).
Changes:
- Gate bin-wheel shim layout behind a new
should_use_bin_shim(...)helper that requiresAuditWheelMode::Repair, non-WASI target, and detected external libraries. - Keep non-repair auditwheel modes (and WASI) on the standard
.data/scripts/layout even if external libraries are detected. - Add a focused unit test covering the shim decision matrix.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
auditwheel=repairwill bundle external librariesauditwheel=warn,check,skip, no-library, and WASI builds on the normal.data/scripts/layoutRationale
Maturin 1.13.2 started moving bin artifacts into
{dist}.scripts/whenever external libraries were detected. On macOS and Windows, the default auditwheel mode iswarn, which reports external libraries but does not graft them into the wheel. That produced shim-only wheel layouts without bundled.dylibs/.libs, which changed wheel contents unexpectedly for consumers such as astral-sh/uv#19468.The shim is only needed when repair mode copies libraries into platlib and the binary needs a predictable relative path to those bundled libraries.
Checks
cargo fmt --allcargo test --lib build_orchestrator::tests::test_should_use_bin_shim_only_for_repair_with_external_libs -- --nocapturecargo test --libcargo clippy --tests --all-features -- -D warningsgit diff --checkcargo fmt,cargo deny, general hooks)