U v_ @sddlmZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZerdd lmZmZdd lmZdd lmZeeZd d ZddZddZddZdS))absolute_importN) FeedParser) pkg_resources) specifiersversion)NoneMetadataError) display_path)MYPY_CHECK_RUNNING)OptionalTuple)Message) DistributioncCs4|dkr dSt|}tdtt|}||kS)a Check if the given Python version matches a "Requires-Python" specifier. :param version_info: A 3-tuple of ints representing a Python major-minor-micro version to check (e.g. `sys.version_info[:3]`). :return: `True` if the given Python version satisfies the requirement. Otherwise, return `False`. :raises InvalidSpecifier: If `requires_python` has an invalid format. NT.)r SpecifierSetrparsejoinmapstr)requires_python version_inforequires_python_specifierpython_versionr/builddir/build/BUILDROOT/alt-python38-pip-20.2.4-1.el7.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  rcCsd}t|tjr&||r&||}n0|dr@d}||}ntdt|jd}|dkrht ||t }| || S)z :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. METADATAzPKG-INFOzNo metadata found in %sN) isinstancerDistInfoDistribution has_metadata get_metadataloggerwarningrlocationrrfeedclose)dist metadata_namemetadata feed_parserrrrr ,s      r cCs&t|}|d}|dk r"t|}|S)z_ Return the "Requires-Python" metadata for a distribution, or None if not present. zRequires-PythonN)r getr)r& pkg_info_dictrrrrget_requires_pythonGs  r,cCs2|dr.|dD]}|r|SqdS)N INSTALLERr)rget_metadata_linesstrip)r&linerrr get_installerXs  r1) __future__rlogging email.parserr pip._vendorrZpip._vendor.packagingrrpip._internal.exceptionsrpip._internal.utils.miscrpip._internal.utils.typingr typingr r email.messager Zpip._vendor.pkg_resourcesr getLogger__name__r!rr r,r1rrrrs