Skip to content

Commit

Permalink
solver: use locked version of vcs dependency with extras instead of l…
Browse files Browse the repository at this point in the history
…atest
  • Loading branch information
radoering committed Aug 17, 2022
1 parent d1dbdef commit ae17ac3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/poetry/mixology/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@ def _get_min(dependency: Dependency) -> tuple[bool, int]:
return complete_name

package = None
if dependency.name not in self._use_latest:
# prefer locked version of compatible (not exact same) dependency;
# required in order to not unnecessarily update dependencies with
# extras, e.g. "coverage" vs. "coverage[toml]"
locked = self._get_locked(dependency, allow_similar=True)
if locked is not None:
package = next(
(
Expand Down Expand Up @@ -504,18 +499,18 @@ def _add_incompatibility(self, incompatibility: Incompatibility) -> None:
incompatibility
)

def _get_locked(
self, dependency: Dependency, *, allow_similar: bool = False
) -> DependencyPackage | None:
def _get_locked(self, dependency: Dependency) -> DependencyPackage | None:
if dependency.name in self._use_latest:
return None

locked = self._locked.get(dependency.name, [])
for dependency_package in locked:
package = dependency_package.package
if (
allow_similar or dependency.is_same_package_as(package)
) and dependency.constraint.allows(package.version):
dependency.name == package.name
and dependency.is_same_source_as(package)
and dependency.constraint.allows(package.version)
):
return DependencyPackage(dependency, package)
return None

Expand Down

0 comments on commit ae17ac3

Please sign in to comment.