
9Vc           @@  s{  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z 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 m Z d  d l m Z m Z d  d l m Z d  d l m Z d  d l Z d  d	 l m Z m Z d  d
 l m Z m Z m  Z  m! Z! d  d l" m# Z# m$ Z$ m% Z% d  d l& m' Z' m( Z( m) Z) m* Z* d  d l+ m, Z, m- Z- m. Z. m/ Z/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 m6 Z6 m7 Z7 m8 Z8 m9 Z9 m: Z: d  d l; m< Z< d  d l= m> Z> d  d l? m@ Z@ d  d lA mB ZB d  d l mC ZC mD ZD d  d lE mF ZF e jG eH  ZI d   ZJ d eK f d     YZL d   ZM d   ZN d   ZO eP d  ZQ d S(   i    (   t   absolute_importN(   t   change_root(   t	   sysconfig(   t
   FeedParser(   t   pkg_resourcest   six(   t	   interpret(   t   configparser(   t
   native_strt   WINDOWS(   t   is_urlt   url_to_patht   path_to_urlt   is_archive_file(   t   InstallationErrort   UninstallationErrort   UnsupportedWheel(   t   bin_pyt   running_under_virtualenvt   PIP_DELETE_MARKER_FILENAMEt   bin_user(   t   display_patht   rmtreet   ask_path_existst
   backup_dirt   is_installable_dirt   dist_in_usersitet   dist_in_site_packagest   egg_link_patht   make_path_relativet   call_subprocesst   read_text_filet   FakeFilet   _make_build_dirt
   ensure_dirt   get_installed_version(   t   RemovedInPip8Warning(   t
   indent_log(   t   UninstallPathSet(   t   vcs(   t   move_wheel_filest   Wheel(   t   Versionc         C@  sO   t  j d |   } d  } | r? | j d  } | j d  } n |  } | | f S(   Ns   ^(.+)(\[[^\]]+\])$i   i   (   t   ret   matcht   Nonet   group(   t   patht   mt   extrast   path_no_extras(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   _strip_extras/   s    t   InstallRequirementc           B@  s  e  Z d% e d% e e d% e d% e d% d% e d   Z e d% d% e d% d% e d   Z e d% e d% d% e d   Z d   Z	 d   Z
 d   Z e d    Z e j d    Z e d    Z d	   Z d
   Z d   Z e d    Z e d    Z d   Z d Z d   Z d   Z d   Z e j d  Z e d    Z d   Z e d  Z e d  Z  d   Z! d   Z" d   Z# d   Z$ d   Z% g  d% d  Z& d   Z' d   Z( d& d   Z) d!   Z* e d"    Z+ d% d#  Z, d$   Z- RS('   c         C@  s9  d |  _  t | t j  r< t j j |  } | j  |  _  n  | |  _ | |  _ | |  _	 | |  _
 | |  _ | d  k r~ i  } n  | |  _ | |  _ | |  _ | |  _ |
 |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ | |  _ d  |  _ d  |  _ t |  _ d  |  _ | r| n i  |  _ |	 |  _ t |  _ | |  _  d  S(   N(    (!   R1   t
   isinstanceR   t   string_typesR   t   Requirementt   parset   reqt
   comes_fromt
   constraintt
   source_dirt   editableR-   t   editable_optionst   _wheel_cachet   linkt   as_eggt   markerst   _egg_info_patht   satisfied_byt   conflicts_witht   _temp_build_dirt   _ideal_global_dirt   updatet   install_succeededt   uninstalledt   Falset   use_user_sitet
   target_dirt   optionst	   pycompilet   preparedt   isolated(   t   selfR9   R:   R<   R=   R@   RA   RH   R>   RO   RB   RQ   RN   t   wheel_cacheR;   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   __init__=   s<    																								c         C@  s   d d l  m } t | |  \ }	 }
 } } |
 j d  rI t |
  } n d  } |  |	 | d | d t d | |
  d | d | d	 | d
 | r | n i  d | } | d  k	 r | | _ n  | S(   Ni    (   t   Links   file:R<   R=   R@   R;   R>   RQ   RN   RS   (   t	   pip.indexRU   t   parse_editablet
   startswithR   R-   t   TrueR1   (   t   clst   editable_reqR:   t   default_vcsRQ   RN   RS   R;   RU   t   namet   urlt   extras_overrideR>   R<   t   res(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   from_editableo   s"    	c         C@  s  d d l  m } t |  r% d } n d } | | k rm | j | d  \ } }	 |	 j   }	 |	 ss d }	 qs n d }	 | j   } d }
 t j j t j j	 |   } d } d } t |  r | |  } n t
 |  \ } } t j j |  rCt j j | k s| j d  rCt |  s.t d |   n  | t |   } nF t |  rt j j |  stt j d |  n  | t |   } n  | rB| j d	 k rt j d
 | j  r| t t j j t j j	 | j     } n  | j r6t | j  } | j   st d | j   n  d | j | j f }
 qH| j  }
 n | }
 | rT| n i  } |  |
 | d | d |	 d | d | d | d | } | rt! j" j# d |  j$ | _$ n  | S(   s   Creates an InstallRequirement from a name, which might be a
        requirement, directory containing 'setup.py', filename, or URL.
        i    (   RU   s   ; t   ;i   t   .s;   Directory %r is not installable. File 'setup.py' not found.sA   Requirement %r looks like a filename, but the file does not existt   files   \.\./s-   %s is not a supported wheel on this platform.s   %s==%sR@   RB   RQ   RN   RS   R;   t   __placeholder__N(%   RV   RU   R
   t   splitt   stripR-   t   osR/   t   normpatht   abspathR3   t   isdirt   sepRX   R   R   R   R   t   isfilet   loggert   warningt   schemeR+   t   searchR^   t   is_wheelR)   t   filenamet	   supportedR   R]   t   versiont   egg_fragmentR   R7   R8   R1   (   RZ   R]   R:   RQ   RN   RS   R;   RU   t
   marker_sepRB   R9   R/   R@   R1   t   pt   wheelR`   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt	   from_line   sh    	!
$-	c         C@  s   |  j  r; t |  j   } |  j rV | d |  j j 7} qV n |  j rP |  j j n d  } |  j d  k	 r | d t |  j j  7} n  |  j r t	 |  j t
 j  r |  j } n |  j j   } | r | d | 7} q n  | S(   Ns    from %ss    in %ss
    (from %s)(   R9   t   strR@   R^   R-   RD   R   t   locationR:   R5   R   R6   t	   from_path(   RR   t   sR:   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   __str__   s    			c         C@  s    d |  j  j t |   |  j f S(   Ns   <%s object: %s editable=%r>(   t	   __class__t   __name__R{   R=   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   __repr__   s    c         C@  s+   |  j  d k r' | j |  |  |  _  n  d S(   s   Ensure that if a link can be found for this, that it is found.

        Note that self.link may still be None - if Upgrade is False and the
        requirement is already installed.
        N(   R@   R-   t   find_requirement(   RR   t   findert   upgrade(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   populate_link   s    c         C@  s   |  j  S(   N(   t   _link(   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR@      s    c         C@  s_   |  j  d  k r | |  _ n@ |  j  j | |  j  |  _ |  j | k r[ t j d |  j  n  d  S(   Ns   Using cached wheel link: %s(   R?   R-   R   t   cached_wheelR]   Rn   t   debug(   RR   R@   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR@      s
    c         C@  s
   |  j  j S(   N(   R9   t	   specifier(   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR   
  s    c         C@  sy   |  j  d  k r d  St |  j   } |  j ru t |  j t j  rL |  j } n |  j j   } | ru | d | 7} qu n  | S(   Ns   ->(   R9   R-   R{   R:   R5   R   R6   R}   (   RR   R~   R:   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR}     s    	c         C@  s   |  j  d  k	 r |  j  S|  j d  k rJ t j d d  |  _  | |  _ |  j  S|  j re |  j j   } n	 |  j } t	 j
 j |  s t j d |  t |  n  t	 j
 j | |  S(   Ns   -builds   pip-s   Creating directory %s(   RF   R-   R9   t   tempfilet   mkdtempt   _ideal_build_dirR=   R]   t   lowerRh   R/   t   existsRn   R   R!   t   join(   RR   t	   build_dirR]   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   build_location  s    			c         C@  s   |  j  d k	 r d S|  j d k	 s( t  |  j s7 t  |  j sF t  |  j } d |  _ |  j |  j  } t j j	 |  r t
 d t |    n  t j d |  t |  t |   t j | |  | |  _ d |  _ | |  _  d |  _ d S(   s  Move self._temp_build_dir to self._ideal_build_dir/self.req.name

        For some requirements (e.g. a path to a directory), the name of the
        package is not available until we run egg_info, so the build_location
        will return a temporary directory and store the _ideal_build_dir.

        This is only called by self.egg_info_path to fix the temporary build
        directory.
        Ns<   A package already exists in %s; please remove it to continues,   Moving package %s from %s to new location %s(   R<   R-   R9   t   AssertionErrorRF   R   R   Rh   R/   R   R   R   Rn   R   t   shutilt   moveRC   (   RR   t   old_locationt   new_location(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   _correct_build_location1  s(    
					c         C@  s#   |  j  d  k r d  St |  j  j  S(   N(   R9   R-   R   t   project_name(   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR]   Q  s    c         C@  s   |  j  s t d |    y d d  l } Wn t k
 rH t d   n Xd } |  j r d |  j k r t j j |  j  |  j d |  } n t j j |  j  |  } t	 j
 r t | t	 j  r | j t j    } n  | S(   Ns   No source dir for %si    sB   setuptools must be installed to install from a source distributions   setup.pyt   subdirectory(   R<   R   t
   setuptoolst   ImportErrorR   R>   Rh   R/   R   R   t   PY2R5   t	   text_typet   encodet   syst   getfilesystemencoding(   RR   R   t
   setup_filet   setup_py(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR   W  s    
c         C@  s  |  j  s t  |  j r4 t j d |  j |  j  n t j d |  j |  j  t   %|  j } | j	 d t
 |  j   } | j	 d t
 |  j   } t j d | g } |  j r | d g 7} n  | d g } |  j r g  } n. t j j |  j  d  } t |  d	 d g } |  j  } |  j rNd
 |  j k rNt j j | |  j d
  } n  t | | d | d t d t j d d Wd  QX|  j st t j |  j   d  t  rd } n d } t j j d j |  j   d | |  j   d g   |  _ |  j    n  d  S(   Ns2   Running setup.py (path:%s) egg_info for package %ss7   Running setup.py (path:%s) egg_info for package from %st   __SETUP_PY__t   __PKG_NAME__s   -cs   --no-user-cfgt   egg_infos   pip-egg-infos
   --egg-baseR   t   cwdt   show_stdoutt   command_levelt   command_descs   python setup.py egg_infoR*   s   ==s   ===t    t   Name(!   R<   R   R]   Rn   R   R   R@   R%   t   _run_setup_pyt   replacet   reprR   t
   executableRQ   R=   Rh   R/   R   R"   R>   R   RK   t   loggingt   DEBUGR9   R5   R   t   parse_versiont   pkg_infoR*   R7   R8   R   (   RR   t   scriptt   base_cmdt   egg_info_cmdt   egg_base_optiont   egg_info_dirR   t   op(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   run_egg_infos  sV    	
				
		
					s  
__file__ = __SETUP_PY__
from setuptools.command import egg_info
import pkg_resources
import os
import tokenize
def replacement_run(self):
    self.mkpath(self.egg_info)
    installer = self.distribution.fetch_build_egg
    for ep in pkg_resources.iter_entry_points('egg_info.writers'):
        # require=False is the change we're making:
        writer = ep.load(require=False)
        if writer:
            writer(self, ep.name, os.path.join(self.egg_info,ep.name))
    self.find_sources()
egg_info.egg_info.run = replacement_run
exec(compile(
    getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),
    __file__,
    'exec'
))
c         C@  sy   |  j  d  k	 r5 |  j  j |  s% d  S|  j  j |  S|  j sD t  |  j |  } t j j	 |  si d  St
 |  } | S(   N(   RD   R-   t   has_metadatat   get_metadataR<   R   t   egg_info_pathRh   R/   R   R   (   RR   Rs   t   data(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   egg_info_data  s    c   	   	   C@  s<  |  j  d  k r&|  j r$ |  j } n t j j |  j d  } t j |  } |  j rg  } xt j |  D]\ } } } x- t	 j
 D]" } | | k r | j |  q q Wx t |  D] } t j j t j j | | d d   s
t j j t j j | | d d   r| j |  q | d k s2| d k r | j |  q q W| j g  | D] } t j j | |  ^ qS qj Wg  | D] } | j d  r| ^ q} n  | st d	 | | f   n  | st d	 | | f   t |  d
 k r| j d d    n  t j j | | d  |  _  n  t j j |  j  |  S(   Ns   pip-egg-infot   bint   pythont   Scriptss
   Python.exet   testt   testss	   .egg-infos$   No files/directories in %s (from %s)i   t   keyc         S@  s8   |  j  t j j  t j j r3 |  j  t j j  p6 d S(   Ni    (   t   countRh   R/   Rl   t   altsep(   t   x(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   <lambda>   s   i    (   RC   R-   R=   R<   Rh   R/   R   t   listdirt   walkR'   t   dirnamest   removet   listR   t   extendt   endswithR   R   t   lent   sort(	   RR   Rs   t   baset	   filenamest   roott   dirst   filest   dirt   f(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR     sB    						*+		c         C@  s]   t    } |  j d  } | s@ t j d t |  j d    n  | j | pO d  | j   S(   Ns   PKG-INFOs   No PKG-INFO file found in %sR   (   R   R   Rn   Ro   R   R   t   feedt   close(   RR   Rx   R   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR     s    	s	   \[(.*?)\]c         C@  s   t  |  j  S(   N(   R#   R]   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   installed_version  s    c         C@  sj   |  j  s t  |  j   d } | |  j k rG t j d |  |  j  n t j d t |  j   | |   d  S(   NRu   s'   Requested %s, but installing version %ss;   Source in %s has version %s, which satisfies requirement %s(	   R<   R   R   R9   Rn   Ro   R   R   R   (   RR   Ru   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   assert_source_matches_version  s    c         C@  s  |  j  s  t j d |  j  d  S|  j s/ t  |  j s> t  |  j  j d k rT d  Sd |  j  j k s| t d |  j  j   |  j s d  S|  j  j j	 d d  \ } } t
 j |  } | r | |  j  j  } | r | j |  j  q| j |  j  n d st d |  j  | f   d  S(   Ns>   Cannot update repository at %s; repository location is unknownRd   t   +s   bad url: %ri   i    s+   Unexpected version control type (in %s): %s(   R@   Rn   R   R<   R=   R   Rp   R^   RH   Rf   R'   t   get_backendt   obtaint   export(   RR   R   t   vc_typeR^   t   backendt   vcs_backend(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   update_editable(  s,    	
(		c         C@  su  |  j    s% t d |  j f   n  |  j p4 |  j } t |  } t |  } d j t j	 | j
   } | j o t j j | j  } t | j d d  } | r| j j d  r| j j |  r| j | j  | j d  r;x| j d  j   D]7 } t j j t j j | j |   }	 | j |	  q Wq| j d  r| j d  rk| j d  }
 n g  }
 x g  | j d  j   D] } | r| |
 k r| ^ qD]M } t j j | j |  }	 | j |	  | j |	 d  | j |	 d	  qWqn| r5t j d
 j |  j  t  | j |  n| j j d  r| j | j  t j j | j  d } t j j t j j | j  d  } | j | d |  n	| rYt  | d  % } t j j! | j"   j#    } Wd QX| | j k st$ d | |  j | j f   | j |  t j j t j j |  d  } | j | | j  n[ | r| j j d  rx@ t% j& j' |  D] }	 | j |	  qWn t( j) d | | j  | j d  rO| j* d  rOxz | j+ d  D]f } t, |  rt- } n t. } | j t j j | |   t/ r| j t j j | |  d  qqWn  | j d  r[t0 j1   } | j2 t3 | j4 d    | j5 d  r[x | j6 d  D] \ } } t, |  rt- } n t. } | j t j j | |   t/ r| j t j j | |  d  | j t j j | |  d  | j t j j | |  d  qqWq[n  | j7 |  | |  _8 d S(   s  
        Uninstall the distribution currently satisfying this requirement.

        Prompts before removing or modifying files unless
        ``auto_confirm`` is True.

        Refuses to delete or modify files outside of ``sys.prefix`` -
        thus uninstallation within a virtual environment can only
        modify that virtual environment, even if the virtualenv is
        linked to global site-packages.

        s.   Cannot uninstall requirement %s, not installeds   {0}.egg-infoR/   s	   .egg-infos   installed-files.txts   top_level.txts   namespace_packages.txts   .pys   .pycs   Uninstalling a distutils installed project ({0}) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.s   .eggi   s   easy-install.pths   ./t   rNs;   Egg-link %s does not match installed location of %s (at %s)s
   .dist-infos)   Not sure how to uninstall: %s - Check: %st   scriptss   .bats   entry_points.txtt   console_scriptss   .exes   .exe.manifests
   -script.py(9   t   check_if_existsR   R]   RD   RE   R&   R   t   formatR   t   to_filenameR   R   Rh   R/   R   t   getattrt	   _providerR-   R   t   addR   R   t
   splitlinesRi   R   R|   t   warningst   warnR$   Rf   t   dirnamet   add_ptht   opent   normcaset   readlineRg   R   t   pipRy   t   uninstallation_pathsRn   R   t   metadata_isdirt   metadata_listdirR   R   R   R	   R   t   SafeConfigParsert   readfpR    t   get_metadata_linest   has_sectiont   itemsR   RJ   (   RR   t   auto_confirmt   distt   paths_to_removet   develop_egg_linkt   develop_egg_link_egg_infot   egg_info_existst   distutils_egg_infot   installed_fileR/   t
   namespacesRx   t   top_level_pkgt   easy_install_eggt   easy_install_ptht   fht   link_pointerR   t   bin_dirt   configR]   t   value(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt	   uninstallE  s    		"		$		*	'c         C@  s0   |  j  r |  j  j   n t j d |  j  d  S(   Ns'   Can't rollback %s, nothing uninstalled.(   RJ   t   rollbackRn   t   errorR   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   rollback_uninstall  s    	c         C@  s0   |  j  r |  j  j   n t j d |  j  d  S(   Ns%   Can't commit %s, nothing uninstalled.(   RJ   t   commitRn   R  R   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   commit_uninstall  s    	c         C@  s  |  j  s t  t } d |  j |  j   d f } t j j | |  } t j j |  rt	 d t
 |  d  } | d k r t } q| d k r t j d t
 |   t j |  q| d k rt |  } t j d t
 |  t
 |   t j | |  qn  | rt j | d t j d	 t } t j j t j j |  j    } xt j |  D] \ }	 }
 } d
 |
 k r|
 j d
  n  xl |
 D]d } t j j |	 |  } |  j | |  } t j |  j d | d  } d | _ | j | d  qWxb | D]Z } | t k rqn  t j j |	 |  } |  j | |  } | j | |  j d |  qWq[W| j   t j d t
 |   n  d  S(   Ns	   %s-%s.zipRu   s/   The file %s exists. (i)gnore, (w)ipe, (b)ackup t   it   wt   bs   Deleting %ss   Backing up %s to %st
   allowZip64s   pip-egg-infot   /i  i   R   s   Saved %s(   R  R  R  i  (    R<   R   RY   R]   R   Rh   R/   R   R   R   R   RK   Rn   Ro   R   R   R   R   t   zipfilet   ZipFilet   ZIP_DEFLATEDR   Rj   R   t   _clean_zip_namet   ZipInfot   external_attrt   writestrR   t   writeR   t   info(   RR   R   t   create_archivet   archive_namet   archive_patht   responset	   dest_filet   zipR   t   dirpathR   R   R   R]   t   zipdirRs   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   archive  sT    			!	#
c         C@  s_   | j  | t j j  s/ t d | | f   | t |  d } | j t j j d  } | S(   Ns$   name %r doesn't start with prefix %ri   R  (   RX   Rh   R/   Rl   R   R   R   (   RR   R]   t   prefix(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR     s
    c         C@  s$   |  j  d  k	 r t |  j   St Sd  S(   N(   RB   R-   t   markers_interpretRY   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   match_markers  s    c         @  s  |  j  r |  j | |  d  S|  j rt t j j |  j  } t j j | |  j  |  j	 |  j d   t
 |  _ d  S| |  j j d g   7} | |  j j d g   7} |  j r t |  d g } n  t j d d  } t j j | d  } zt j g } | j d  | j d	 |  j  | t |  d
 d | g 7} |  j sR| d g 7} n    d  k	 rq| d   g 7} n  |  j r| d g 7} n | d g 7} t   rd t j   } | d t j j t j d d | |  j  g 7} n  t  j! d |  j  t"   " t# | | d |  j d t$ Wd  QXt j j% |  sGt  j& d |  d  St
 |  _ |  j r]d  S  f d   }	 t' |  ] }
 xS |
 D]7 } t j j( |  } | j) d  r|	 |  } PqqWt  j* d |   d  SWd  QXg  } t' |  e }
 x[ |
 D]S } | j+   } t j j, |  r*| t j j- 7} n  | j t. |	 |  |   qWWd  QXt j j | d  } t' | d  ! }
 |
 j/ d j |  d  Wd  QXWd  t j j% |  rt j0 |  n  t1 |  Xd  S(   NR   t   global_optionst   install_optionss   --no-user-cfgs   -records   pip-s   install-record.txts   -cs   import setuptools, tokenize;__file__=%r;exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))t   installs   --records#   --single-version-externally-manageds   --roots	   --compiles   --no-compileR   s   --install-headerst   includet   sites   Running setup.py install for %sR   R   s   Record file %s not foundc         @  s4     d  k s t j j |   r# |  St   |   Sd  S(   N(   R-   Rh   R/   t   isabsR   (   R/   (   R   (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   prepend_root`  s    s	   .egg-infos;   Could not find .egg-info directory in install record for %ss   installed-files.txtR  s   
