ó
Ð²Ebc           @@  sø   d  d l  m 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 d  d l m Z d  d l m Z e rÁ d  d	 l m Z d  d
 l m Z m Z d  d l m Z n  e j e ƒ Z d „  Z d „  Z d „  Z d „  Z d S(   i    (   t   absolute_importN(   t
   FeedParser(   t   pkg_resources(   t
   specifierst   version(   t   NoneMetadataError(   t   display_path(   t   MYPY_CHECK_RUNNING(   t   Message(   t   Optionalt   Tuple(   t   Distributionc         C@  sJ   |  d k r t St j |  ƒ } t j d j t t | ƒ ƒ ƒ } | | k S(   s˜  
    Check if the given Python version matches a "Requires-Python" specifier.

    :param version_info: A 3-tuple of ints representing a Python
        major-minor-micro version to check (e.g. `sys.version_info[:3]`).

    :return: `True` if the given Python version satisfies the requirement.
        Otherwise, return `False`.

    :raises InvalidSpecifier: If `requires_python` has an invalid format.
    t   .N(	   t   Nonet   TrueR   t   SpecifierSetR   t   parset   joint   mapt   str(   t   requires_pythont   version_infot   requires_python_specifiert   python_version(    (    s:   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/packaging.pyt   check_requires_python   s
    !c         C@  s½   d } t  |  t j ƒ r9 |  j | ƒ r9 |  j | ƒ } nF |  j d ƒ r` d } |  j | ƒ } n t j d t |  j ƒ ƒ d } | d k r t
 |  | ƒ ‚ n  t ƒ  } | j | ƒ | j ƒ  S(   s   
    :raises NoneMetadataError: if the distribution reports `has_metadata()`
        True but `get_metadata()` returns None.
    t   METADATAs   PKG-INFOs   No metadata found in %st    N(   t
   isinstanceR   t   DistInfoDistributiont   has_metadatat   get_metadatat   loggert   warningR   t   locationR   R   R   t   feedt   close(   t   distt   metadata_namet   metadatat   feed_parser(    (    s:   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/packaging.pyR   -   s    	c         C@  s:   t  |  ƒ } | j d ƒ } | d k	 r6 t | ƒ } n  | S(   s_   
    Return the "Requires-Python" metadata for a distribution, or None
    if not present.
    s   Requires-PythonN(   R   t   getR   R   (   R$   t   pkg_info_dictR   (    (    s:   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/packaging.pyt   get_requires_pythonH   s
    c         C@  sF   |  j  d ƒ rB x0 |  j d ƒ D] } | j ƒ  r | j ƒ  Sq Wn  d S(   Nt	   INSTALLERR   (   R   t   get_metadata_linest   strip(   R$   t   line(    (    s:   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/packaging.pyt   get_installerY   s
    (   t
   __future__R    t   loggingt   email.parserR   t   pip._vendorR   t   pip._vendor.packagingR   R   t   pip._internal.exceptionsR   t   pip._internal.utils.miscR   t   pip._internal.utils.typingR   t   email.messageR   t   typingR	   R
   t   pip._vendor.pkg_resourcesR   t	   getLoggert   __name__R   R   R   R*   R/   (    (    (    s:   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/packaging.pyt   <module>   s    			