-
-
Notifications
You must be signed in to change notification settings - Fork 370
Emit a warning if a file is excluded from the archive by matching the target #2874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fa60681 to
c59bc46
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a deprecation warning for files excluded from archives by matching the target path instead of the source path on the filesystem, as proposed in issue #2867. The implementation helps users identify when their exclude patterns are matching archive paths rather than source paths, preparing them for a future breaking change.
Key Changes:
- Added early exclusion check for source paths before processing (wheel_writer.rs and sdist_writer.rs)
- Emits deprecation warnings when files are excluded by target path matching
- Ensures files excluded by source path return silently without warnings
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/module_writer/wheel_writer.rs | Added source path exclusion check and deprecation warning for target path exclusion in wheel archives |
| src/module_writer/sdist_writer.rs | Added source path exclusion check and deprecation warning for target path exclusion in source distributions |
src/module_writer/wheel_writer.rs
Outdated
| eprintln!( | ||
| "⚠️ Warning: {} was excluded from the archive by the target path in the archive instead of the source path on the filesystem", | ||
| target.display(), | ||
| ); | ||
| eprintln!( | ||
| " This behavior is deprecated and will be removed in future versions of maturin" | ||
| ); |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning message is duplicated in sdist_writer.rs (lines 55-61). Consider extracting it to a shared function or constant to maintain consistency and reduce duplication. For example:
// In mod.rs or a util module
fn warn_target_path_exclusion(target: &Path) {
eprintln!(
"⚠️ Warning: {} was excluded from the archive by the target path in the archive instead of the source path on the filesystem",
target.display(),
);
eprintln!(
" This behavior is deprecated and will be removed in future versions of maturin"
);
}Then call it from both WheelWriter::add_bytes and SDistWriter::add_bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a huge fan of the duplicate code but, if you don't mind it for the moment, I do have a plan to extract the file tracking and exclusion logic out of the wheel and sdist writers into a 'virtual' writer layer (the reason for this is unrelated to file exclusions but it happens to be a useful side-effect). That code isn't ready for review yet but if you're curious you can see it here: https://github.com/e-nomem/maturin/tree/virtual-writer
c59bc46 to
ebef346
Compare
ebef346 to
b9ed7d8
Compare
This implements the proposal in #2867