mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-17 18:57:30 +00:00
uv-resolver: normalize marker expressions (#4017)
This is a quick fix for some flaky tests where the output in the lock file isn't stable because marker expressions can be combined in a non-deterministic order. I believe there is ongoing work to simplify marker expressions which will help here, but I think some kind of normalization is still ultimately needed to guarantee consistent output. I first noticed the flaky test in: https://github.com/astral-sh/uv/pull/4015
This commit is contained in:
parent
3b8f3a7f0d
commit
5c30b39fe3
2 changed files with 30 additions and 1 deletions
|
|
@ -356,7 +356,12 @@ pub struct Distribution {
|
|||
impl Distribution {
|
||||
fn from_annotated_dist(annotated_dist: &AnnotatedDist) -> Result<Self, LockError> {
|
||||
let id = DistributionId::from_annotated_dist(annotated_dist);
|
||||
let marker = annotated_dist.marker.clone();
|
||||
let mut marker = annotated_dist.marker.clone();
|
||||
// Markers can be combined in an unpredictable order, so normalize them
|
||||
// such that the lock file output is consistent and deterministic.
|
||||
if let Some(ref mut marker) = marker {
|
||||
marker.normalize();
|
||||
}
|
||||
let sdist = SourceDist::from_annotated_dist(annotated_dist)?;
|
||||
let wheels = Wheel::from_annotated_dist(annotated_dist)?;
|
||||
Ok(Distribution {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue