3 ] @s~ddlmZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z ej eZdd Zd d Zd d ZdS))absolute_import) FeedParserN) specifiers)version) pkg_resources) exceptionscCs>|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_versionr2/tmp/pip-build-8jg9gmni/pip/pip/utils/packaging.pycheck_requires_pythons   rcCs8t|tjr |jdr |jdS|jdr4|jdSdS)NMETADATAzPKG-INFO) isinstancerDistInfoDistribution has_metadata get_metadata)distrrrr%s     rcCst|}t}|j||j}|jd}y8t|s`tjd|j|dj t t t j ddfWn8tjk r}ztjd|j||fdSd}~XnXdS)NzRequires-Pythonz4%s requires Python '%s' but the running Python is %srr z7Package %s has an invalid Requires-Python entry %s - %s)rrfeedclosegetrrUnsupportedPythonVersion project_namer r rrrrInvalidSpecifierloggerwarning)rmetadata feed_parser pkg_info_dictrerrrcheck_dist_requires_python-s"  $r)) __future__r email.parserrloggingrZpip._vendor.packagingrr pip._vendorrpipr getLogger__name__r#rrr)rrrrs