3 ”ReÛ ã@sºddlmZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZerŒdd lmZmZdd lmZdd lmZejeƒZd d „Zdd„Zdd„Zdd„ZdS)é)Úabsolute_importN)Ú FeedParser)Ú pkg_resources)Ú specifiersÚversion)ÚNoneMetadataError)Ú display_path)ÚMYPY_CHECK_RUNNING)ÚOptionalÚTuple)ÚMessage)Ú DistributioncCs4|dkr dStj|ƒ}tjdjtt|ƒƒƒ}||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Ú SpecifierSetrÚparseÚjoinÚmapÚstr)Úrequires_pythonÚ version_infoÚrequires_python_specifierÚpython_version©rúŒ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/utils/packaging.pyÚcheck_requires_pythons  rcCs€d}t|tjƒr&|j|ƒr&|j|ƒ}n0|jdƒr@d}|j|ƒ}ntjdt|jƒƒd}|dkrht ||ƒ‚t ƒ}|j |ƒ|j ƒS)z� :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. ÚMETADATAzPKG-INFOzNo metadata found in %sÚN) Ú isinstancerÚDistInfoDistributionÚ has_metadataÚ get_metadataÚloggerÚwarningrÚlocationrrÚfeedÚclose)ÚdistÚ metadata_nameÚmetadataÚ feed_parserrrrr ,s       r cCs&t|ƒ}|jdƒ}|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_dictrrrrÚget_requires_pythonGs  r,cCs2|jdƒr.x"|jdƒD]}|jƒr|jƒSqWdS)NÚ INSTALLERr)rÚget_metadata_linesÚstrip)r&ÚlinerrrÚ get_installerXs   r1)Ú __future__rÚloggingÚ email.parserrÚ pip._vendorrZpip._vendor.packagingrrÚpip._internal.exceptionsrÚpip._internal.utils.miscrÚpip._internal.utils.typingr Útypingr r Ú email.messager Zpip._vendor.pkg_resourcesr Ú getLoggerÚ__name__r!rr r,r1rrrrÚs