ó
.¿”Wc           @   sÒ   d  d l  m Z d  d l m Z d  d l m Z m Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 m Z d  d l m Z m Z m Z d  d l m Z d  d l Z d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   convert_path(   t   log(   t   DistutilsErrort   DistutilsOptionErrorN(   t   six(   t   Distributiont   PathMetadatat   normalize_path(   t   easy_installt   developc           B   s|   e  Z d  Z d Z e j d d g Z e j d g Z e Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z RS(   s   Set up package for developments%   install package in 'development mode't	   uninstallt   us   Uninstall this source packages	   egg-path=s-   Set the path to be used in the .egg-link filec         C   s7   |  j  r t |  _ |  j ƒ  n
 |  j ƒ  |  j ƒ  d  S(   N(   R
   t   Truet   multi_versiont   uninstall_linkt   install_for_developmentt   warn_deprecated_options(   t   self(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyt   run   s
    		
c         C   s5   d  |  _ d  |  _ t j |  ƒ d  |  _ d |  _ d  S(   Nt   .(   t   NoneR
   t   egg_pathR   t   initialize_optionst
   setup_patht   always_copy_from(   R   (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR   %   s
    			c         C   s  |  j  d ƒ } | j rC d } | j | j f } t | | ƒ ‚ n  | j g |  _ t j |  ƒ |  j ƒ  |  j	 ƒ  |  j
 j t j d ƒ ƒ | j d } t j j |  j | ƒ |  _ | j |  _ |  j d  k rê t j j | j ƒ |  _ n  t |  j ƒ } t t j j |  j |  j ƒ ƒ } | | k r9t d | ƒ ‚ n  t | t | t j j | j ƒ ƒ d | j ƒ|  _ |  j j t j d ƒ } | t j k r­d | j d ƒ d	 } n  | |  _ t t j j |  j |  j | ƒ ƒ } | t t j ƒ k rt d
 | t t j ƒ ƒ ‚ n  d  S(   Nt   egg_infos-   Please rename %r to %r before using 'develop's   *.eggs	   .egg-linksA   --egg-path must be a relative path from the install directory to t   project_namet   /s   ../i   sG   Can't get a consistent path to setup script from installation directory(    t   get_finalized_commandt   broken_egg_infoR   R   t   egg_namet   argsR   t   finalize_optionst   expand_basedirst   expand_dirst   package_indext   scant   globt   ost   patht   joint   install_dirt   egg_linkt   egg_baseR   R   t   abspathR   R   R   R   t   distt   replacet   sept   curdirt   countR   (   R   t   eit   templateR   t   egg_link_fnt   targetR   t   p(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR    ,   sF    	

	$c         C   s°  t  j rÛ t |  j d t ƒ rÛ |  j d d d ƒ|  j d ƒ |  j d ƒ } t | j	 ƒ } |  j d d | ƒ|  j d ƒ |  j d d d ƒ|  j d ƒ |  j d ƒ } | |  _
 | |  j _ t | | j ƒ |  j _ n- |  j d ƒ |  j d d d ƒ|  j d ƒ |  j ƒ  t j r7|  j t j ƒ d  t _ n  t j d	 |  j |  j ƒ |  j s’t |  j d
 ƒ " } | j |  j
 d |  j ƒ Wd  QXn  |  j d  |  j |  j ƒ d  S(   Nt   use_2to3t   build_pyt   inplacei    R   R+   t	   build_exti   s   Creating %s (link to %s)t   ws   
(   R   t   PY3t   getattrt   distributiont   Falset   reinitialize_commandt   run_commandR   R   t	   build_libR   R-   t   locationR   R   t	   _providert   install_site_pyt
   setuptoolst   bootstrap_install_fromR   R   R   t   infoR*   R+   t   dry_runt   opent   writeR   t   process_distributiont   no_deps(   R   t   bpy_cmdt
   build_patht   ei_cmdt   f(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR   Z   s2    	
		$c         C   sù   t  j j |  j ƒ r½ t j d |  j |  j ƒ t |  j ƒ } g  | D] } | j ƒ  ^ qD } | j	 ƒ  | |  j
 g |  j
 |  j g f k rž t j d | ƒ d  S|  j s½ t  j |  j ƒ q½ n  |  j sÙ |  j |  j ƒ n  |  j j rõ t j d ƒ n  d  S(   Ns   Removing %s (link to %s)s$   Link points to %s: uninstall aborteds5   Note: you must uninstall or replace scripts manually!(   R&   R'   t   existsR*   R   RH   R+   RJ   t   rstript   closeR   R   t   warnRI   t   unlinkt
   update_pthR-   R>   t   scripts(   R   t   egg_link_filet   linet   contents(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR   ‡   s    
		c         C   s±   | |  j  k	 r t j |  | ƒ S|  j | ƒ x~ |  j j p> g  D]j } t j j t	 | ƒ ƒ } t j j
 | ƒ } t j | ƒ  } | j ƒ  } Wd  QX|  j | | | | ƒ q? Wd  S(   N(   R-   R   t   install_egg_scriptst   install_wrapper_scriptsR>   RX   R&   R'   R,   R    t   basenamet   ioRJ   t   readt   install_script(   R   R-   t   script_namet   script_patht   strmt   script_text(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR\   ™   s    c         C   s   t  | ƒ } t j |  | ƒ S(   N(   t   VersionlessRequirementR   R]   (   R   R-   (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR]   «   s    (   s	   uninstallR   s   Uninstall this source packageN(   s	   egg-path=Ns-   Set the path to be used in the .egg-link file(   t   __name__t
   __module__t   __doc__t   descriptionR   t   user_optionsR   t   boolean_optionsR?   t   command_consumes_argumentsR   R   R    R   R   R\   R]   (    (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyR	      s   
			.	-		Rf   c           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sz  
    Adapt a pkg_resources.Distribution to simply return the project
    name as the 'requirement' so that scripts will work across
    multiple versions.

    >>> dist = Distribution(project_name='foo', version='1.0')
    >>> str(dist.as_requirement())
    'foo==1.0'
    >>> adapted_dist = VersionlessRequirement(dist)
    >>> str(adapted_dist.as_requirement())
    'foo'
    c         C   s   | |  _  d  S(   N(   t   _VersionlessRequirement__dist(   R   R-   (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyt   __init__¾   s    c         C   s   t  |  j | ƒ S(   N(   R=   Rn   (   R   t   name(    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyt   __getattr__Á   s    c         C   s   |  j  S(   N(   R   (   R   (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyt   as_requirementÄ   s    (   Rg   Rh   Ri   Ro   Rq   Rr   (    (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyRf   °   s   		(   t   distutils.utilR    t	   distutilsR   t   distutils.errorsR   R   R&   R%   R_   t   setuptools.externR   t   pkg_resourcesR   R   R   t   setuptools.command.easy_installR   RF   R	   t   objectRf   (    (    (    s>   /tmp/pip-build-Q3rTTP/setuptools/setuptools/command/develop.pyt   <module>   s   ¡