Clone individual files on windows ReFS (#3551)

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
This commit is contained in:
Bas Schoenmaeckers 2024-05-13 18:03:39 +02:00 committed by GitHub
parent b596b460a8
commit 1218766ea5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) {