mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
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:
parent
6220532373
commit
a7850d2a1c
37 changed files with 422 additions and 247 deletions
|
@ -17,7 +17,7 @@ use pep440_rs::Version;
|
|||
use pep508_rs::{MarkerEnvironment, StringVersion};
|
||||
use platform_tags::Platform;
|
||||
use platform_tags::{Tags, TagsError};
|
||||
use pypi_types::Scheme;
|
||||
use pypi_types::{ResolverMarkerEnvironment, Scheme};
|
||||
use uv_cache::{Cache, CacheBucket, CachedByTimestamp, Freshness, Timestamp};
|
||||
use uv_fs::{write_atomic_sync, PythonExt, Simplified};
|
||||
|
||||
|
@ -142,6 +142,11 @@ impl Interpreter {
|
|||
&self.markers
|
||||
}
|
||||
|
||||
/// Return the [`ResolverMarkerEnvironment`] for this Python executable.
|
||||
pub fn resolver_markers(&self) -> ResolverMarkerEnvironment {
|
||||
ResolverMarkerEnvironment::from(self.markers().clone())
|
||||
}
|
||||
|
||||
/// Returns the [`PythonInstallationKey`] for this interpreter.
|
||||
pub fn key(&self) -> PythonInstallationKey {
|
||||
PythonInstallationKey::new(
|
||||
|
|
|
@ -84,7 +84,7 @@ impl PythonVersion {
|
|||
///
|
||||
/// The returned [`MarkerEnvironment`] will preserve the base environment's platform markers,
|
||||
/// but override its Python version markers.
|
||||
pub fn markers(self, base: &MarkerEnvironment) -> MarkerEnvironment {
|
||||
pub fn markers(&self, base: &MarkerEnvironment) -> MarkerEnvironment {
|
||||
let mut markers = base.clone();
|
||||
|
||||
// Ex) `implementation_version == "3.12.0"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue