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