Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserver marker order at union #383

Merged
merged 1 commit into from
May 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/poetry/core/version/markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,22 @@ def union_simplify(self, other: BaseMarker) -> BaseMarker | None:
return other

elif isinstance(other, MultiMarker):
markers = set(self._markers)
other_markers = set(other.markers)
common_markers = markers & other_markers
unique_markers = markers - common_markers
common_markers = [
marker for marker in self.markers if marker in other.markers
]

unique_markers = [
marker for marker in self.markers if marker not in common_markers
]
if not unique_markers:
return self
other_unique_markers = other_markers - common_markers

other_unique_markers = [
marker for marker in other.markers if marker not in common_markers
]
if not other_unique_markers:
return other

if common_markers:
unique_union = self.of(*unique_markers).union(
self.of(*other_unique_markers)
Expand Down