a Re @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.)r SpecifierSetrparsejoinmapstr)rrrequires_python_specifierpython_versionr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/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. METADATAzPKG-INFOzNo metadata found in %sN) isinstancerDistInfoDistribution has_metadata get_metadataloggerwarningr locationr rfeedclose)r metadata_namemetadata feed_parserrrrr")s     r"cCs2|dr.|dD]}|r|SqdS)N INSTALLERr)r!get_metadata_linesstrip)rlinerrr get_installerDs  r/i)maxsize) req_stringrcCst|S)z5Construct a packaging.Requirement object with cachingr )r1rrrget_requirementLsr2)! functoolslogging email.messager email.parserrtypingrr pip._vendorrZpip._vendor.packagingrrZ"pip._vendor.packaging.requirementsr pip._vendor.pkg_resourcesr pip._internal.exceptionsr pip._internal.utils.miscr getLogger__name__r#rintboolrr"r/ lru_cacher2rrrrs$