ó
Ð²Ebc           @   sÄ   d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z d  d l m 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 d	 „  Z d
 „  Z d „  Z d „  Z d S(   iÿÿÿÿN(   t   log(   t   DistutilsError(   t   easy_install(   t   six(   t   Wheeli   (   t   TemporaryDirectoryc         C   s;   t  |  t j ƒ r |  j ƒ  St  |  t t f ƒ s7 t ‚ |  S(   s8   Ensure find-links option end-up being a list of strings.(   t
   isinstanceR   t   string_typest   splitt   tuplet   listt   AssertionError(   t
   find_links(    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pyt   _fixup_find_links   s    
c         C   s  |  j  i d g d 6ƒ } | j d ƒ } | j ƒ  | j d „  |  j d ƒ j ƒ  Dƒ ƒ |  j r¥ |  j } d | k r’ t | d d ƒ | } n  d | f | d <n  |  j ƒ  } t | d d g d	 | d
 t	 d t
 d d d t
 d t
 d t	 d t	 d t
 ƒ
} | j ƒ  | j | ƒ S(   sJ   Fetch an egg needed for building.

    Legacy path using EasyInstall.
    R   t   script_argsc         s   s-   |  ]# \ } } | d k r | | f Vq d S(   R   t	   site_dirst	   index_urlt   optimizet   allow_hostsN(   R   R   R   R   R   R   (    (   t   .0t   kt   v(    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pys	   <genexpr>!   s   	 R   i   t   setupt   argst   xt   install_dirt   exclude_scriptst   always_copyt   build_directoryt   editablet   upgradet   multi_versiont	   no_reportt   userN(   t	   __class__t   get_option_dictt   cleart   updatet   itemst   dependency_linksR   t   get_egg_cache_dirR   t   Truet   Falset   Nonet   ensure_finalized(   t   distt   reqt   tmp_distt   optst   linksR   t   cmd(    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pyt   _legacy_fetch_build_egg   s&    
	

c         C   s[  y t  j d ƒ Wn1 t  j k
 rD |  j d t j ƒ t |  | ƒ SXy t  j d ƒ Wn' t  j k
 r |  j d t j ƒ n Xt | ƒ } |  j d ƒ } d | k r¶ t	 d ƒ ‚ n  d t
 j k sÔ d	 t
 j k rÝ t } n t } d
 t
 j k rû d } n# d | k r| d d } n d } d | k rBt | d d ƒ } n g  } |  j rd| j |  j ƒ n  t
 j j |  j ƒ  ƒ } t  j ƒ  } x6 t  j | ƒ D]% } | | k r˜| j | ƒ r˜| Sq˜Wt ƒ  ‹}	 t j d d d d d d |	 g }
 | r|
 j d ƒ n  | d k	 r&|
 j d | f ƒ n  | d k	 rYx$ | D] } |
 j d | f ƒ q9Wn  | j ru|
 j | j ƒ n |
 j t | ƒ ƒ y t j |
 ƒ Wn( t j  k
 rÃ} t	 t | ƒ ƒ ‚ n Xt! t" j" t
 j j# |	 d ƒ ƒ d ƒ } t
 j j# | | j$ ƒ  ƒ } | j% | ƒ t  j& | t
 j j# | d ƒ ƒ } t  j' j( | d | ƒ}  |  SWd QXd S(   sL   Fetch an egg needed for building.

    Use pip/wheel to fetch/build a wheel.t   pips­   WARNING: The pip package is not available, falling back to EasyInstall for handling setup_requires/test_requires; this is deprecated and will be removed in a future version.t   wheels,   WARNING: The wheel package is not available.R   R   sQ   the `allow-hosts` option is not supported when using pip to install requirements.t	   PIP_QUIETt   PIP_VERBOSEt   PIP_INDEX_URLR   i   R   s   -ms   --disable-pip-version-checks	   --no-depss   -ws   --quiets   --index-urls   --find-linkss   *.whli    s   EGG-INFOt   metadataN()   t   pkg_resourcest   get_distributiont   DistributionNotFoundt   announceR    t   WARNR3   t   strip_markerR#   R   t   ost   environR*   R)   R+   R   R'   t   extendt   patht   realpathR(   t   Environmentt   find_distributionst   can_addR   t   syst
   executablet   appendt   urlt   strt
   subprocesst
   check_callt   CalledProcessErrorR   t   globt   joint   egg_namet   install_as_eggt   PathMetadatat   Distributiont   from_filename(   R-   R.   R0   t   quietR   R   t   eggs_dirt   environmentt   egg_distt   tmpdirR2   t   linkt   eR5   t   dist_locationt   dist_metadata(    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pyt   fetch_build_egg8   sx    
				(	c         C   s%   t  j j t |  ƒ ƒ }  d |  _ |  S(   s«   
    Return a new requirement without the environment marker to avoid
    calling pip with something like `babel; extra == "i18n"`, which
    would always be ignored.
    N(   R:   t   Requirementt   parseRL   R+   t   marker(   R.   (    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pyR?      s    	(   RP   R@   RM   RH   t	   distutilsR    t   distutils.errorsR   R:   t   setuptools.command.easy_installR   t   setuptools.externR   t   setuptools.wheelR   t
   py31compatR   R   R3   R`   R?   (    (    (    s8   /tmp/pip-build-UPPWic/setuptools/setuptools/installer.pyt   <module>   s   		 	U