Skip to content

Commit

Permalink
Omit empty resolution markers in lockfile (#9738)
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin authored Dec 10, 2024
1 parent d0ccc9a commit 389a26e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 181 deletions.
10 changes: 7 additions & 3 deletions crates/uv-resolver/src/lock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ impl Lock {
})
.filter_map(super::requires_python::SimplifiedMarkerTree::try_to_string),
);
doc.insert("resolution-markers", value(fork_markers));
if !fork_markers.is_empty() {
doc.insert("resolution-markers", value(fork_markers));
}
}

if !self.supported_environments.is_empty() {
Expand Down Expand Up @@ -1973,7 +1975,7 @@ impl Package {
self.id.to_toml(None, &mut table);

if !self.fork_markers.is_empty() {
let wheels = each_element_on_its_line_array(
let fork_markers = each_element_on_its_line_array(
self.fork_markers
.iter()
// TODO(ag): Consider whether `resolution-markers` should actually
Expand All @@ -1983,7 +1985,9 @@ impl Package {
.map(|marker| SimplifiedMarkerTree::new(requires_python, marker.pep508()))
.filter_map(super::requires_python::SimplifiedMarkerTree::try_to_string),
);
table.insert("resolution-markers", value(wheels));
if !fork_markers.is_empty() {
table.insert("resolution-markers", value(fork_markers));
}
}

if !self.dependencies.is_empty() {
Expand Down
Loading

0 comments on commit 389a26e

Please sign in to comment.