B
    =)H[+	  ã               @   s~   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	m
Z
 d dlmZ e e¡Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )é    )Úabsolute_importN)Ú
FeedParser)Úpkg_resources)Ú
specifiersÚversion)Ú
exceptionsc          	   C   s>   | dkrdS t  | ¡}t d 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   ÚSpecifierSetr   ÚparseÚjoinÚmapÚstrÚsysÚversion_info)Úrequires_pythonÚrequires_python_specifierÚpython_version© r   ú^C:\Users\HIRONO~1\AppData\Local\Temp\pip-install-qz7kpjmn\pip\pip\_internal\utils\packaging.pyÚcheck_requires_python   s
    

 r   c             C   s8   t | tjƒr |  d¡r |  d¡S |  d¡r4|  d¡S d S )NÚMETADATAzPKG-INFO)Ú
isinstancer   ÚDistInfoDistributionÚhas_metadataÚget_metadata)Údistr   r   r   r   #   s
    


r   c             C   sž   t | ƒ}tƒ }| |¡ | ¡ }| d¡}y8t|ƒs`t d| j|d 	t
ttjd d… ƒ¡f ¡‚W n6 tjk
r˜ } zt d| j||¡ d S d }~X Y 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   ÚfeedÚcloseÚgetr   r   ÚUnsupportedPythonVersionÚproject_namer   r   r   r   r   r   ÚInvalidSpecifierÚloggerÚwarning)r   ÚmetadataÚfeed_parserÚpkg_info_dictr   Úer   r   r   Úcheck_dist_requires_python+   s"    

$r)   c             C   s2   |   d¡r.x"|  d¡D ]}| ¡ r| ¡ S qW dS )NÚ	INSTALLERÚ )r   Úget_metadata_linesÚstrip)r   Úliner   r   r   Úget_installerA   s
    
r/   )Ú
__future__r   Úloggingr   Úemail.parserr   Úpip._vendorr   Úpip._vendor.packagingr   r   Úpip._internalr   Ú	getLoggerÚ__name__r#   r   r   r)   r/   r   r   r   r   Ú<module>   s   
