o ai @sddlZddlZddlmZddlmZddlmZmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZdd lmZeeZd eed eed fdefddZdedefddZdedefddZejdddedefddZ dS)N)Message) FeedParser)OptionalTuple) pkg_resources) specifiersversion Requirement) Distribution)NoneMetadataError) display_pathrequires_python version_info.returncCs4|durdSt|}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-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/utils/packaging.pycheck_requires_pythons  rdistcCsd}t|tjr||r||}n|dr d}||}n tdt|jd}|dur4t ||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|Sq dS)N INSTALLERr)r!get_metadata_linesstrip)rlinerrr get_installerDs  r/i)maxsize req_stringcCst|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.