Remove derivation chain special casing (#9678)

Instead of modifying the error to replace a dummy derivation chain from
construction with the real one, build the error with the real derivation
chain directly.
This commit is contained in:
konsti 2024-12-06 14:05:03 +01:00 committed by GitHub
parent a286e95f44
commit 400839c527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 117 additions and 159 deletions

View file

@ -30,8 +30,8 @@ use uv_installer::{Installer, Plan, Planner, Preparer, SitePackages};
use uv_pypi_types::{Conflicts, Requirement};
use uv_python::{Interpreter, PythonEnvironment};
use uv_resolver::{
DerivationChainBuilder, ExcludeNewer, FlatIndex, Flexibility, InMemoryIndex, Manifest,
OptionsBuilder, PythonRequirement, Resolver, ResolverEnvironment,
ExcludeNewer, FlatIndex, Flexibility, InMemoryIndex, Manifest, OptionsBuilder,
PythonRequirement, Resolver, ResolverEnvironment,
};
use uv_types::{BuildContext, BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight};
@ -274,18 +274,8 @@ impl<'a> BuildContext for BuildDispatch<'a> {
);
preparer
.prepare(remote, &self.shared_state.in_flight)
.await
.map_err(|err| match err {
uv_installer::PrepareError::Dist(kind, dist, chain, err) => {
debug_assert!(chain.is_empty());
let chain =
DerivationChainBuilder::from_resolution(resolution, (&*dist).into())
.unwrap_or_default();
uv_installer::PrepareError::Dist(kind, dist, chain, err)
}
_ => err,
})?
.prepare(remote, &self.shared_state.in_flight, resolution)
.await?
};
// Remove any unnecessary packages.