Use separate types to represent raw vs. resolver markers (#6646)

## Summary

This is similar to https://github.com/astral-sh/uv/pull/6171 but more
expansive... _Anywhere_ that we test requirements for platform
compatibility, we _need_ to respect the resolver-friendly markers. In
fixing the motivating issue (#6621), I also realized that we had a bunch
of bugs here around `pip install` with `--python-platform` and
`--python-version`, because we always performed our `satisfy` and `Plan`
operations on the interpreter's markers, not the adjusted markers!

Closes https://github.com/astral-sh/uv/issues/6621.
This commit is contained in:
Charlie Marsh 2024-08-26 14:00:21 -04:00 committed by GitHub
parent 6220532373
commit a7850d2a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 422 additions and 247 deletions

View file

@ -138,7 +138,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.markers();
let markers = self.interpreter.resolver_markers();
let tags = self.interpreter.tags()?;
let resolver = Resolver::new(
@ -148,7 +148,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
.index_strategy(self.index_strategy)
.build(),
&python_requirement,
ResolverMarkers::specific_environment(markers.clone()),
ResolverMarkers::specific_environment(markers),
Some(tags),
self.flat_index,
self.index,
@ -189,6 +189,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
// Determine the current environment markers.
let tags = self.interpreter.tags()?;
let markers = self.interpreter.resolver_markers();
// Determine the set of installed packages.
let site_packages = SitePackages::from_environment(venv)?;
@ -208,6 +209,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
self.index_locations,
self.cache(),
venv,
&markers,
tags,
)?;