Remove unnecessary index location methods (#7826)

This commit is contained in:
Charlie Marsh 2024-10-01 00:44:53 -04:00 committed by GitHub
parent 462a13c45a
commit 1602b5c8d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 22 deletions

View file

@ -96,6 +96,7 @@ struct ResolverState<InstalledPackages: InstalledPackagesProvider> {
preferences: Preferences,
git: GitResolver,
capabilities: IndexCapabilities,
locations: IndexLocations,
exclusions: Exclusions,
urls: Urls,
locals: Locals,
@ -171,6 +172,7 @@ impl<'a, Context: BuildContext, InstalledPackages: InstalledPackagesProvider>
index,
build_context.git(),
build_context.capabilities(),
build_context.index_locations(),
provider,
installed_packages,
)
@ -190,6 +192,7 @@ impl<Provider: ResolverProvider, InstalledPackages: InstalledPackagesProvider>
index: &InMemoryIndex,
git: &GitResolver,
capabilities: &IndexCapabilities,
locations: &IndexLocations,
provider: Provider,
installed_packages: InstalledPackages,
) -> Result<Self, ResolveError> {
@ -210,6 +213,7 @@ impl<Provider: ResolverProvider, InstalledPackages: InstalledPackagesProvider>
preferences: manifest.preferences,
exclusions: manifest.exclusions,
hasher: hasher.clone(),
locations: locations.clone(),
markers,
python_requirement: python_requirement.clone(),
installed_packages,
@ -250,12 +254,11 @@ impl<Provider: ResolverProvider, InstalledPackages: InstalledPackagesProvider>
// Spawn the PubGrub solver on a dedicated thread.
let solver = state.clone();
let index_locations = provider.index_locations().clone();
let (tx, rx) = oneshot::channel();
thread::Builder::new()
.name("uv-resolver".into())
.spawn(move || {
let result = solver.solve(index_locations, request_sink);
let result = solver.solve(request_sink);
// This may fail if the main thread returned early due to an error.
let _ = tx.send(result);
@ -276,8 +279,6 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
#[instrument(skip_all)]
fn solve(
self: Arc<Self>,
// No solution error context.
index_locations: IndexLocations,
request_sink: Sender<Request>,
) -> Result<ResolutionGraph, ResolveError> {
debug!(
@ -330,7 +331,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
state.fork_urls,
state.markers,
&visited,
&index_locations,
&self.locations,
));
}

View file

@ -1,6 +1,6 @@
use std::future::Future;
use distribution_types::{Dist, IndexLocations};
use distribution_types::Dist;
use platform_tags::Tags;
use uv_configuration::BuildOptions;
use uv_distribution::{ArchiveMetadata, DistributionDatabase};
@ -61,9 +61,6 @@ pub trait ResolverProvider {
dist: &'io Dist,
) -> impl Future<Output = WheelMetadataResult> + 'io;
/// Returns the [`IndexLocations`] used by this resolver.
fn index_locations(&self) -> &IndexLocations;
/// Set the [`uv_distribution::Reporter`] to use for this installer.
#[must_use]
fn with_reporter(self, reporter: impl uv_distribution::Reporter + 'static) -> Self;
@ -206,10 +203,6 @@ impl<'a, Context: BuildContext> ResolverProvider for DefaultResolverProvider<'a,
}
}
fn index_locations(&self) -> &IndexLocations {
self.fetcher.index_locations()
}
/// Set the [`uv_distribution::Reporter`] to use for this installer.
#[must_use]
fn with_reporter(self, reporter: impl uv_distribution::Reporter + 'static) -> Self {