(2   R=   t   install_editableRr   R   Ry   t   wheel_versionR<   t   check_compatibilityR]   R(   RY   RI   RN   t   getRQ   R   R   R   Rh   R/   R   R   R   t   appendR   RA   R-   RO   R   R   t   get_python_versionR/  Rn   R%  R%   R   RK   R   R   R   R   R   Ro   Rg   Rk   Rl   R   R$  R   R   (   RR   R3  R2  R   Ru   t   temp_locationt   record_filenamet   install_argst
   py_ver_strR8  R   t   linet	   directoryR   t	   new_linesRs   t   inst_files_path(    (   R   s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR4    s    							

			
$c         C@  s+   |  j  d k r$ |  j |  |  _  n  |  j  S(   sA  Ensure that a source_dir is set.

        This will create a temporary build dir if the name of the requirement
        isn't known yet.

        :param parent_dir: The ideal pip parent_dir for the source_dir.
            Generally src_dir for editables and build_dir for sdists.
        :return: self.source_dir
        N(   R<   R-   R   (   RR   t
   parent_dir(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   ensure_has_source_dir  s    
c         C@  s   |  j  rP t j j t j j |  j  t   rP t j d |  j   t |  j   n  d |  _  |  j
 r t j j |  j
  r t |  j
  n  d |  _
 d S(   sV   Remove the source files from this requirement, if they are marked
        for deletions   Removing source in %sN(   R<   Rh   R/   R   R   R   Rn   R   R   R-   RF   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   remove_temporary_source  s    	c         C@  s   t  j d |  j  |  j r2 t |  d g } n  t    |  j } |  j r| d |  j k r| t j	 j
 | |  j d  } n  t t j d d |  j g t |  d d g t |  d | d	 t Wd  QXt |  _ d  S(
   Ns   Running setup.py develop for %ss   --no-user-cfgR   s   -cs   import setuptools, tokenize; __file__=%r; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))t   develops	   --no-depsR   R   (   Rn   R%  R]   RQ   R   R%   R<   R>   Rh   R/   R   R   R   R   R   RK   RY   RI   (   RR   R3  R2  R   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR9    s    	
			*c         C@  s   |  j  d k r t Sy t j |  j   |  _ Wn t j k
 rC t St j k
 r t j |  j  j  } |  j	 r t
 |  r | |  _ q t   r t |  r t d | j | j f   q q | |  _ n Xt S(   s   Find an installed distribution that satisfies or conflicts
        with this requirement, and set self.satisfied_by or
        self.conflicts_with appropriately.
        sV   Will not install to the user site because it will lack sys.path precedence to %s in %sN(   R9   R-   RK   R   t   get_distributionRD   t   DistributionNotFoundt   VersionConflictR   RL   R   RE   R   R   R   R|   RY   (   RR   t   existing_dist(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR     s&    		c         C@  s   |  j  o |  j  j S(   N(   R@   Rr   (   RR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyRr     s    c         C@  sD   t  |  j |  j | d |  j d |  j d | d |  j d |  j d  S(   Nt   usert   homeR   RO   RQ   (   R(   R]   R9   RL   RM   RO   RQ   (   RR   t   wheeldirR   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR(     s    			c         C@  s   |  j  d  j d  } t j j |  } t j | |  } t j j t j j |   d } t j	 t j j |  d | d | S(   sA   Return a pkg_resources.Distribution built from self.egg_info_pathR   R  i    R   t   metadata(
   R   t   rstripRh   R/   R   R   t   PathMetadatat   splitextt   basenamet   Distribution(   RR   R   t   base_dirRR  t	   dist_name(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   get_dist  s    "N(    (.   R   t
   __module__R-   RK   RY   RT   t   classmethodRa   Rz   R   R   R   t   propertyR@   t   setterR   R}   R   R   R]   R   R   R   R   R   R   R+   t   compilet   _requirements_section_reR   R   R   R  R  R  R.  R   R1  R4  RH  RI  R9  R   Rr   R(   RZ  (    (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyR4   ;   sZ   /		P				
			 	O		6					.		l			
c         C@  s.   t  j d |   } | r* | j d  }  n  |  S(   s2   
        Strip req postfix ( -dev, 0.2, etc )
    s   ^(.*?)(?:-dev|-\d.*)$i   (   R+   Rq   R.   (   R9   R,   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   _strip_postfix  s    c         C@  s|   g  |  j  d d  d j  d  D] } | r  | ^ q  } d  } | d d k r[ | d
 } n | d d k rx | d } n  | S(   Nt   #i   i    R  it   tagst   branchest   tagt   branchiit   trunk(   s   tagss   branchess   tags   branch(   Rf   R-   (   R^   Rx   t   partsR9   (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   _build_req_from_url  s    8c         C@  s{   t  j d  } | j |   } | rw t   } xC | D]; } | \ } } | | k re t d |   n  | | | <q4 W| Sd S(   sz   
        This method generates a dictionary of the query string
        parameters contained in a given editable URL.
    s(   [\?#&](?P<name>[^&=]+)=(?P<value>[^&=]+)s   %s option already definedN(   R+   R_  t   findallt   dictt	   ExceptionR-   (   R9   t   regexpt   matchedt   rett   optionR]   R  (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   _build_editable_options  s    	c         C@  st  |  } d } t j d |  } | rE | j d  } | j d  } n | } t j j |  r t j j t j j | d   s t	 d |   n  t
 |  } n  | j   j d  r | r d | t j j d |  j i  f Sd | d i  f Sn  x; t D]3 } | j   j d |  r d	 | | f } Pq q Wd
 | k re| rR| d
 | } qet	 d |    n  | j d
 d  d j   } t j |  sd |  d j g  t j D] } | j d ^ q d }	 t	 |	   n  y t |   }
 Wn) t k
 r} t	 d |  | f   n X|
 s&d |
 k rNt |   } | sXt	 d |    qXn
 |
 d } t |  } | | d |
 f S(   s   Parses an editable requirement into:
        - a requirement name
        - an URL
        - extras
        - editable options
    Accepted requirements:
        svn+http://blahblah@rev#egg=Foobar[baz]&subdirectory=version_subdir
        .[some_extra]
    s   ^(.+)(\[[^\]]+\])$i   i   s   setup.pys;   Directory %r is not installable. File 'setup.py' not found.s   file:Re   s   %s:s   %s+%sR   sb   %s should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+i    s   For --editable=%s only s   , s   +URLs    is currently supporteds*   --editable=%s error in editable options:%st   eggs@   --editable=%s is not the right format; it must have #egg=PackageN(   R-   R+   R,   R.   Rh   R/   Rk   R   R   R   R   R   RX   R   R7   R8   R1   R'   Rf   R   t   backendsR]   Rq  Rl  Ri  Ra  (   R[   R\   R^   R1   R0   t   url_no_extrast   version_controlR   R   t   error_messageRN   t   excR9   t   package(    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyRW   !  sd    !	1
(R   t
   __future__R    R   Rh   R+   R   R   R   R   R  t   distutils.utilR   t	   distutilsR   t   email.parserR   t   pip._vendorR   R   t   pip._vendor.distlib.markersR   R0  t   pip._vendor.six.movesR   t	   pip.wheelR   t
   pip.compatR   R	   t   pip.downloadR
   R   R   R   t   pip.exceptionsR   R   R   t   pip.locationsR   R   R   R   t	   pip.utilsR   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   t   pip.utils.deprecationR$   t   pip.utils.loggingR%   t   pip.req.req_uninstallR&   t   pip.vcsR'   R(   R)   t   pip._vendor.packaging.versionR*   t	   getLoggerR   Rn   R3   t   objectR4   Ra  Ri  Rq  R-   RW   (    (    (    s0   /tmp/pip-build-5Z5nTX/pip/pip/req/req_install.pyt   <module>   sH   ""d	   			