diff --git a/crates/uv-resolver/src/error.rs b/crates/uv-resolver/src/error.rs index b371608ce697d..75db6ddb7e849 100644 --- a/crates/uv-resolver/src/error.rs +++ b/crates/uv-resolver/src/error.rs @@ -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(), diff --git a/crates/uv/tests/it/cache_prune.rs b/crates/uv/tests/it/cache_prune.rs index d256adc22624b..e814f5fc7f349 100644 --- a/crates/uv/tests/it/cache_prune.rs +++ b/crates/uv/tests/it/cache_prune.rs @@ -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`) diff --git a/crates/uv/tests/it/pip_compile.rs b/crates/uv/tests/it/pip_compile.rs index 7cefebdc76d93..fdab6b433a6db 100644 --- a/crates/uv/tests/it/pip_compile.rs +++ b/crates/uv/tests/it/pip_compile.rs @@ -13796,7 +13796,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. "###); diff --git a/crates/uv/tests/it/pip_install.rs b/crates/uv/tests/it/pip_install.rs index f7f090ec7a9ce..4d462e57f549c 100644 --- a/crates/uv/tests/it/pip_install.rs +++ b/crates/uv/tests/it/pip_install.rs @@ -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. diff --git a/crates/uv/tests/it/tool_list.rs b/crates/uv/tests/it/tool_list.rs index bf3dd92550203..71e17f87c78ab 100644 --- a/crates/uv/tests/it/tool_list.rs +++ b/crates/uv/tests/it/tool_list.rs @@ -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 ----- - "#); + "###); }