Avoid removing local wheels when unzipping (#560)

## Summary

When installing a local wheel, we need to avoid removing the zipped
wheel (since it lives outside of the cache), _and_ need to ensure that
we unzip the wheel into the cache (rather than replacing the zipped
wheel, which may even live outside of the project).

Closes https://github.com/astral-sh/puffin/issues/553.
This commit is contained in:
Charlie Marsh 2023-12-05 12:50:08 -05:00 committed by GitHub
parent 6f055ecf3b
commit a15da36d74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 53 deletions

View file

@ -427,7 +427,7 @@ impl SourceBuild {
let from = tmp_dir.path().join(&filename);
let to = wheel_dir.join(&filename);
if !rename_atomic_sync(from, &to)? {
if rename_atomic_sync(from, &to)?.is_some() {
warn!("Overwriting existing wheel at: {}", to.display());
}
@ -461,7 +461,7 @@ impl SourceBuild {
let from = dist_wheel.path();
let to = wheel_dir.join(dist_wheel.file_name());
if !copy_atomic_sync(from, &to)? {
if copy_atomic_sync(from, &to)?.is_some() {
warn!("Overwriting existing wheel at: {}", to.display());
}