Skip to content

Commit

Permalink
Simplified logic (giving up possibility of early return when no match…
Browse files Browse the repository at this point in the history
…ing version is found)
  • Loading branch information
radoering committed Nov 21, 2021
1 parent c4b54b1 commit e742a8f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/poetry/mixology/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,10 @@ def _get_min(dependency: Dependency) -> Tuple[bool, int]:
# required in order to not unnecessarily update dependencies with
# extras, e.g. "coverage" vs. "coverage[toml]"
locked = self._locked.get(dependency.name, None)
if locked is not None:
for version in packages:
if version.version <= locked.version:
if version.version != locked.version:
version = None
break
if locked is not None:
version = next(
(p for p in packages if p.version == locked.version), None
)
if version is None:
with suppress(IndexError):
version = packages[0]
Expand Down

0 comments on commit e742a8f

Please sign in to comment.