uv: use ResolverEnvironment instead of ResolverMarkers

This updates the surrounding code to use the new ResolverEnvironment
type. In some cases, this simplifies caller code by removing case
analysis. There *shouldn't* be any behavior changes here. Some test
snapshots were updated to account for some minor tweaks to error
messages.

I didn't split this up into separate commits because it would have been
too difficult/costly.
This commit is contained in:
Andrew Gallant 2024-10-11 15:23:38 -04:00 committed by Andrew Gallant
parent 44c9ef6aea
commit acaed763b7
42 changed files with 416 additions and 600 deletions

View file

@ -30,7 +30,7 @@ use uv_pypi_types::Requirement;
use uv_python::{Interpreter, PythonEnvironment};
use uv_resolver::{
ExcludeNewer, FlatIndex, Flexibility, InMemoryIndex, Manifest, OptionsBuilder,
PythonRequirement, Resolver, ResolverMarkers,
PythonRequirement, Resolver, ResolverEnvironment,
};
use uv_types::{BuildContext, BuildIsolation, EmptyInstalledPackages, HashStrategy, InFlight};
@ -174,7 +174,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
async fn resolve<'data>(&'data self, requirements: &'data [Requirement]) -> Result<Resolution> {
let python_requirement = PythonRequirement::from_interpreter(self.interpreter);
let markers = self.interpreter.resolver_markers();
let marker_env = self.interpreter.resolver_marker_environment();
let tags = self.interpreter.tags()?;
let resolver = Resolver::new(
@ -185,7 +185,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
.flexibility(Flexibility::Fixed)
.build(),
&python_requirement,
ResolverMarkers::specific_environment(markers),
ResolverEnvironment::specific(marker_env),
Some(tags),
self.flat_index,
self.index,