
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
•�abc           @@  s…  d  d l  m Z 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 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 m Z m Z d  d l m Z m Z m Z m Z m Z d  d l m  Z  d  d l! m" Z" d  d	 l# m$ Z$ d  d
 l% m& Z& e$ rud  d l m' Z( n d  d l m( Z( d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ g Z) e	 j* e+ ƒ Z, df Z- dg Z. dh Z/ di Z0 e/ e- e0 e. Z1 e/ e0 Z2 y d  d l3 Z3 e2 e- 7Z2 Wn e4 k
 rPe, j5 d1 ƒ n Xy d  d l6 Z6 e2 e. 7Z2 Wn e4 k
 r‹e, j5 d2 ƒ n Xd3 „  Z7 d4 „  Z8 d5 „  Z9 e& d6 d7 d8 d9 ƒ e: d: „ ƒ Z; d; „  Z< d< „  Z= d= d> „ Z> d? „  Z? d@ „  Z@ dA „  ZA dB „  ZB dC „  ZC dD „  ZD e jE dE „ ZF dF „  ZG dG „  ZH eI dH „ ZJ dI „  ZK dJ „  ZL dK „  ZM dL „  ZN dM „  ZO dN „  ZP dO „  ZQ eI e eI e: e: dP „ ZR dQ „  ZS dR „  ZT dS „  ZU dT „  ZV eI dU „ ZW dV „  ZX dW „  ZY eI d dX d d d dY „ Z[ dZ „  Z\ d[ „  Z] d\ e^ f d] „  ƒ  YZ_ d^ e( f d_ „  ƒ  YZ` e ja d` „  ƒ Zb da „  Zc db e^ f dc „  ƒ  YZd d dd „ Ze de „  Zf d S(j   i    (   t   absolute_import(   t   dequeN(   t   InstallationError(   t   console_to_strt
   expandusert   stdlib_pkgs(   t   site_packagest	   user_sitet   running_under_virtualenvt   virtualenv_no_globalt   write_delete_marker_file(   t   pkg_resources(   t   input(   t   PY2(   t   retry(   t   BytesIO(   t   StringIOt   rmtreet   display_patht
   backup_dirt   askt   splitextt   format_sizet   is_installable_dirt   is_svn_paget   file_contentst   split_leading_dirt   has_leading_dirt   normalize_patht   renamest   get_terminal_sizet   get_progt
   unzip_filet
   untar_filet   unpack_filet   call_subprocesst   captured_stdoutt
   ensure_dirt   ARCHIVE_EXTENSIONSt   SUPPORTED_EXTENSIONSt   get_installed_versions   .tar.bz2s   .tbzs   .tar.xzs   .txzs   .tlzs   .tar.lzs	   .tar.lzmas   .zips   .whls   .tar.gzs   .tgzs   .tars   bz2 module is not availables   lzma module is not availablec         O@  s5   y t  |  ƒ SWn  t k
 r0 | | | Ž  ‚ n Xd  S(   N(   t
   __import__t   ImportError(   t   pkg_or_module_stringt   ExceptionTypet   argst   kwargs(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   import_or_raiseI   s    c         C@  sC   y t  j |  ƒ Wn+ t k
 r> } | j t j k r? ‚  q? n Xd S(   s    os.path.makedirs without EEXIST.N(   t   ost   makedirst   OSErrort   errnot   EEXIST(   t   patht   e(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR%   P   s
    c           C@  sO   y. t  j j t j d ƒ d k r- d t j SWn t t t f k
 rJ n Xd S(   Ni    s   __main__.pys   -cs	   %s -m pipt   pip(   s   __main__.pys   -c(	   R0   R5   t   basenamet   syst   argvt
   executablet   AttributeErrort	   TypeErrort
   IndexError(    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   Y   s    t   stop_max_delayi¸  t
   wait_fixediô  c         C@  s   t  j |  d | d t ƒd  S(   Nt   ignore_errorst   onerror(   t   shutilR   t   rmtree_errorhandler(   t   dirRA   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   c   s    c         C@  sA   t  j | ƒ j t j @r: t  j | t j ƒ |  | ƒ d S‚  d S(   sÑ   On Windows, the files in .svn are read-only, so when rmtree() tries to
    remove them, an exception is thrown.  We catch that here, remove the
    read-only attribute, and hopefully continue without problems.N(   R0   t   statt   st_modet   S_IREADt   chmodt   S_IWRITE(   t   funcR5   t   exc_info(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyRD   i   s
    
c         C@  s¤   t  j j t  j j |  ƒ ƒ }  t j d d k rd |  j t j ƒ  d ƒ }  |  j t j	 ƒ  d ƒ }  n  |  j
 t  j ƒ  t  j j ƒ r  d |  t t  j ƒ  ƒ }  n  |  S(   sT   Gives the display value for a given path, making it relative to cwd
    if possible.i    i   t   replacet   .(   R0   R5   t   normcaset   abspathR9   t   version_infot   decodet   getfilesystemencodingt   encodet   getdefaultencodingt
   startswitht   getcwdt   sept   len(   R5   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   x   s    s   .bakc         C@  sK   d } | } x4 t  j j |  | ƒ rB | d 7} | t | ƒ } q W|  | S(   s\   Figure out the name of a directory to back up the given dir to
    (adding .bak, .bak2, etc)i   (   R0   R5   t   existst   str(   RE   t   extt   nt	   extension(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   „   s    
c         C@  sC   x3 t  j j d d ƒ j ƒ  D] } | | k r | Sq Wt |  | ƒ S(   Nt   PIP_EXISTS_ACTIONt    (   R0   t   environt   gett   splitR   (   t   messaget   optionst   action(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   ask_path_exists�   s    "c         C@  sy   xr t  j j d ƒ r( t d |  ƒ ‚ n  t |  ƒ } | j ƒ  j ƒ  } | | k rm d | d j | ƒ f GHq | Sq Wd S(   s@   Ask the message interactively, with the given possible responsest   PIP_NO_INPUTs7   No input was expected ($PIP_NO_INPUT set); question: %ss<   Your response (%r) was not one of the expected responses: %ss   , N(   R0   Ra   Rb   t	   ExceptionR   t   stript   lowert   join(   Rd   Re   t   response(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   –   s    c         C@  sX   |  d k r d |  d d S|  d	 k r4 d |  d S|  d k rL d |  d Sd |  Sd  S(
   Niè  s   %.1fMBg     @�@i
   s   %ikBs   %.1fkBs   %ibytesi@B i'  (    (   t   bytes(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   ©   s    c         C@  sE   t  j j |  ƒ s t St  j j |  d ƒ } t  j j | ƒ rA t St S(   s@   Return True if `path` is a directory containing a setup.py file.s   setup.py(   R0   R5   t   isdirt   FalseRl   t   isfilet   True(   R5   t   setup_py(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   ´   s    c         C@  s(   t  j d |  ƒ o' t  j d |  t  j ƒ S(   sT   
    Returns true if the page appears to be the index page of an svn repository
    s   <title>[^<]*Revision \d+:s#   Powered by (?:<a[^>]*?>)?Subversion(   t   ret   searcht   I(   t   html(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   ¾   s    c         C@  s/   t  |  d ƒ � } | j ƒ  j d ƒ SWd  QXd  S(   Nt   rbs   utf-8(   t   opent   readRR   (   t   filenamet   fp(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   Æ   s    c         c@  s/   x( t  r* |  j | ƒ } | s" Pn  | Vq Wd S(   s7   Yield pieces of data from a file-like object until EOF.N(   Rr   Rz   (   t   filet   sizet   chunk(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   read_chunksË   s
    	c         C@  s”   |  j  d ƒ j  d ƒ }  d |  k rj d |  k rN |  j d ƒ |  j d ƒ k  sZ d |  k rj |  j d d ƒ Sd |  k r† |  j d d ƒ S|  d f Sd  S(   Nt   /s   \i   R`   (   t   lstript   findRc   (   R5   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   Ô   s    6c         C@  s\   d } xO |  D]G } t | ƒ \ } } | s/ t S| d k rD | } q | | k r t Sq Wt S(   sy   Returns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)N(   t   NoneR   Rp   Rr   (   t   pathst   common_prefixR5   t   prefixt   rest(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   ß   s    	c         C@  sI   t  |  ƒ }  | r' t j j |  ƒ }  n t j j |  ƒ }  t j j |  ƒ S(   sN   
    Convert a path to its canonical, case-normalized, absolute version.

    (   R   R0   R5   t   realpathRP   RO   (   R5   t   resolve_symlinks(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   î   s
    c         C@  sO   t  j |  ƒ \ } } | j ƒ  j d ƒ rE | d | } | d  } n  | | f S(   s,   Like os.path.splitext, but take off .tar toos   .tariüÿÿÿ(   t	   posixpathR   Rk   t   endswith(   R5   t   baseR\   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   û   s
    c         C@  s§   t  j j | ƒ \ } } | rG | rG t  j j | ƒ rG t  j | ƒ n  t j |  | ƒ t  j j |  ƒ \ } } | r£ | r£ y t  j | ƒ Wq£ t k
 rŸ q£ Xn  d S(   s7   Like os.renames(), but handles renaming across devices.N(	   R0   R5   Rc   RZ   R1   RC   t   movet
   removedirsR2   (   t   oldt   newt   headt   tail(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR     s    c         C@  s)   t  ƒ  s t St |  ƒ j t t j ƒ ƒ S(   s›   
    Return True if path is within sys.prefix, if we're running in a virtualenv.

    If we're not in a virtualenv, all paths are considered "local."

    (   R   Rr   R   RV   R9   R‡   (   R5   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   is_local  s    	c         C@  s   t  t |  ƒ ƒ S(   s�   
    Return True if given Distribution object is installed locally
    (i.e. within current virtualenv).

    Always True if we're not in a virtualenv.

    (   R”   t   dist_location(   t   dist(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   dist_is_local!  s    c         C@  s%   t  t |  ƒ ƒ } | j t  t ƒ ƒ S(   sF   
    Return True if given Distribution is installed in user site.
    (   R   R•   RV   R   (   R–   t	   norm_path(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   dist_in_usersite,  s    c         C@  s   t  t |  ƒ ƒ j t  t ƒ ƒ S(   se   
    Return True if given Distribution is installed in
    distutils.sysconfig.get_python_lib().
    (   R   R•   RV   R   (   R–   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   dist_in_site_packages4  s    c         C@  sJ   xC t  j D]8 } t j j | |  j d ƒ } t j j | ƒ r
 t Sq
 Wt S(   s$   Is distribution an editable install?s	   .egg-link(   R9   R5   R0   Rl   t   project_nameRq   Rr   Rp   (   R–   t	   path_itemt   egg_link(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   dist_is_editable>  s
    c   
      C@  s¿   |  r t  } n	 d „  } | r* d „  } n	 d „  } | rE d „  } n	 d „  } | r] t } n	 d „  } g  t j D]K }	 | |	 ƒ rp |	 j | k rp | |	 ƒ rp | |	 ƒ rp | |	 ƒ rp |	 ^ qp S(   sï  
    Return a list of installed Distribution objects.

    If ``local_only`` is True (default), only return installations
    local to the current virtualenv, if in a virtualenv.

    ``skip`` argument is an iterable of lower-case project names to
    ignore; defaults to stdlib_pkgs

    If ``editables`` is False, don't report editables.

    If ``editables_only`` is True , only report editables.

    If ``user_only`` is True , only report installations in the user
    site directory.

    c         S@  s   t  S(   N(   Rr   (   t   d(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt
   local_test`  s    c         S@  s   t  S(   N(   Rr   (   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   editable_testd  s    c         S@  s   t  |  ƒ S(   N(   Rž   (   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR¡   g  s    c         S@  s
   t  |  ƒ S(   N(   Rž   (   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   editables_only_testk  s    c         S@  s   t  S(   N(   Rr   (   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR¢   n  s    c         S@  s   t  S(   N(   Rr   (   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt	   user_testt  s    (   R—   R™   R   t   working_sett   key(
   t
   local_onlyt   skipt   include_editablest   editables_onlyt	   user_onlyR    R¡   R¢   R£   RŸ   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   get_installed_distributionsG  s$    						c         C@  s¸   g  } t  ƒ  rN t ƒ  r( | j t ƒ qq | j t ƒ t rq | j t ƒ qq n# t rd | j t ƒ n  | j t ƒ x@ | D]8 } t j j | |  j ƒ d } t j j	 | ƒ rx | Sqx Wd S(   s  
    Return the path for the .egg-link file if it exists, otherwise, None.

    There's 3 scenarios:
    1) not in a virtualenv
       try to find in site.USER_SITE, then site_packages
    2) in a no-global virtualenv
       try to find in site_packages
    3) in a yes-global virtualenv
       try to find in site_packages, then site.USER_SITE
       (don't look in global location)

    For #1 and #3, there could be odd cases, where there's an egg-link in 2
    locations.

    This method will just return the first one found.
    s	   .egg-linkN(
   R   R	   t   appendR   R   R0   R5   Rl   R›   Rq   (   R–   t   sitest   sitet   egglink(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   egg_link_path€  s    		c         C@  s   t  |  ƒ } | r | S|  j S(   sÿ   
    Get the site-packages location of this distribution. Generally
    this is dist.location, except in the case of develop-installed
    packages, where dist.location is the source code location, and we
    want to know where the egg-link file is.

    (   R°   t   location(   R–   R�   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR•   ¥  s    c          C@  sÉ   d „  }  |  d ƒ p* |  d ƒ p* |  d ƒ } | sx y8 t  j t  j ƒ  t  j ƒ } |  | ƒ } t  j | ƒ Wqx qx Xn  | s« t  j j d d ƒ t  j j d d ƒ f } n  t | d ƒ t | d ƒ f S(	   sl   Returns a tuple (x, y) representing the width(x) and the height(x)
    in characters of the terminal window.c         S@  sk   yL d d  l  } d d  l } d d  l } | j d | j |  | j d ƒ ƒ } Wn d  SX| d k rg d  S| S(   Ni    t   hht   1234(   i    i    (   t   fcntlt   termiost   structt   unpackt   ioctlt
   TIOCGWINSZR„   (   t   fdR´   Rµ   R¶   t   cr(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   ioctl_GWINSZ¶  s    i    i   i   t   LINESi   t   COLUMNSiP   (   R0   Ry   t   ctermidt   O_RDONLYt   closeRa   Rb   t   int(   R¼   R»   Rº   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR   ³  s    	$-c          C@  s    t  j d ƒ }  t  j |  ƒ |  S(   sB   Get the current umask which involves having to set it temporarily.i    (   R0   t   umask(   t   mask(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   current_umaskÑ  s    c         C@  s~  t  | ƒ t |  d ƒ } zSt j | d t ƒ} t | j ƒ  ƒ oF | } x| j ƒ  D]} | j } | j	 | ƒ } | }	 | r“ t
 | ƒ d }	 n  t j j | |	 ƒ }	 t j j |	 ƒ }
 |	 j d ƒ sØ |	 j d ƒ rå t  |	 ƒ qV t  |
 ƒ t |	 d ƒ } z | j | ƒ Wd | j ƒ  | j d ?} | rft j | ƒ rf| d	 @rft j |	 d
 t ƒ  d	 Bƒ n  XqV WWd | j ƒ  Xd S(   sŸ  
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    Rx   t
   allowZip64i   R�   s   \t   wbNi   iI   iÿ  (   R%   Ry   t   zipfilet   ZipFileRr   R   t   namelistt   infolistR{   Rz   R   R0   R5   Rl   t   dirnameRŒ   t   writeRÁ   t   external_attrRF   t   S_ISREGRI   RÅ   (   R{   R±   t   flattent   zipfpt   zipt   leadingt   infot   namet   datat   fnRE   R|   t   mode(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR    Ø  s0    	
	

'c         C@  s¨  t  | ƒ |  j ƒ  j d ƒ s4 |  j ƒ  j d ƒ r= d } np |  j ƒ  j t ƒ r[ d } nR |  j ƒ  j t ƒ ry d } n4 |  j ƒ  j d ƒ r— d } n t j d |  ƒ d	 } t j |  | ƒ } z×t	 g  | j
 ƒ  D] } | j d
 k rÒ | j ^ qÒ ƒ } x™| j
 ƒ  D]‹} | j } | d
 k r'qn  | r@t | ƒ d } n  t j j | | ƒ } | j ƒ  rnt  | ƒ q| j ƒ  rÃy | j | | ƒ Wq‘t k
 r¿} t j d |  | j | ƒ qq‘Xqy | j | ƒ }	 Wn5 t t f k
 r} t j d |  | j | ƒ qn Xt  t j j | ƒ ƒ t | d ƒ � }
 t j |	 |
 ƒ Wd QX|	 j ƒ  | j | | ƒ | j d @rt j | d t ƒ  d Bƒ qqWWd | j ƒ  Xd S(   sŸ  
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    s   .gzs   .tgzs   r:gzs   r:bz2s   r:xzs   .tart   rs-   Cannot determine compression type for file %ss   r:*t   pax_global_headeri   s/   In the tar file %s the member %s is invalid: %sRÇ   NiI   iÿ  (   R%   Rk   RŒ   t   BZ2_EXTENSIONSt   XZ_EXTENSIONSt   loggert   warningt   tarfileRy   R   t
   getmembersRÕ   R   R0   R5   Rl   Ro   t   issymt   _extract_memberRi   t   extractfilet   KeyErrorR<   RÌ   RC   t   copyfileobjRÁ   t   utimeRØ   RI   RÅ   (   R{   R±   RØ   t   tart   memberRÓ   R×   R5   t   excR|   t   destfp(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR!     sb    	
*				
!	

&c         C@  s(  t  j j |  ƒ }  | d k sB |  j ƒ  j t ƒ sB t j |  ƒ rb t |  | d |  j d ƒ ƒnÂ | d k sš t	 j
 |  ƒ sš |  j ƒ  j t t t ƒ rª t |  | ƒ nz | rþ | j d ƒ rþ t t |  ƒ ƒ rþ d d l m } | d | j ƒ j | ƒ n& t j d	 |  | | ƒ t d
 | ƒ ‚ d  S(   Ns   application/zipRÐ   s   .whls   application/x-gzips	   text/htmli    (   t
   Subversions   svn+sZ   Cannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formats%   Cannot determine archive format of %s(   R0   R5   R‰   Rk   RŒ   t   ZIP_EXTENSIONSRÈ   t
   is_zipfileR    Rß   t
   is_tarfilet   TAR_EXTENSIONSRÛ   RÜ   R!   RV   R   R   t   pip.vcs.subversionRë   t   urlR·   RÝ   t   criticalR   (   R{   R±   t   content_typet   linkRë   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR"   O  s,    t   raisec         C@  s÷  | r d  } n	 t j } | d  k r£ g  } xd |  D]\ }	 d |	 k sg d |	 k sg d |	 k sg d |	 k r€ d |	 j d d ƒ }	 n  | j |	 ƒ q1 Wd j | ƒ } n  t j d | ƒ t j	 j
 ƒ  }
 | rØ |
 j | ƒ n  y4 t j |  d t j d	 d  d
 | d | d |
 ƒ} Wn) t k
 r7} t j d | | ƒ ‚  n X| d  k	 rÔg  } x‡ t rÐt | j j ƒ  ƒ } | srPn  | j ƒ  } | j | d ƒ t j ƒ  t j k r´t j | ƒ qM| d  k	 rM| j ƒ  qMqMWn  | j ƒ  | d  k	 r| j r| j d ƒ q| j d ƒ n  | j rà| d k r�t j ƒ  t j k rq| rqt j d | ƒ t j d j | ƒ d ƒ n  t d | | j | f ƒ ‚ qà| d k r¸t j d | | j | ƒ qà| d k rÇqàt d t  | ƒ ƒ ‚ n  | sód j | ƒ Sd  S(   Nt    s   
t   "t   's   "%s"s   \"s   Running command %st   stderrt   stdint   stdoutt   cwdt   envs#   Error %s while executing command %st   errort   doneRõ   s    Complete output from command %s:R`   s)   
----------------------------------------s,   Command "%s" failed with error code %s in %st   warns$   Command "%s" had error code %s in %st   ignores   Invalid value: on_returncode=%s(!   R„   t
   subprocesst   PIPERM   R¬   Rl   RÝ   t   debugR0   Ra   t   copyt   updatet   Popent   STDOUTRi   Rò   Rr   R   Rû   t   readlinet   rstript   getEffectiveLevelt   std_loggingt   DEBUGt   spint   waitt
   returncodet   finishRÔ   R   RÞ   t
   ValueErrort   repr(   t   cmdt   show_stdoutRü   t   on_returncodet   command_desct   extra_environt   spinnerRû   t	   cmd_partst   partRý   t   procRé   t
   all_outputt   line(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR#   p  sz    		0	
		
c         C@  s|   t  |  d ƒ � } | j ƒ  } Wd QXd t j t ƒ d g } x9 | D]1 } y | j | ƒ } Wn t k
 rr qC n XPqC W| S(   sR  Return the contents of *filename*.

    Try to decode the file contents with utf-8, the preferred system encoding
    (e.g., cp1252 on some Windows machines), and latin1, in that order.
    Decoding a byte string with latin1 will never raise an error. In the worst
    case, the returned string will contain some garbage characters.

    Rx   Ns   utf-8t   latin1(   Ry   Rz   t   localet   getpreferredencodingRp   RR   t   UnicodeDecodeError(   R{   R|   RÖ   t	   encodingst   enc(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   read_text_fileÒ  s    	c         C@  s   t  j |  ƒ t |  ƒ d  S(   N(   R0   R1   R
   (   t	   build_dir(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   _make_build_dirê  s    t   FakeFilec           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sQ   Wrap a list of lines in an object with readline() to make
    ConfigParser happy.c         C@  s   d „  | Dƒ |  _  d  S(   Nc         s@  s   |  ] } | Vq d  S(   N(    (   t   .0t   l(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pys	   <genexpr>ó  s    (   t   _gen(   t   selft   lines(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   __init__ò  s    c         C@  sL   y3 y t  |  j ƒ SWn t k
 r1 |  j j  ƒ  SXWn t k
 rG d SXd  S(   NR`   (   t   nextR+  t	   NameErrort   StopIteration(   R,  (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR	  õ  s    c         C@  s   |  j  S(   N(   R+  (   R,  (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   __iter__þ  s    (   t   __name__t
   __module__t   __doc__R.  R	  R2  (    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR(  ï  s   			t   StreamWrapperc           B@  s&   e  Z e d  „  ƒ Z e d „  ƒ Z RS(   c         C@  s   | |  _  |  ƒ  S(   N(   t   orig_stream(   t   clsR7  (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   from_stream  s    	c         C@  s
   |  j  j S(   N(   R7  t   encoding(   R,  (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR:  
  s    (   R3  R4  t   classmethodR9  t   propertyR:  (    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR6    s   c         c@  sR   t  t |  ƒ } t t |  t j | ƒ ƒ z t  t |  ƒ VWd t t |  | ƒ Xd S(   sË   Return a context manager used by captured_stdout/stdin/stderr
    that temporarily replaces the sys stream *stream_name* with a StringIO.

    Taken from Lib/support/__init__.py in the CPython repo.
    N(   t   getattrR9   t   setattrR6  R9  (   t   stream_namet   orig_stdout(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   captured_output  s
    c           C@  s
   t  d ƒ S(   sÜ   Capture the output of sys.stdout:

       with captured_stdout() as stdout:
           print('hello')
       self.assertEqual(stdout.getvalue(), 'hello
')

    Taken from Lib/support/__init__.py in the CPython repo.
    Rû   (   RA  (    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR$     s    	t   cached_propertyc           B@  s    e  Z d  Z d „  Z d „  Z RS(   sô   A property that is only computed once per instance and then replaces
       itself with an ordinary attribute. Deleting the attribute resets the
       property.

       Source: https://github.com/bottlepy/bottle/blob/0.11.5/bottle.py#L175
    c         C@  s   t  | d ƒ |  _ | |  _ d  S(   NR5  (   R=  R5  RK   (   R,  RK   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR.  2  s    c         C@  s4   | d  k r |  S|  j | ƒ } | j |  j j <| S(   N(   R„   RK   t   __dict__R3  (   R,  t   objR8  t   value(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   __get__6  s     (   R3  R4  R5  R.  RF  (    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyRB  *  s   	c         C@  s\   t  j j |  ƒ } | d k r- t  j ƒ  } n t  j | ƒ } | j | ƒ } | rX | j Sd S(   sC   Get the installed version of dist_name avoiding pkg_resources cacheN(   R   t   Requirementt   parseR„   t
   WorkingSetRƒ   t   version(   t	   dist_namet   lookup_dirst   reqR¤   R–   (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyR(   >  s    c         C@  s   t  |  d d ƒd S(   s   Consume an iterable at C speed.t   maxleni    N(   R   (   t   iterator(    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   consumeR  s    (   s   .tar.bz2s   .tbz(   s   .tar.xzs   .txzs   .tlzs   .tar.lzs	   .tar.lzma(   s   .zips   .whl(   s   .tar.gzs   .tgzs   .tar(g   t
   __future__R    t   collectionsR   t
   contextlibR3   t   ioR   t   loggingR  Rt   R0   R‹   RC   RF   R  R9   Rß   RÈ   t   pip.exceptionsR   t
   pip.compatR   R   R   t   pip.locationsR   R   R   R	   R
   t   pip._vendorR   t   pip._vendor.six.movesR   t   pip._vendor.sixR   t   pip._vendor.retryingR   R   R   t   __all__t	   getLoggerR3  RÝ   RÛ   RÜ   Rì   Rï   R&   R'   t   bz2R*   R  t   lzmaR/   R%   R   Rp   R   RD   R   R   Rg   R   R   R   R   R   t   DEFAULT_BUFFER_SIZER€   R   R   Rr   R   R   R   R”   R—   R™   Rš   Rž   R«   R°   R•   R   RÅ   R    R!   R"   R„   R#   R%  R'  t   objectR(  R6  t   contextmanagerRA  R$   RB  R(   RP  (    (    (    s6   /usr/lib/python2.7/site-packages/pip/utils/__init__.pyt   <module>   sÎ   (			
				
						
												
		5	%			+	L	!_			