ó
~ū^Yc           @@  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   Z d	   Z d
   Z d S(   i    (   t   absolute_import(   t
   FeedParserN(   t
   specifiers(   t   version(   t   pkg_resources(   t
   exceptionsc         C@  sQ   |  d k r t St j |   } t j d j t t t	 j
 d     } | | k S(   sG  
    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.
    t   .i   N(   t   Nonet   TrueR   t   SpecifierSetR   t   parset   joint   mapt   strt   syst   version_info(   t   requires_pythont   requires_python_specifiert   python_version(    (    s0   /tmp/pip-build-QubATO/pip/pip/utils/packaging.pyt   check_requires_python   s
    
(c         C@  sN   t  |  t j  r. |  j d  r. |  j d  S|  j d  rJ |  j d  Sd  S(   Nt   METADATAs   PKG-INFO(   t
   isinstanceR   t   DistInfoDistributiont   has_metadatat   get_metadata(   t   dist(    (    s0   /tmp/pip-build-QubATO/pip/pip/utils/packaging.pyR   %   s
    c      	   C@  sÃ   t  |   } t   } | j |  | j   } | j d  } yK t |  s t j d |  j | d j	 t
 t t j d    f   n  Wn4 t j k
 rū } t j d |  j | | f  d  SXd  S(   Ns   Requires-Pythons4   %s requires Python '%s' but the running Python is %sR   i   s7   Package %s has an invalid Requires-Python entry %s - %s(   R   R   t   feedt   closet   getR   R   t   UnsupportedPythonVersiont   project_nameR   R   R   R   R   R   t   InvalidSpecifiert   loggert   warning(   R   t   metadatat   feed_parsert   pkg_info_dictR   t   e(    (    s0   /tmp/pip-build-QubATO/pip/pip/utils/packaging.pyt   check_dist_requires_python-   s"    	-(   t
   __future__R    t   email.parserR   t   loggingR   t   pip._vendor.packagingR   R   t   pip._vendorR   t   pipR   t	   getLoggert   __name__R    R   R   R&   (    (    (    s0   /tmp/pip-build-QubATO/pip/pip/utils/packaging.pyt   <module>   s   		