mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
uv-resolver: slight tweek to try_universal_markers
Previously, we had copied the behavior of `try_markers` to return `None` in the case where the marker was always true. I believe this was done because it somewhat implies that there is no forking happening. But I find this somewhat strange personally, and instead flipped this around so that it still returns a marker in that case. The one call site that is impacted by this is the resolution graph construction. If we left it as-is, it would end up with a list of one marker that is always true in some cases. And this in turn results in writing an empty `resolution-markers` to the lock file. Probably the output logic should be tweaked instead, but we leave it alone for now.
This commit is contained in:
parent
35ff802e3e
commit
d1f0ee7a47
2 changed files with 8 additions and 11 deletions
|
@ -160,18 +160,19 @@ impl ResolverOutput {
|
|||
let requires_python = python.target().clone();
|
||||
|
||||
let fork_markers: Vec<UniversalMarker> = if let [resolution] = resolutions {
|
||||
// In the case of a singleton marker, we only include it if it's not
|
||||
// always true. Otherwise, we keep our `fork_markers` empty as there
|
||||
// are no forks.
|
||||
resolution
|
||||
.env
|
||||
.try_markers()
|
||||
.cloned()
|
||||
.try_universal_markers()
|
||||
.into_iter()
|
||||
.map(|marker| UniversalMarker::new(marker, MarkerTree::TRUE))
|
||||
.filter(|marker| !marker.is_true())
|
||||
.collect()
|
||||
} else {
|
||||
resolutions
|
||||
.iter()
|
||||
.map(|resolution| resolution.env.try_markers().cloned().unwrap_or_default())
|
||||
.map(|marker| UniversalMarker::new(marker, MarkerTree::TRUE))
|
||||
.map(|resolution| resolution.env.try_universal_markers().unwrap_or_default())
|
||||
.collect()
|
||||
};
|
||||
|
||||
|
|
|
@ -344,12 +344,8 @@ impl ResolverEnvironment {
|
|||
match self.kind {
|
||||
Kind::Specific { .. } => None,
|
||||
Kind::Universal { ref markers, .. } => {
|
||||
if markers.is_true() {
|
||||
None
|
||||
} else {
|
||||
// FIXME: Support conflicts.
|
||||
Some(UniversalMarker::new(markers.clone(), MarkerTree::TRUE))
|
||||
}
|
||||
// FIXME: Support conflicts.
|
||||
Some(UniversalMarker::new(markers.clone(), MarkerTree::TRUE))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue