3 ÝPf ã@s~ddlmZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z ej eƒZdd „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Ú.é) rZ SpecifierSetrÚparseÚjoinÚmapÚstrÚsysÚ version_info)Úrequires_pythonZrequires_python_specifierZpython_version©rú/usr/lib/python3.6/packaging.pyÚcheck_requires_pythons   rcCs8t|tjƒr |jdƒr |jdƒS|jdƒr4|jdƒSdS)NZMETADATAzPKG-INFO)Ú isinstancerZDistInfoDistributionZ has_metadataÚ get_metadata)Údistrrrr%s     rcCs t|ƒ}tƒ}|j|ƒ|jƒ}|jdƒ}y8t|ƒs`tjd|j|dj t t t j dd…ƒƒfƒ‚Wn8tjk rš}ztjd|j||fƒdSd}~XnXdS)NzRequires-Pythonz4%s requires Python '%s' but the running Python is %srr z7Package %s has an invalid Requires-Python entry %s - %s)rrZfeedÚcloseÚgetrrZUnsupportedPythonVersionZ project_namer r r rrrZInvalidSpecifierÚloggerZwarning)rZmetadataZ feed_parserZ pkg_info_dictrÚerrrÚcheck_dist_requires_python-s"  $r)Z __future__rZ email.parserrZloggingrZpip._vendor.packagingrrZ pip._vendorrZpiprZ getLoggerÚ__name__rrrrrrrrÚs