mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-17 13:58:29 +00:00
Fix marker merging for requirements.txt for psycopg (#11298)
Given an input in the shape: ``` foo[bar]==1.0.0; sys_platform == 'linux' foo==1.0.0; sys_platform != 'linux' ``` We would write either ``` foo==1.0.0; sys_platform == 'linux' ``` or ``` foo==1.0.0 ``` depending on the iteration order, as the first one is from the marker proxy package and the second one from the package without marker. The fix correctly merges graph entries when there are two nodes with different extras and different markers. I tried to write a packse test but it failed due to a different iteration order showing the correct case directly instead of the failing one we'd need. Only `strip_extras` is affected, since `combine_extras` uses `version_marker`.
This commit is contained in:
parent
cfd1e670dd
commit
5493deff65
2 changed files with 43 additions and 1 deletions
|
@ -404,6 +404,13 @@ fn strip_extras<'dist>(graph: &IntermediatePetGraph<'dist>) -> RequirementsTxtGr
|
|||
let index = *entry.get();
|
||||
let node: &mut RequirementsTxtDist = &mut next[index];
|
||||
node.extras.clear();
|
||||
// Consider:
|
||||
// ```
|
||||
// foo[bar]==1.0.0; sys_platform == 'linux'
|
||||
// foo==1.0.0; sys_platform != 'linux'
|
||||
// ```
|
||||
// In this case, we want to write `foo==1.0.0; sys_platform == 'linux' or sys_platform == 'windows'`
|
||||
node.markers.or(dist.markers);
|
||||
}
|
||||
std::collections::hash_map::Entry::Vacant(entry) => {
|
||||
let index = next.add_node(dist.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue