Skip to content

Commit

Permalink
fix: accept local versions as compatible packages
Browse files Browse the repository at this point in the history
related to #1497
  • Loading branch information
frostming committed Nov 7, 2022
1 parent 015a606 commit ea36f3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/1497.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the version diff algorithm of installed packages to consider local versions as compatible.
4 changes: 3 additions & 1 deletion src/pdm/installers/synchronizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def _should_update(self, dist: Distribution, can: Candidate) -> bool:
if is_editable(dist): # only update editable if no_editable is True
return bool(self.no_editable)
else:
return dist.version != can.version
specifier = can.req.as_pinned_version(can.version).specifier
assert specifier is not None
return not specifier.contains(dist.version, prereleases=True)

def compare_with_working_set(self) -> tuple[list[str], list[str], list[str]]:
"""Compares the candidates and return (to_add, to_update, to_remove)"""
Expand Down

0 comments on commit ea36f3b

Please sign in to comment.