(
    dist,  # type: pkg_resources.Distribution
    version_info,  # type: Tuple[int, int, int]
    ignore_requires_python=False,  # type: bool
)
Check whether the given Python version is compatible with a distribution's
    "Requires-Python" value.

    :param version_info: A 3-tuple of ints representing the Python
        major-minor-micro version to check.
    :param ignore_requires_python: Whether to ignore the "Requires-Python"
        value if the given Python version isn't compatible.

    :raises UnsupportedPythonVersion: When the given Python version isn't
        compatible.
Check whether the given Python version is compatible with a distribution's
    "Requires-Python" value.
Check whether the given Python version is compatible with a distribution s Requires - Python value .
def _check_dist_requires_python(
    dist,  # type: pkg_resources.Distribution
    version_info,  # type: Tuple[int, int, int]
    ignore_requires_python=False,  # type: bool
):
    # type: (...) -> None
    """
    Check whether the given Python version is compatible with a distribution's
    "Requires-Python" value.

    :param version_info: A 3-tuple of ints representing the Python
        major-minor-micro version to check.
    :param ignore_requires_python: Whether to ignore the "Requires-Python"
        value if the given Python version isn't compatible.

    :raises UnsupportedPythonVersion: When the given Python version isn't
        compatible.
    """
    requires_python = get_requires_python(dist)
    try:
        is_compatible = check_requires_python(
            requires_python, version_info=version_info,
        )
    except specifiers.InvalidSpecifier as exc:
        logger.warning(
            "Package %r has an invalid Requires-Python: %s",
            dist.project_name, exc,
        )
        return

    if is_compatible:
        return

    version = '.'.join(map(str, version_info))
    if ignore_requires_python:
        logger.debug(
            'Ignoring failed Requires-Python check for package %r: '
            '%s not in %r',
            dist.project_name, version, requires_python,
        )
        return

    raise UnsupportedPythonVersion(
        'Package {!r} requires a different Python: {} not in {!r}'.format(
            dist.project_name, version, requires_python,
        ))
def _check_dist_requires_python ( dist , # type: pkg_resources.Distribution version_info , # type: Tuple[int, int, int] ignore_requires_python = False , # type: bool ) : # type: (...) -> None requires_python = get_requires_python ( dist ) try : is_compatible = check_requires_python ( requires_python , version_info = version_info , ) except specifiers . InvalidSpecifier as exc : logger . warning ( "Package %r has an invalid Requires-Python: %s" , dist . project_name , exc , ) return if is_compatible : return version = '.' . join ( map ( str , version_info ) ) if ignore_requires_python : logger . debug ( 'Ignoring failed Requires-Python check for package %r: ' '%s not in %r' , dist . project_name , version , requires_python , ) return raise UnsupportedPythonVersion ( 'Package {!r} requires a different Python: {} not in {!r}' . format ( dist . project_name , version , requires_python , ) )