a [f @sddlZddlZddlmZddlmZddlmZmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZeeZeeeed fed d dZeedddZeedddZejddeedddZ dS)N)Message) FeedParser)OptionalTuple) pkg_resources) specifiersversion Requirement) Distribution)NoneMetadataError) display_path.)requires_python version_inforeturncCs4|dur dSt|}tdtt|}||vS)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.)rZ SpecifierSetrparsejoinmapstr)rrZrequires_python_specifierZpython_versionrA/usr/lib/python3.9/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  r)distrcCsd}t|tjr&||r&||}n0|dr@d}||}ntdt|jd}|durht ||t }| || S)z :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. ZMETADATAzPKG-INFOzNo metadata found in %sN) isinstancerZDistInfoDistribution has_metadata get_metadataloggerZwarningr locationr rZfeedclose)rZ metadata_namemetadataZ feed_parserrrrr)s     rcCs2|dr.|dD]}|r|SqdS)NZ INSTALLERr)rZget_metadata_linesstrip)rlinerrr get_installerDs  r$i)maxsize) req_stringrcCst|S)z5Construct a packaging.Requirement object with cachingr )r&rrrget_requirementLsr')! functoolsZloggingZ email.messagerZ email.parserrtypingrrZ pip._vendorrZpip._vendor.packagingrrZ"pip._vendor.packaging.requirementsr Zpip._vendor.pkg_resourcesr Zpip._internal.exceptionsr Zpip._internal.utils.miscr Z getLogger__name__rrintboolrrr$ lru_cacher'rrrrs$