
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
ÝPf   ã               @   s~   d dl mZ d dlmZ d dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dlmZ ejeƒZdd	„ Zd
d„ Zdd„ ZdS )é    )Úabsolute_import)Ú
FeedParserN)Ú
specifiers)Úversion)Úpkg_resources)Ú
exceptionsc             C   s>   | dkrdS t j| ƒ}tjdjtttjdd… ƒƒƒ}||kS )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   ZSpecifierSetr   ÚparseÚjoinÚmapÚstrÚsysÚversion_info)Úrequires_pythonZrequires_python_specifierZpython_version© r   ú/usr/lib/python3.6/packaging.pyÚcheck_requires_python   s
    

 r   c             C   s8   t | tjƒr | jdƒr | jdƒS | jdƒr4| jdƒS d S )NZMETADATAzPKG-INFO)Ú
isinstancer   ZDistInfoDistributionZhas_metadataÚget_metadata)Údistr   r   r   r   %   s
    


r   c             C   s    t | ƒ}tƒ }|j|ƒ |jƒ }|jdƒ}y8t|ƒs`tjd| j|dj	t
ttjd d… ƒƒf ƒ‚W n8 tjk
rš } ztjd| j||f ƒ d S d }~X nX d S )NzRequires-Pythonz4%s requires Python '%s' but the running Python is %sr   r	   z7Package %s has an invalid Requires-Python entry %s - %s)r   r   ZfeedÚcloseÚgetr   r   ZUnsupportedPythonVersionZproject_namer   r   r   r   r   r   ZInvalidSpecifierÚloggerZwarning)r   ZmetadataZfeed_parserZpkg_info_dictr   Úer   r   r   Úcheck_dist_requires_python-   s"    

$r   )Z
__future__r   Zemail.parserr   Zloggingr   Zpip._vendor.packagingr   r   Zpip._vendorr   Zpipr   Z	getLoggerÚ__name__r   r   r   r   r   r   r   r   Ú<module>   s   
