mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-03 18:38:21 +00:00
Fix bug in terms when collapsing unavailable versions in resolver errors (#9877)
Closes https://github.com/astral-sh/uv/issues/9861 Closes https://github.com/pubgrub-rs/pubgrub/issues/297
This commit is contained in:
parent
b2459e6326
commit
4bce1a32ec
5 changed files with 28 additions and 15 deletions
|
@ -673,13 +673,18 @@ fn collapse_unavailable_versions(
|
|||
// And the package and reason are the same...
|
||||
if package == other_package && reason == other_reason {
|
||||
// Collapse both into a new node, with a union of their ranges
|
||||
let versions = other_versions.union(versions);
|
||||
let mut terms = terms.clone();
|
||||
if let Some(Term::Positive(range)) = terms.get_mut(package) {
|
||||
*range = versions.clone();
|
||||
}
|
||||
*tree = DerivationTree::Derived(Derived {
|
||||
terms: terms.clone(),
|
||||
terms,
|
||||
shared_id: *shared_id,
|
||||
cause1: cause1.clone(),
|
||||
cause2: Arc::new(DerivationTree::External(External::Custom(
|
||||
package.clone(),
|
||||
versions.union(other_versions),
|
||||
versions,
|
||||
reason.clone(),
|
||||
))),
|
||||
});
|
||||
|
@ -696,12 +701,17 @@ fn collapse_unavailable_versions(
|
|||
// And the package and reason are the same...
|
||||
if package == other_package && reason == other_reason {
|
||||
// Collapse both into a new node, with a union of their ranges
|
||||
let versions = other_versions.union(versions);
|
||||
let mut terms = terms.clone();
|
||||
if let Some(Term::Positive(range)) = terms.get_mut(package) {
|
||||
*range = versions.clone();
|
||||
}
|
||||
*tree = DerivationTree::Derived(Derived {
|
||||
terms: terms.clone(),
|
||||
terms,
|
||||
shared_id: *shared_id,
|
||||
cause1: Arc::new(DerivationTree::External(External::Custom(
|
||||
package.clone(),
|
||||
versions.union(other_versions),
|
||||
versions,
|
||||
reason.clone(),
|
||||
))),
|
||||
cause2: cause2.clone(),
|
||||
|
|
|
@ -263,7 +263,10 @@ fn prune_unzipped() -> Result<()> {
|
|||
and all of:
|
||||
iniconfig<=0.1
|
||||
iniconfig>=1.0.0
|
||||
need to be downloaded from a registry, we can conclude that iniconfig<1.0.0 cannot be used.
|
||||
need to be downloaded from a registry, we can conclude that all of:
|
||||
iniconfig<=0.1
|
||||
iniconfig>=1.0.0
|
||||
cannot be used.
|
||||
And because you require iniconfig, we can conclude that your requirements are unsatisfiable.
|
||||
|
||||
hint: Pre-releases are available for `iniconfig` in the requested range (e.g., 0.2.dev0), but pre-releases weren't enabled (try: `--prerelease=allow`)
|
||||
|
|
|
@ -13818,7 +13818,7 @@ fn invalid_platform() -> Result<()> {
|
|||
open3d==0.16.1
|
||||
open3d==0.17.0
|
||||
open3d==0.18.0
|
||||
and open3d<=0.15.2 has no wheels with a matching Python ABI tag, we can conclude that open3d<0.9.0.0 cannot be used.
|
||||
and open3d<=0.15.2 has no wheels with a matching Python ABI tag, we can conclude that open3d<=0.15.2 cannot be used.
|
||||
And because open3d>=0.16.0 has no wheels with a matching platform tag and you require open3d, we can conclude that your requirements are unsatisfiable.
|
||||
"###);
|
||||
|
||||
|
|
|
@ -2182,11 +2182,11 @@ fn install_only_binary_all_and_no_binary_all() {
|
|||
anyio>=3.7.0,<=3.7.1
|
||||
anyio>=4.0.0
|
||||
have no usable wheels and building from source is disabled, we can conclude that all of:
|
||||
anyio<1.1.0
|
||||
anyio>1.4.0,<2.0.0
|
||||
anyio>2.2.0,<3.0.0
|
||||
anyio>3.6.2,<3.7.0
|
||||
anyio>3.7.1,<4.0.0
|
||||
anyio>=1.0.0,<=1.4.0
|
||||
anyio>=2.0.0,<=2.2.0
|
||||
anyio>=3.0.0,<=3.6.2
|
||||
anyio>=3.7.0,<=3.7.1
|
||||
anyio>=4.0.0
|
||||
cannot be used.
|
||||
And because you require anyio, we can conclude that your requirements are unsatisfiable.
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ fn tool_list_show_version_specifiers() {
|
|||
|
||||
uv_snapshot!(context.filters(), context.tool_list().arg("--show-version-specifiers")
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r#"
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -287,12 +287,12 @@ fn tool_list_show_version_specifiers() {
|
|||
- flask
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
"###);
|
||||
|
||||
// with paths
|
||||
uv_snapshot!(context.filters(), context.tool_list().arg("--show-version-specifiers").arg("--show-paths")
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r#"
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -303,5 +303,5 @@ fn tool_list_show_version_specifiers() {
|
|||
- flask ([TEMP_DIR]/bin/flask)
|
||||
|
||||
----- stderr -----
|
||||
"#);
|
||||
"###);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue