3 (\ @sddlmZddlZddlZddlmZddlmZddlm Z m Z ddl m Z ddl mZddlmZerdd lmZdd lmZdd lmZejeZd d ZddZddZddZdS))absolute_importN) FeedParser) pkg_resources) specifiersversion) exceptions) display_path)MYPY_CHECK_RUNNING)Optional)Message) DistributioncCs>|dkr dStj|}tjdjtttjdd}||kS)aG Check if the python version in use match the `requires_python` specifier. Returns `True` if the version of python in use matches the requirement. Returns `False` if the version of python in use does not matches the requirement. Raises an InvalidSpecifier if `requires_python` have an invalid format. NT.) r SpecifierSetrparsejoinmapstrsys version_info)requires_pythonrequires_python_specifierpython_versionrp/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-build-k1a8l1r5/pip/pip/_internal/utils/packaging.pycheck_requires_pythons   rcCsft|tjr"|jdr"|jd}n,|jdr8|jd}ntjdt|jd}t }|j ||j S)NMETADATAzPKG-INFOzNo metadata found in %s) isinstancerDistInfoDistribution has_metadata get_metadataloggerwarningrlocationrfeedclose)distmetadata feed_parserrrrr!,s      r!cCst|}|jd}y8t|sHtjd|j|djttt j ddfWn4t j k r~}zt jd|j||dSd}~XnXdS)NzRequires-Pythonz4%s requires Python '%s' but the running Python is %sr rz7Package %s has an invalid Requires-Python entry %s - %s)r!getrrUnsupportedPythonVersion project_namerrrrrrInvalidSpecifierr"r#)r' pkg_info_dictrerrrcheck_dist_requires_python<s $ r0cCs2|jdr.x"|jdD]}|jr|jSqWdS)N INSTALLERr)r get_metadata_linesstrip)r'linerrr get_installerOs   r5) __future__rloggingr email.parserr pip._vendorrZpip._vendor.packagingrrZ pip._internalrZpip._internal.utils.miscrZpip._internal.utils.typingr Ztypingr email.messager Zpip._vendor.pkg_resourcesr getLogger__name__r"rr!r0r5rrrrs"