mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Show user-facing warning when falling back to copy installs (#4880)
## Summary This has come up a few times including in a recent email to me.
This commit is contained in:
parent
947cfa13a8
commit
4f340580c7
4 changed files with 17 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1854,6 +1854,7 @@ dependencies = [
|
||||||
"tracing",
|
"tracing",
|
||||||
"uv-fs",
|
"uv-fs",
|
||||||
"uv-normalize",
|
"uv-normalize",
|
||||||
|
"uv-warnings",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"zip",
|
"zip",
|
||||||
]
|
]
|
||||||
|
|
|
@ -23,9 +23,10 @@ name = "install_wheel_rs"
|
||||||
distribution-filename = { workspace = true }
|
distribution-filename = { workspace = true }
|
||||||
pep440_rs = { workspace = true }
|
pep440_rs = { workspace = true }
|
||||||
platform-tags = { workspace = true }
|
platform-tags = { workspace = true }
|
||||||
uv-normalize = { workspace = true }
|
|
||||||
uv-fs = { workspace = true }
|
|
||||||
pypi-types = { workspace = true }
|
pypi-types = { workspace = true }
|
||||||
|
uv-fs = { workspace = true }
|
||||||
|
uv-normalize = { workspace = true }
|
||||||
|
uv-warnings = { workspace = true }
|
||||||
|
|
||||||
clap = { workspace = true, optional = true, features = ["derive"] }
|
clap = { workspace = true, optional = true, features = ["derive"] }
|
||||||
configparser = { workspace = true }
|
configparser = { workspace = true }
|
||||||
|
|
|
@ -16,6 +16,7 @@ use distribution_filename::WheelFilename;
|
||||||
use pep440_rs::Version;
|
use pep440_rs::Version;
|
||||||
use pypi_types::DirectUrl;
|
use pypi_types::DirectUrl;
|
||||||
use uv_normalize::PackageName;
|
use uv_normalize::PackageName;
|
||||||
|
use uv_warnings::warn_user_once;
|
||||||
|
|
||||||
use crate::script::{scripts_from_ini, Script};
|
use crate::script::{scripts_from_ini, Script};
|
||||||
use crate::wheel::{
|
use crate::wheel::{
|
||||||
|
@ -355,7 +356,8 @@ fn clone_recursive(
|
||||||
debug!(
|
debug!(
|
||||||
"Failed to clone `{}` to temporary location `{}`, attempting to copy files as a fallback",
|
"Failed to clone `{}` to temporary location `{}`, attempting to copy files as a fallback",
|
||||||
from.display(),
|
from.display(),
|
||||||
tempfile.display());
|
tempfile.display(),
|
||||||
|
);
|
||||||
*attempt = Attempt::UseCopyFallback;
|
*attempt = Attempt::UseCopyFallback;
|
||||||
fs::copy(&from, &to)?;
|
fs::copy(&from, &to)?;
|
||||||
}
|
}
|
||||||
|
@ -401,6 +403,7 @@ fn clone_recursive(
|
||||||
} else {
|
} else {
|
||||||
fs::copy(&from, &to)?;
|
fs::copy(&from, &to)?;
|
||||||
}
|
}
|
||||||
|
warn_user_once!("Failed to clone files; falling back to full copy. This may lead to degraded performance. If this is intentional, use `--link-mode=copy` to suppress this warning.\n\nhint: If the cache and target directories are on different filesystems, reflinking may not be supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,6 +527,7 @@ fn hardlink_wheel_files(
|
||||||
}
|
}
|
||||||
Attempt::UseCopyFallback => {
|
Attempt::UseCopyFallback => {
|
||||||
fs::copy(path, &out_path)?;
|
fs::copy(path, &out_path)?;
|
||||||
|
warn_user_once!("Failed to hardlink files; falling back to full copy. This may lead to degraded performance. If this is intentional, use `--link-mode=copy` to suppress this warning.\n\nhint: If the cache and target directories are on different filesystems, hardlinking may not be supported.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5104,6 +5104,10 @@ fn target_no_build_isolation() -> Result<()> {
|
||||||
|
|
||||||
/// Sync to a `--prefix` directory.
|
/// Sync to a `--prefix` directory.
|
||||||
#[test]
|
#[test]
|
||||||
|
#[cfg_attr(
|
||||||
|
target_os = "macos",
|
||||||
|
ignore = "On macOS, we fail to reflink due to a non-existent site-packages directory"
|
||||||
|
)]
|
||||||
fn prefix() -> Result<()> {
|
fn prefix() -> Result<()> {
|
||||||
let context = TestContext::new("3.12");
|
let context = TestContext::new("3.12");
|
||||||
|
|
||||||
|
@ -5111,10 +5115,12 @@ fn prefix() -> Result<()> {
|
||||||
let requirements_in = context.temp_dir.child("requirements.in");
|
let requirements_in = context.temp_dir.child("requirements.in");
|
||||||
requirements_in.write_str("iniconfig==2.0.0")?;
|
requirements_in.write_str("iniconfig==2.0.0")?;
|
||||||
|
|
||||||
|
let prefix = context.temp_dir.child("prefix");
|
||||||
|
|
||||||
uv_snapshot!(context.pip_sync()
|
uv_snapshot!(context.pip_sync()
|
||||||
.arg("requirements.in")
|
.arg("requirements.in")
|
||||||
.arg("--prefix")
|
.arg("--prefix")
|
||||||
.arg("prefix"), @r###"
|
.arg(prefix.path()), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
@ -5149,7 +5155,7 @@ fn prefix() -> Result<()> {
|
||||||
uv_snapshot!(context.pip_sync()
|
uv_snapshot!(context.pip_sync()
|
||||||
.arg("requirements.in")
|
.arg("requirements.in")
|
||||||
.arg("--prefix")
|
.arg("--prefix")
|
||||||
.arg("prefix"), @r###"
|
.arg(prefix.path()), @r###"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue