

\c           @   s  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 m Z m Z d  d l m Z m Z m Z m Z m Z m Z d  d l m Z m Z m Z 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 d g Z d   Z e d   Z d!   Z  d"   Z! d# d$  Z" d d d%  Z$ d d&  Z% d'   Z& d(   Z' d) e( f d*     YZ) e)   Z* [) e j+ d+ e j,  Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 d0   Z2 d1   Z3 d2   Z4 d3   Z5 d4   Z6 d5   Z7 d6   Z8 d7   Z9 d8   Z: d9   Z; d:   Z< d;   Z= e> dI e> e d?  Z? d@   Z@ dA   ZA dB   ZB e> dC  ZC dD   ZD dE   ZE dF   ZF dG   ZG e> d d e> e jH d d dH  ZI d S(J   iN(   t   InstallationErrort
   BadCommandt   PipError(   t   WindowsErrort   string_typest	   raw_inputt   console_to_strt	   user_sitet   ssl(   t   site_packagest   running_under_virtualenvt   virtualenv_no_global(   t   loggert   rmtreet   display_patht
   backup_dirt   find_commandt   askt   Inft   normalize_namet   splitextt   format_sizet   is_installable_dirt   is_svn_paget   file_contentst   split_leading_dirt   has_leading_dirt   make_path_relativet   normalize_patht   renamest   get_terminal_sizet   get_progt
   unzip_filet
   untar_filet   create_download_cache_foldert   cache_downloadt   unpack_filet   call_subprocessc           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(	   t   ost   patht   basenamet   syst   argvt
   executablet   AttributeErrort	   TypeErrort
   IndexError(    (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    c         C   s   t  j |  d | d t d  S(   Nt   ignore_errorst   onerror(   t   shutilR   t   rmtree_errorhandler(   t   dirR0   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   '   s    c         C   s   | d  \ } } | t  k r/ | j d d k pj | t k rN | j d d k pj | t k oj | j d d k ss   n  t j |  j t j @t j k r   n  t j | t j	  |  |  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.i   i    i   i   i   N(
   R   t   argst   OSErrort   PermissionErrorR'   t   statt   st_modet   S_IREADt   chmodt   S_IWRITE(   t   funcR(   t   exc_infot   exctypet   value(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR3   ,   s    "c         C   s^   t  j j t  j j |    }  |  j t  j   t  j j  rZ d |  t t  j    }  n  |  S(   sT   Gives the display value for a given path, making it relative to cwd
    if possible.t   .(   R'   R(   t   normcaset   abspatht
   startswitht   getcwdt   sept   len(   R(   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   ?   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   (   R'   R(   t   existst   str(   R4   t   extt   nt	   extension(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   H   s    
c         C   sI  | d k r0 t j j d d  j t j  } n  t | t  rK | g } n  | d k rc t   } n  g  | j	   j t j  D] } t
 |  r| | ^ q| } t j j |   d j	   | k r d g } n  xj | D]b } t j j | |   } x. | D]& } | | } t j j |  r | Sq Wt j j |  r | Sq Wt d |    d S(   s<   Searches the PATH for the given command and returns its patht   PATHt    i   s   Cannot find command %rN(   t   NoneR'   t   environt   gett   splitt   pathsept
   isinstanceR   t   get_pathextt   lowerRG   R(   R   t   joint   isfileR   (   t   cmdt   pathst   pathextRJ   R(   t   cmd_patht   cmd_path_ext(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   S   s$    $7"
c         C   sF   |  d k r- t j j d d d d g  }  n  t j j d |   } | S(   s9   Returns the path extensions from environment or a defaults   .COMs   .EXEs   .BATs   .CMDt   PATHEXTN(   RO   R'   RS   RW   RP   RQ   (   t   default_pathextR[   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyRU   n   s    !c         C   s=   x- t  j j d d  D] } | | k r | Sq Wt |  |  S(   Nt   PIP_EXISTS_ACTIONRN   (   R'   RP   RQ   R   (   t   messaget   optionst   action(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   ask_path_existsv   s    c         C   sx   xq t  j j d  r( t d |    n  t |   } | j   j   } | | k rm d | d j |  f GHq | Sq d 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(   R'   RP   RQ   t	   ExceptionR   t   stripRV   RW   (   Ra   Rb   t   response(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   }   s    t   _Infc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s   I am bigger than everything!c         C   s   |  | k r t  St Sd  S(   N(   t   Truet   False(   t   selft   other(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __eq__   s    c         C   s   |  j  |  S(   N(   Rn   (   Rl   Rm   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __ne__   s    c         C   s   t  S(   N(   Rk   (   Rl   Rm   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __lt__   s    c         C   s   t  S(   N(   Rk   (   Rl   Rm   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __le__   s    c         C   s   t  S(   N(   Rj   (   Rl   Rm   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __gt__   s    c         C   s   t  S(   N(   Rj   (   Rl   Rm   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __ge__   s    c         C   s   d S(   NR   (    (   Rl   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   __repr__   s    (
   t   __name__t
   __module__t   __doc__Rn   Ro   Rp   Rq   Rr   Rs   Rt   (    (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyRi      s   						s   [^a-z]c         C   s   t  j d |  j    S(   Nt   -(   t   _normalize_ret   subRV   (   t   name(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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(   R'   R(   t   isdirRk   RW   RX   Rj   (   R(   t   setup_py(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    c         C   s(   t  j d |   o' t  j d |  t  j  S(   sJ   Returns true if the page appears to be the index page of an svn repositorys   <title>[^<]*Revision \d+:s#   Powered by (?:<a[^>]*?>)?Subversion(   t   ret   searcht   I(   t   html(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    c         C   s8   t  |  d  } z | j   j d  SWd  | j   Xd  S(   Nt   rbs   utf-8(   t   opent   readt   decodet   close(   t   filenamet   fp(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    c         C   s   t  |   }  |  j d  j d  }  d |  k rv d |  k rZ |  j d  |  j d  k  sf d |  k rv |  j d d  Sd |  k r |  j d d  S|  d f Sd  S(   Nt   /s   \i   RN   (   RI   t   lstript   findRR   (   R(   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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(   RO   R   Rk   Rj   (   RZ   t   common_prefixR(   t   prefixt   rest(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    	c         C   s7  t  j j |   } t  j j |   }  t  j j t  j j |    }  t  j j t  j j |   } |  j t  j j  j t  j j  } | j t  j j  j t  j j  } x> | r | r | d | d k r | j	 d  | j	 d  q Wd g t
 |  | | g } | d g k r$d t  j j St  j j j |  S(   s  
    Make a filename relative, where the filename path, and it is
    relative to rel_to

        >>> make_relative_path('/usr/share/something/a-file.pth',
        ...                    '/usr/share/another-place/src/Directory')
        '../../../something/a-file.pth'
        >>> make_relative_path('/usr/share/something/a-file.pth',
        ...                    '/home/user/src/Directory')
        '../../../usr/share/something/a-file.pth'
        >>> make_relative_path('/usr/share/a-file.pth', '/usr/share/')
        'a-file.pth'
    i    s   ..RN   RA   (   R'   R(   R)   t   dirnamet   normpathRC   Rg   RF   RR   t   popRG   RW   (   R(   t   rel_tot   path_filenamet
   path_partst   rel_to_partst
   full_parts(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s    $$#c         C   s   t  j j t  j j |    S(   sN   
    Convert a path to its canonical, case-normalized, absolute version.

    (   R'   R(   RB   t   realpath(   R(   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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   RV   t   endswith(   R(   t   baseRJ   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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(	   R'   R(   RR   RH   t   makedirsR2   t   movet
   removedirsR6   (   t   oldt   newt   headt   tail(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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
   Rj   R   RD   R*   R   (   R(   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   dist_is_local;  s    c         C   s-   t  r% t t |    j t t    St Sd S(   sF   
    Return True if given Distribution is installed in user site.
    N(   R   R   R   RD   Rk   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   dist_in_usersiteF  s    c         C   s   t  t |    j t  t   S(   sa   
    Return True if given Distribution is installed in distutils.sysconfig.get_python_lib().
    (   R   R   RD   R	   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   dist_in_site_packagesO  s    c         C   s)   d d l  m } | j |  g   } | j S(   s$   Is distribution an editable install?i(   t   FrozenRequirement(   R&   R   t	   from_distt   editable(   R   R   t   req(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   dist_is_editableV  s    t
   setuptoolsR&   t   pythonc         C   s   |  r t  } n	 d   } | r* d   } n	 d   } | rE d   } n	 d   } g  t j D]? } | |  rX | j | k rX | |  rX | |  rX | ^ qX 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 ('setuptools', 'pip', 'python'). [FIXME also
    skip virtualenv?]

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

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

    c         S   s   t  S(   N(   Rj   (   t   d(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   <lambda>s  s    c         S   s   t  S(   N(   Rj   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   v  s    c         S   s   t  |   S(   N(   R   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   x  s    c         S   s
   t  |   S(   N(   R   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   {  s    c         S   s   t  S(   N(   Rj   (   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR   }  s    (   R   t   pkg_resourcest   working_sett   key(   t
   local_onlyt   skipt   include_editablest   editables_onlyt
   local_testt   editable_testt   editables_only_testR   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   get_installed_distributions]  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   R'   R(   RW   t   project_nameRX   (   R   t   sitest   sitet   egglink(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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   t   egg_link(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.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   s{   yL d d  l  } d d  l } d d  l } | j d | j |  | j d   } Wn d  SX| d k rg d  S| d k rw d  S| S(   Nit   hht   1234i    (   i    i    (   i    i    (   t   fcntlt   termiost   structt   unpackt   ioctlt
   TIOCGWINSZRO   (   t   fdR   R   R   t   cr(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   ioctl_GWINSZ  s    i    i   i   t   LINESi   t   COLUMNSiP   (   R'   R   t   ctermidt   O_RDONLYR   RP   RQ   t   int(   R   R   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR     s    	$-c         C   sm  t  j j |  s" t  j |  n  t |  d  } z*t j |  } t | j    oX | } x | j   D] } | j	 |  } | } | r t
 |  d } n  t  j j | |  } t  j j |  }	 t  j j |	  s t  j |	  n  | j d  s| j d  r(t  j j |  sVt  j |  qVqh t | d  }
 z |
 j |  Wd |
 j   Xqh WWd | j   Xd S(   sM   Unzip the file (zip file located at filename) to the destination
    locationR   i   R   s   \t   wbN(   R'   R(   RH   R   R   t   zipfilet   ZipFileR   t   namelistR   R   RW   R   R   t   writeR   (   R   R   t   flattent   zipfpt   zipt   leadingR{   t   datat   fnR4   R   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR      s.    c      	   C   s  t  j j |  s" t  j |  n  |  j   j d  sL |  j   j d  rU d } nh |  j   j d  s |  j   j d  r d } n5 |  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 r7qn  | rPt |  d } n  t  j j | |  } | j   rt  j j |  st  j |  qq| j   ry | j | |  Wqt j   d } t j d |  | j | f  qqXqy | j |  }	 WnG t t f k
 rOt j   d } t j d |  | j | f  qn Xt  j j t  j j |   st  j t  j j |   n  t	 | d  }
 z t j |	 |
  Wd |
 j   X|	 j   qWWd | j   Xd S(   sI   Untar the file (tar file located at filename) to the destination locations   .gzs   .tgzs   r:gzs   .bz2s   .tbzs   r:bz2s   .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   N(   R'   R(   RH   R   RV   R   R   t   warnt   tarfileR   R   t
   getmembersR{   R   RW   R}   t   issymt   _extract_memberR*   R>   t   extractfilet   KeyErrorR-   R   R2   t   copyfileobjR   (   R   R   t   modet   tart   memberR   R   R(   t   eR   t   destfp(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR!     sd    *	*		!	
c         C   s@   t  j d 8_ t  j d |   t  j d 7_ t j |   d  S(   Ni   s&   Creating supposed download cache at %s(   R   t   indentt   notifyR'   R   (   t   folder(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR"   5  s    c         C   sb   t  j d t |    t j | |   t |  d d  } | j |  | j   t j	 |  d  S(   Ns   Storing download in cache at %ss   .content-typet   w(
   R   R   R   R2   t   copyfileR   R   R   R'   t   unlink(   t   target_filet   temp_locationt   content_typeR   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR#   <  s    
c         C   s"  | d k s9 |  j  d  s9 |  j  d  s9 t j |   rY t |  | d |  j  d  n | d k s t j |   s t |   d j   d k r t |  |  n~ | r | j	 d  r t
 t |    r d d l m } | d | j  j |  n* t j d |  | | f  t d |   d  S(   Ns   application/zips   .zips	   .pybundleR   s   application/x-gzipi   s   .tars   .tar.gzs   .tar.bz2s   .tgzs   .tbzs	   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(   s   .tars   .tar.gzs   .tar.bz2s   .tgzs   .tbz(   R   R   t
   is_zipfileR    R   t
   is_tarfileR   RV   R!   RD   R   R   t   pip.vcs.subversionR   t   urlR   R   t   fatalR    (   R   R   R   t   linkR   (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR$   E  s      	c         C   s  | d  k r g  } xd |  D]\ }	 d |	 k sO d |	 k sO d |	 k sO d |	 k rh d |	 j d d  }	 n  | j |	  q Wd j |  } n  | r d  }
 n	 t j }
 t j | d |  t j	 j
   } | r | j |  n  y4 t j |  d t j d	 d  d
 |
 d | d | } Wn; t k
 rMt j   d } t j d | | f    n Xg  } |
 d  k	 r| j }
 x t |
 j    } | sPn  | j   } | j | d  | r| |  } t | t  r| \ } } n  t j | |  t j |  st j   qqlt j |  qln! | j   \ } } | p2d g } | j   | j r| r| rt j d |  t j d j |  d  n  t d | | j | f   qt j  d | | j | f  n  |
 d  k	 rd j |  Sd  S(   Nt    s   
t   "t   's   "%s"s   \"s   Running command %st   stderrt   stdint   stdoutt   cwdt   envi   s#   Error %s while executing command %sRN   s    Complete output from command %s:s)   
----------------------------------------s*   Command %s failed with error code %s in %ss"   Command %s had error code %s in %s(!   RO   t   replaceR   RW   t
   subprocesst   PIPER   t   logR'   RP   t   copyt   updatet   Popent   STDOUTRf   R*   R>   R   R  R   t   readlinet   rstripRT   t   tuplet   stdout_level_matchest   show_progresst   infot   communicatet   waitt
   returncodeR   R    R   (   RY   t   show_stdoutt   filter_stdoutR  t   raise_on_returncodet   command_levelt   command_desct   extra_environt	   cmd_partst   partR  R  t   procR   t
   all_outputt   linet   levelt   returned_stdoutt   returned_stderr(    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyR%   \  sp    0			
	(   s
   setuptoolss   pips   python(J   R*   R2   R'   R8   R   R   R   R   R   R  t   textwrapt   pip.exceptionsR    R   R   t   pip.backwardcompatR   R   R   R   R   R   t   pip.locationsR	   R
   R   t   pip.logR   t   __all__R   Rk   R   R3   R   R   RO   R   RU   Rd   R   t   objectRi   R   t   compileR   Ry   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   Rj   R   R   R   R   R    R!   R"   R#   R$   t   DEBUGR%   (    (    (    sO   /data/av2000/b2b/venv/lib/python2.7/site-packages/pip-1.3-py2.7.egg/pip/util.pyt   <module>   s   .															
															'	"		 	@					