62) -> None:
63 """
64 Check whether the given Python version is compatible with a distribution's
65 "Requires-Python" value.
66
67 :param version_info: A 3-tuple of ints representing the Python
68 major-minor-micro version to check.
69 :param ignore_requires_python: Whether to ignore the "Requires-Python"
70 value if the given Python version isn't compatible.
71
72 :raises UnsupportedPythonVersion: When the given Python version isn't
73 compatible.
74 """
75
76
77
78 try:
80 except FileNotFoundError as e:
81 raise NoneMetadataError(dist, str(e))
82 try:
83 is_compatible = check_requires_python(
84 requires_python,
85 version_info=version_info,
86 )
89 "Package %r has an invalid Requires-Python: %s",
dist.raw_name, exc
90 )
91 return
92
93 if is_compatible:
94 return
95
96 version = ".".join(map(str, version_info))
97 if ignore_requires_python:
99 "Ignoring failed Requires-Python check for package %r: %s not in %r",
101 version,
102 requires_python,
103 )
104 return
105
106 raise UnsupportedPythonVersion(
107 "Package {!r} requires a different Python: {} not in {!r}".format(
109 )
110 )
111
112