U ÀÒ.eÛ ã@sºddlmZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZerŒdd lmZmZdd lmZdd lmZe e¡Zd d „Zdd„Zdd„Zdd„ZdS)é)Úabsolute_importN)Ú FeedParser)Ú pkg_resources)Ú specifiersÚversion)ÚNoneMetadataError)Ú display_path)ÚMYPY_CHECK_RUNNING)ÚOptionalÚTuple)ÚMessage)Ú DistributioncCs4|dkr dSt |¡}t d tt|ƒ¡¡}||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Ú.)rZ SpecifierSetrÚparseÚjoinÚmapÚstr)Úrequires_pythonÚ version_infoZrequires_python_specifierZpython_version©rúA/usr/lib/python3.8/site-packages/pip/_internal/utils/packaging.pyÚcheck_requires_pythons  rcCs€d}t|tjƒr&| |¡r&| |¡}n0| d¡r@d}| |¡}nt dt|jƒ¡d}|dkrht ||ƒ‚t ƒ}|  |¡|  ¡S)z� :raises NoneMetadataError: if the distribution reports `has_metadata()` True but `get_metadata()` returns None. ZMETADATAzPKG-INFOzNo metadata found in %sÚN) Ú isinstancerZDistInfoDistributionÚ has_metadataÚ get_metadataÚloggerZwarningrÚlocationrrZfeedÚclose)ÚdistZ metadata_nameZmetadataZ feed_parserrrrr,s ÿ     rcCs&t|ƒ}| d¡}|dk r"t|ƒ}|S)z_ Return the "Requires-Python" metadata for a distribution, or None if not present. zRequires-PythonN)rÚgetr)rZ pkg_info_dictrrrrÚget_requires_pythonGs  r!cCs2| d¡r.| d¡D]}| ¡r| ¡SqdS)NZ INSTALLERr)rZget_metadata_linesÚstrip)rÚlinerrrÚ get_installerXs  r$)Z __future__rZloggingZ email.parserrZ pip._vendorrZpip._vendor.packagingrrZpip._internal.exceptionsrZpip._internal.utils.miscrZpip._internal.utils.typingr Útypingr r Z email.messager Zpip._vendor.pkg_resourcesr Z getLoggerÚ__name__rrrr!r$rrrrÚs