Skip to content
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

Improve build backend excludes #9281

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 15 additions & 10 deletions crates/uv-build-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,12 @@ fn wheel_subdir_from_globs(
let license_files_globs: Vec<_> = globs
.iter()
.map(|license_files| {
trace!("Including license files at: `{license_files}`");
trace!(
"Including {} at `{}` with `{}`",
globs_field,
src.user_display(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the thing that will emit an empty string for the CWD? Can we make it emit ./ instead for that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have an idea, but it affects more places so I'll follow up

license_files
);
parse_portable_glob(license_files)
})
.collect::<Result<_, _>>()
Expand Down Expand Up @@ -521,7 +526,7 @@ fn wheel_subdir_from_globs(
.expect("walkdir starts with root");

if !license_files_matcher.match_path(relative) {
trace!("Excluding {}", relative.user_display());
trace!("Excluding: `{}`", relative.user_display());
continue;
};

Expand Down Expand Up @@ -735,7 +740,7 @@ pub fn build_source_dist(
.expect("walkdir starts with root");

if !include_matcher.match_path(relative) || exclude_matcher.is_match(relative) {
trace!("Excluding {}", relative.user_display());
trace!("Excluding: `{}`", relative.user_display());
continue;
};

Expand Down Expand Up @@ -1159,13 +1164,6 @@ mod tests {
)
.unwrap();

// Check that we write deterministic wheels.
let wheel_filename = "built_by_uv-0.1.0-py3-none-any.whl";
assert_eq!(
fs_err::read(direct_output_dir.path().join(wheel_filename)).unwrap(),
fs_err::read(indirect_output_dir.path().join(wheel_filename)).unwrap()
);

// Check the contained files and directories
assert_snapshot!(source_dist_contents.iter().map(|path| path.replace('\\', "/")).join("\n"), @r"
built_by_uv-0.1.0/LICENSE-APACHE
Expand Down Expand Up @@ -1220,5 +1218,12 @@ mod tests {
built_by_uv/arithmetic/circle.py
built_by_uv/arithmetic/pi.txt
");

// Check that we write deterministic wheels.
let wheel_filename = "built_by_uv-0.1.0-py3-none-any.whl";
assert_eq!(
fs_err::read(direct_output_dir.path().join(wheel_filename)).unwrap(),
fs_err::read(indirect_output_dir.path().join(wheel_filename)).unwrap()
);
}
}
2 changes: 1 addition & 1 deletion crates/uv-globfilter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn main() {
.to_path_buf();

if !include_matcher.match_path(&relative) || exclude_matcher.is_match(&relative) {
trace!("Excluding: {}", relative.display());
trace!("Excluding: `{}`", relative.display());
continue;
};
println!("{}", relative.display());
Expand Down