pip: implement check for 'requires_python'
@@ -1141,6 +1141,17 @@ class PyPIRepository(PackageRepository):
had_v = False
downloads = self._package_downloads(pkg_data, release)
for download in downloads:
+ requires_python = download.get("requires_python", None)
+ if requires_python is not None:
+ reqs = "python" + requires_python
+ name, ver_spec = VersionSpecifier.parse_requirement(reqs)
+ assert name == "python" # if this if False some large bug happened...
+ if all([op(hit, ver) for op, ver in ver_spec.specs]):
+ # compatible
+ return True
+ else:
+ # fallback
+ # TODO: do we require this?
pv = download.get("python_version", None)
if pv is None:
continue
