Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/module_writer/sdist_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use flate2::write::GzEncoder;
use fs_err as fs;
use ignore::overrides::Override;
use normpath::PathExt as _;
use tracing::debug;

use crate::Metadata24;

Expand All @@ -34,6 +35,7 @@ pub struct SDistWriter {
file_tracker: FileTracker,
excludes: Override,
mtime: u64,
target_exclusion_warning_emitted: bool,
}

impl ModuleWriter for SDistWriter {
Expand All @@ -52,6 +54,15 @@ impl ModuleWriter for SDistWriter {

let target = target.as_ref();
if self.exclude(target) {
if !self.target_exclusion_warning_emitted {
self.target_exclusion_warning_emitted = true;
eprintln!(
"⚠️ Warning: A file was excluded from the archive by the target path in the archive\n\
⚠️ instead of the source path on the filesystem. This behavior is deprecated and\n\
⚠️ will be removed in future versions of maturin.",
);
}
debug!("Excluded file {target:?} from archive by target path");
return Ok(());
}

Expand Down Expand Up @@ -110,6 +121,7 @@ impl SDistWriter {
file_tracker: FileTracker::default(),
excludes,
mtime: mtime_override.unwrap_or(SDIST_DETERMINISTIC_TIMESTAMP),
target_exclusion_warning_emitted: false,
})
}

Expand Down
17 changes: 17 additions & 0 deletions src/module_writer/wheel_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct WheelWriter {
file_tracker: FileTracker,
excludes: Override,
file_options: SimpleFileOptions,
target_exclusion_warning_emitted: bool,
}

impl ModuleWriter for WheelWriter {
Expand All @@ -40,8 +41,23 @@ impl ModuleWriter for WheelWriter {
mut data: impl Read,
executable: bool,
) -> Result<()> {
if let Some(source) = source {
if self.exclude(source) {
return Ok(());
}
}

let target = target.as_ref();
if self.exclude(target) {
if !self.target_exclusion_warning_emitted {
self.target_exclusion_warning_emitted = true;
eprintln!(
"⚠️ Warning: A file was excluded from the archive by the target path in the archive\n\
⚠️ instead of the source path on the filesystem. This behavior is deprecated and\n\
⚠️ will be removed in future versions of maturin.",
);
}
debug!("Excluded file {target:?} from archive by target path");
return Ok(());
}

Expand Down Expand Up @@ -94,6 +110,7 @@ impl WheelWriter {
file_tracker: FileTracker::default(),
excludes,
file_options,
target_exclusion_warning_emitted: false,
};

write_dist_info(&mut builder, pyproject_dir, metadata24, tags)?;
Expand Down
Loading