diff --git a/Cargo.lock b/Cargo.lock index 174a1d9d682c..6c09bfab41c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2693,7 +2693,7 @@ dependencies = [ [[package]] name = "pubgrub" version = "0.2.1" -source = "git+https://github.com/astral-sh/pubgrub?rev=a68cbd1a26e43986a31563e1d127e83bafca3a0c#a68cbd1a26e43986a31563e1d127e83bafca3a0c" +source = "git+https://github.com/astral-sh/pubgrub?rev=b4435e2f3af10dab2336a0345b35dcd622699d06#b4435e2f3af10dab2336a0345b35dcd622699d06" dependencies = [ "indexmap", "log", diff --git a/Cargo.toml b/Cargo.toml index e5f887841b76..9744c7bdb30c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ path-slash = { version = "0.2.1" } pathdiff = { version = "0.2.1" } petgraph = { version = "0.6.4" } platform-info = { version = "2.0.2" } -pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "a68cbd1a26e43986a31563e1d127e83bafca3a0c" } +pubgrub = { git = "https://github.com/astral-sh/pubgrub", rev = "b4435e2f3af10dab2336a0345b35dcd622699d06" } pyo3 = { version = "0.21.0" } pyo3-log = { version = "0.10.0" } quote = { version = "1.0.36" } diff --git a/crates/uv-resolver/src/resolver/mod.rs b/crates/uv-resolver/src/resolver/mod.rs index c136ca1c50c4..a1635938a651 100644 --- a/crates/uv-resolver/src/resolver/mod.rs +++ b/crates/uv-resolver/src/resolver/mod.rs @@ -495,9 +495,8 @@ impl ResolverState ResolverState { - if constraints - .iter() - .any(|(dependency, _)| dependency == &package) - { - if enabled!(Level::DEBUG) { - prefetcher.log_tried_versions(); - } - return Err(PubGrubError::SelfDependency { - package: package.clone(), - version: version.clone(), - } - .into()); - } - - // Add that package and version if the dependencies are not problematic. - let dep_incompats = - state.pubgrub.add_incompatibility_from_dependencies( - package.clone(), - version.clone(), - constraints, - ); - state.pubgrub.partial_solution.add_version( - package.clone(), - version.clone(), - dep_incompats, - &state.pubgrub.incompatibility_store, - ); + ForkedDependencies::Unforked(dependencies) => { + state.add_package_version_dependencies( + &version, + dependencies, + &prefetcher, + )?; forked_states.push(state); } ForkedDependencies::Forked { @@ -565,21 +542,6 @@ impl ResolverState ResolverState)>, + prefetcher: &BatchPrefetcher, + ) -> Result<(), ResolveError> { + if dependencies + .iter() + .any(|(dependency, _)| dependency == &self.next) + { + if enabled!(Level::DEBUG) { + prefetcher.log_tried_versions(); + } + return Err(PubGrubError::SelfDependency { + package: self.next.clone(), + version: version.clone(), + } + .into()); + } + self.pubgrub.add_package_version_dependencies( + self.next.clone(), + version.clone(), + dependencies, + ); + Ok(()) + } + fn into_resolution(self) -> Resolution { let solution = self.pubgrub.partial_solution.extract_solution(); let mut dependencies: FxHashMap<