|
16 | 16 | from .base import Candidate, Constraint, Requirement
|
17 | 17 | from .candidates import REQUIRES_PYTHON_IDENTIFIER
|
18 | 18 | from .factory import Factory
|
| 19 | +from .requirements import ExplicitRequirement |
19 | 20 |
|
20 | 21 | if TYPE_CHECKING:
|
21 | 22 | from pip._vendor.resolvelib.providers import Preference
|
@@ -138,17 +139,19 @@ def get_preference(
|
138 | 139 |
|
139 | 140 | if has_information:
|
140 | 141 | lookups = (r.get_candidate_lookup() for r, _ in information[identifier])
|
141 |
| - candidate, ireqs = zip(*lookups) |
| 142 | + _icandidates, ireqs = zip(*lookups) |
142 | 143 | else:
|
143 |
| - candidate, ireqs = None, () |
| 144 | + _icandidates, ireqs = (), () |
144 | 145 |
|
145 | 146 | operators: list[tuple[str, str]] = [
|
146 | 147 | (specifier.operator, specifier.version)
|
147 | 148 | for specifier_set in (ireq.specifier for ireq in ireqs if ireq)
|
148 | 149 | for specifier in specifier_set
|
149 | 150 | ]
|
150 | 151 |
|
151 |
| - direct = candidate is not None |
| 152 | + direct = any( |
| 153 | + isinstance(r, ExplicitRequirement) for r, _ in information[identifier] |
| 154 | + ) |
152 | 155 | pinned = any(((op[:2] == "==") and ("*" not in ver)) for op, ver in operators)
|
153 | 156 | unfree = bool(operators)
|
154 | 157 | requested_order = self._user_requested.get(identifier, math.inf)
|
|
0 commit comments