|
45 | 45 | from pip._internal.resolution.base import InstallRequirementProvider
|
46 | 46 | from pip._internal.utils.compatibility_tags import get_supported
|
47 | 47 | from pip._internal.utils.hashes import Hashes
|
48 |
| -from pip._internal.utils.packaging import get_requirement, is_pinned |
| 48 | +from pip._internal.utils.packaging import get_requirement |
49 | 49 | from pip._internal.utils.virtualenv import running_under_virtualenv
|
50 | 50 |
|
51 | 51 | from .base import Candidate, CandidateVersion, Constraint, Requirement
|
@@ -303,12 +303,18 @@ def iter_index_candidate_infos() -> Iterator[IndexCandidateInfo]:
|
303 | 303 | # solely satisfied by a yanked release.
|
304 | 304 | all_yanked = all(ican.link.is_yanked for ican in icans)
|
305 | 305 |
|
306 |
| - pinned = is_pinned(specifier) |
| 306 | + def is_pinned(specifier: SpecifierSet) -> bool: |
| 307 | + for sp in specifier: |
| 308 | + if sp.operator == "===": |
| 309 | + return True |
| 310 | + if sp.operator != "==": |
| 311 | + continue |
| 312 | + if sp.version.endswith(".*"): |
| 313 | + continue |
| 314 | + return True |
| 315 | + return False |
307 | 316 |
|
308 |
| - if not template.is_pinned: |
309 |
| - assert template.req, "Candidates found on index must be PEP 508" |
310 |
| - template.req.specifier = specifier |
311 |
| - template.hash_options = hashes.allowed |
| 317 | + pinned = is_pinned(specifier) |
312 | 318 |
|
313 | 319 | # PackageFinder returns earlier versions first, so we reverse.
|
314 | 320 | for ican in reversed(icans):
|
|
0 commit comments