mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 12:24:15 +00:00
Add UV_SKIP_WHEEL_FILENAME_CHECK to allow installing invalid wheels (#16046)
## Summary This PR adds a user setting to allow (in rare cases) accepting wheels with mismatched filenames and internal metadata. Closes https://github.com/astral-sh/uv/issues/8082. Closes https://github.com/astral-sh/uv/issues/15647.
This commit is contained in:
parent
170ab1cd7f
commit
7d9ea797b0
12 changed files with 159 additions and 101 deletions
|
|
@ -46,6 +46,7 @@ use uv_pypi_types::{
|
|||
};
|
||||
use uv_redacted::DisplaySafeUrl;
|
||||
use uv_small_str::SmallString;
|
||||
use uv_static::{EnvVars, parse_boolish_environment_variable};
|
||||
use uv_types::{BuildContext, HashStrategy};
|
||||
use uv_workspace::{Editability, WorkspaceMember};
|
||||
|
||||
|
|
@ -3245,11 +3246,16 @@ impl PackageWire {
|
|||
if *version != wheel.filename.version
|
||||
&& *version != wheel.filename.version.clone().without_local()
|
||||
{
|
||||
return Err(LockError::from(LockErrorKind::InconsistentVersions {
|
||||
name: self.id.name,
|
||||
version: version.clone(),
|
||||
wheel: wheel.clone(),
|
||||
}));
|
||||
if !matches!(
|
||||
parse_boolish_environment_variable(EnvVars::UV_SKIP_WHEEL_FILENAME_CHECK),
|
||||
Ok(Some(true))
|
||||
) {
|
||||
return Err(LockError::from(LockErrorKind::InconsistentVersions {
|
||||
name: self.id.name,
|
||||
version: version.clone(),
|
||||
wheel: wheel.clone(),
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
// We can't check the source dist version since it does not need to contain the version
|
||||
|
|
@ -5866,7 +5872,7 @@ enum LockErrorKind {
|
|||
},
|
||||
/// A package has inconsistent versions in a single entry
|
||||
// Using name instead of id since the version in the id is part of the conflict.
|
||||
#[error("The entry for package `{name}` v{version} has wheel `{wheel_filename}` with inconsistent version: v{wheel_version} ", name = name.cyan(), wheel_filename = wheel.filename, wheel_version = wheel.filename.version)]
|
||||
#[error("The entry for package `{name}` ({version}) has wheel `{wheel_filename}` with inconsistent version ({wheel_version}), which indicates a malformed wheel. If this is intentional, set `{env_var}`.", name = name.cyan(), wheel_filename = wheel.filename, wheel_version = wheel.filename.version, env_var = "UV_SKIP_WHEEL_FILENAME_CHECK=1".green())]
|
||||
InconsistentVersions {
|
||||
/// The name of the package with the inconsistent entry.
|
||||
name: PackageName,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue