Skip to content

Commit

Permalink
Fix Direct Lookup in PipProvider.get_preference
Browse files Browse the repository at this point in the history
  • Loading branch information
notatallshaw committed Sep 21, 2024
1 parent 102d818 commit ab61929
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pip/_internal/resolution/resolvelib/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from pip._vendor.resolvelib.providers import AbstractProvider

from pip._internal.resolution.resolvelib.requirements import ExplicitRequirement

from .base import Candidate, Constraint, Requirement
from .candidates import REQUIRES_PYTHON_IDENTIFIER
from .factory import Factory
Expand Down Expand Up @@ -146,15 +148,15 @@ def get_preference(
lookups = (r.get_candidate_lookup() for r, _ in information[identifier])
candidate, ireqs = zip(*lookups)
else:
candidate, ireqs = None, ()
candidate, ireqs = (None,), ()

operators = [
specifier.operator
for specifier_set in (ireq.specifier for ireq in ireqs if ireq)
for specifier in specifier_set
]

direct = candidate is not None
direct = any(candidate)
pinned = any(op[:2] == "==" for op in operators)
unfree = bool(operators)

Expand Down

0 comments on commit ab61929

Please sign in to comment.