Skip to content

Commit 8b6c950

Browse files
committed
Modifications for mypy
1 parent de0d97e commit 8b6c950

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/pip/_internal/index/package_finder.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -249,18 +249,19 @@ def evaluate_link(self, link: Link) -> tuple[LinkType, str]:
249249
)
250250
if not supports_python:
251251
requires_python = link.requires_python
252-
try:
253-
rp_ver_spec_list = []
254-
for rp_spec in specifiers.SpecifierSet(requires_python):
255-
rp_version = rp_spec.version
256-
if rp_spec.operator == "==" and rp_version.endswith(".*"):
257-
rp_version = rp_version[:-2]
258-
rp_ver_spec_list.append((Version(rp_version), rp_spec))
259-
requires_python = ",".join(
260-
[str(s) for _, s in sorted(rp_ver_spec_list)]
261-
)
262-
except InvalidVersion:
263-
pass
252+
if requires_python:
253+
try:
254+
rp_ver_spec_list = []
255+
for rp_spec in specifiers.SpecifierSet(requires_python):
256+
rp_version = rp_spec.version
257+
if rp_spec.operator == "==" and rp_version.endswith(".*"):
258+
rp_version = rp_version[:-2]
259+
rp_ver_spec_list.append((Version(rp_version), rp_spec))
260+
requires_python = ",".join(
261+
[str(s) for _, s in sorted(rp_ver_spec_list)]
262+
)
263+
except InvalidVersion:
264+
pass
264265
reason = f"{version} Requires-Python {requires_python}"
265266
return (LinkType.requires_python_mismatch, reason)
266267

0 commit comments

Comments
 (0)