Skip to content

Commit

Permalink
Clone individual files on windows ReFS (#3551)
Browse files Browse the repository at this point in the history
Windows does not support cloning whole directories so clone each file
instead.

closes #3547 

## Test Plan

Ran ` uv pip install setuptools --link-mode=clone` manually
  • Loading branch information
bschoenmaeckers authored May 13, 2024
1 parent b596b46 commit 1218766
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/install-wheel-rs/src/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,15 @@ fn clone_recursive(

debug!("Cloning {} to {}", from.display(), to.display());

if cfg!(windows) && from.is_dir() {
// On Windows, reflinking directories is not supported, so we copy each file instead.
fs::create_dir_all(&to)?;
for entry in fs::read_dir(from)? {
clone_recursive(site_packages, wheel, &entry?, attempt)?;
}
return Ok(());
}

match attempt {
Attempt::Initial => {
if let Err(err) = reflink::reflink(&from, &to) {
Expand Down

0 comments on commit 1218766

Please sign in to comment.