ó
^\kdc           @   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
 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 l 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/ ƒ Z0 d. „  Z1 d/ „  Z2 d0 „  Z3 d1 „  Z4 d2 „  Z5 d3 „  Z6 d4 „  Z7 d5 „  Z8 d6 „  Z9 d7 „  Z: d8 „  Z; d9 „  Z< d: „  Z= d; „  Z> d< „  Z? d= „  Z@ eA dN eA e! dB „ ZB dC „  ZC dD „  ZD dE „  ZE dF „  ZF eA dG „ ZG dH „  ZH dI „  ZI dJ „  ZJ dK „  ZK eA d d eA e jL d d dL „ ZM dM „  ZN d S(O   iÿÿÿÿN(   t   InstallationErrort
   BadCommandt   PipError(   t   WindowsErrort   string_typest	   raw_inputt   console_to_strt	   user_sitet   PermissionError(   t   site_packagest   running_under_virtualenvt   virtualenv_no_global(   t   logger(   t   pkg_resources(   t   versiont   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(    (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR!       s    c         C   s   t  j |  d | d t ƒd  S(   Nt   ignore_errorst   onerror(   t   shutilR   t   rmtree_errorhandler(   t   dirR2   (    (    s/   /var/www/testScraper/venv/build/pip/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   OSErrorR   R)   t   statt   st_modet   S_IREADt   chmodt   S_IWRITE(   t   funcR*   t   exc_infot   exctypet   value(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR5   .   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*   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR   A   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(   R6   t   extt   nt	   extension(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR   J   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   lowerRH   R*   R   t   joint   isfileR   (   t   cmdt   pathst   pathextRK   R*   t   cmd_patht   cmd_path_ext(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR   U   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(   RP   R)   RT   RX   RQ   RR   (   t   default_pathextR\   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyRV   p   s    !c         C   sC   x3 t  j j d d ƒ j ƒ  D] } | | k r | Sq Wt |  | ƒ S(   Nt   PIP_EXISTS_ACTIONRO   (   R)   RQ   RR   RS   R   (   t   messaget   optionst   action(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   ask_path_existsx   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)   RQ   RR   t	   ExceptionR   t   stripRW   RX   (   Rb   Rc   t   response(    (    s/   /var/www/testScraper/venv/build/pip/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(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __eq__�   s    c         C   s   |  j  | ƒ S(   N(   Ro   (   Rm   Rn   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __ne__–   s    c         C   s   t  S(   N(   Rl   (   Rm   Rn   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __lt__™   s    c         C   s   t  S(   N(   Rl   (   Rm   Rn   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __le__œ   s    c         C   s   t  S(   N(   Rk   (   Rm   Rn   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __gt__Ÿ   s    c         C   s   t  S(   N(   Rk   (   Rm   Rn   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __ge__¢   s    c         C   s   d S(   NR   (    (   Rm   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   __repr__¥   s    (
   t   __name__t
   __module__t   __doc__Ro   Rp   Rq   Rr   Rs   Rt   Ru   (    (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyRj   �   s   						s   [^a-z]c         C   s   t  j d |  j ƒ  ƒ S(   Nt   -(   t   _normalize_ret   subRW   (   t   name(    (    s/   /var/www/testScraper/venv/build/pip/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(    (    s/   /var/www/testScraper/venv/build/pip/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   isdirRl   RX   RY   Rk   (   R*   t   setup_py(    (    s/   /var/www/testScraper/venv/build/pip/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(    (    s/   /var/www/testScraper/venv/build/pip/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(    (    s/   /var/www/testScraper/venv/build/pip/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   RO   (   RJ   t   lstript   findRS   (   R*   (    (    s/   /var/www/testScraper/venv/build/pip/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(   RP   R   Rl   Rk   (   R[   t   common_prefixR*   t   prefixt   rest(    (    s/   /var/www/testScraper/venv/build/pip/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   ..RO   RB   (   R)   R*   R+   t   dirnamet   normpathRD   Rh   RG   RS   t   popRH   RX   (   R*   t   rel_tot   path_filenamet
   path_partst   rel_to_partst
   full_parts(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR   ò   s    $$#c         C   s(   t  j j t  j j t  j j |  ƒ ƒ ƒ S(   sN   
    Convert a path to its canonical, case-normalized, absolute version.

    (   R)   R*   RC   t   realpatht
   expanduser(   R*   (    (    s/   /var/www/testScraper/venv/build/pip/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   RW   t   endswith(   R*   t   baseRK   (    (    s/   /var/www/testScraper/venv/build/pip/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*   RS   RI   t   makedirsR4   t   movet
   removedirsR8   (   t   oldt   newt   headt   tail(    (    s/   /var/www/testScraper/venv/build/pip/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
   Rk   R   RE   R,   R�   (   R*   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   is_local1  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(    (    s/   /var/www/testScraper/venv/build/pip/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¦   RE   Rl   (   R§   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   dist_in_usersiteH  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¦   RE   R	   (   R§   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   dist_in_site_packagesQ  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(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   dist_is_editableX  s    t
   setuptoolsR(   t   pythont
   distributec         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(   Rk   (   t   d(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   <lambda>u  s    c         S   s   t  S(   N(   Rk   (   R³   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR´   x  s    c         S   s   t  |  ƒ S(   N(   R¯   (   R³   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR´   z  s    c         S   s
   t  |  ƒ S(   N(   R¯   (   R³   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR´   }  s    c         S   s   t  S(   N(   Rk   (   R³   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR´     s    (   R¨   R   t   working_sett   key(   t
   local_onlyt   skipt   include_editablest   editables_onlyt
   local_testt   editable_testt   editables_only_testR³   (    (    s/   /var/www/testScraper/venv/build/pip/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*   RX   t   project_nameRY   (   R§   t   sitest   sitet   egglink(    (    s/   /var/www/testScraper/venv/build/pip/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(    (    s/   /var/www/testScraper/venv/build/pip/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(   Niÿÿÿÿt   hht   1234i    (   i    i    (   i    i    (   t   fcntlt   termiost   structt   unpackt   ioctlt
   TIOCGWINSZRP   (   t   fdRÉ   RÊ   RË   t   cr(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   ioctl_GWINSZ¼  s    i    i   i   t   LINESi   t   COLUMNSiP   (   R)   R…   t   ctermidt   O_RDONLYRˆ   RQ   RR   t   int(   RÑ   RÐ   RÏ   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR    ¹  s    	$-c          C   s    t  j d ƒ }  t  j |  ƒ |  S(   sB   Get the current umask which involves having to set it temporarily.i    (   R)   t   umask(   t   mask(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   current_umask×  s    c         C   sÀ  t  j j | ƒ s" t  j | ƒ n  t |  d ƒ } z}t j | ƒ } t | j ƒ  ƒ oX | } xO| j	 ƒ  D]A} | j
 } | j | ƒ } | }	 | r¥ t | ƒ d }	 n  t  j j | |	 ƒ }	 t  j j |	 ƒ }
 t  j j |
 ƒ sî t  j |
 ƒ n  |	 j d ƒ s|	 j d ƒ r1t  j j |	 ƒ s©t  j |	 ƒ q©qh t |	 d ƒ } z | j | ƒ Wd | j ƒ  | j d ?} | r¨t j | ƒ r¨| d @r¨t  j |	 d	 t ƒ  d Bƒ n  Xqh 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.
    R„   i   R‹   s   \t   wbNi   iI   iÿ  (   R)   R*   RI   Rž   R…   t   zipfilet   ZipFileR   t   namelistt   infolistR‰   R†   R   RX   R‘   Rœ   t   writeRˆ   t   external_attrR9   t   S_ISREGR<   RÙ   (   R‰   RÅ   t   flattent   zipfpt   zipt   leadingt   infoR|   t   datat   fnR6   RŠ   t   mode(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR"   Þ  s6    		
'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 ƒ  | 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   .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Ú   NiI   iÿ  (   R)   R*   RI   Rž   RW   Rœ   R   t   warnt   tarfileR…   R   t
   getmembersR|   R   RX   R~   t   issymt   _extract_memberR,   R?   t   extractfilet   KeyErrorR/   R‘   R4   t   copyfileobjRˆ   Ré   R<   RÙ   (   R‰   RÅ   Ré   t   tart   memberRå   Rè   R*   t   eRŠ   t   destfp(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR#     sh    	*	*		!	

&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(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR$   W  s    c         C   sU   t  j d t |  ƒ ƒ t j | |  ƒ t |  d d ƒ } | j | ƒ | j ƒ  d  S(   Ns   Storing download in cache at %ss   .content-typet   w(   R   Rù   R   R4   t   copyfileR…   Rß   Rˆ   (   t   target_filet   temp_locationt   content_typeRŠ   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR%   ^  s
    c         C   sC  t  j j |  ƒ }  | d k sZ |  j d ƒ sZ |  j d ƒ sZ |  j d ƒ sZ t j |  ƒ rz 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	   .pybundles   .whlRâ   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	   .pybundles   .whl(   s   .tars   .tar.gzs   .tar.bz2s   .tgzs   .tbz(   R)   R*   R™   Rœ   RÛ   t
   is_zipfileR"   Rí   t
   is_tarfileR   RW   R#   RE   R   R   t   pip.vcs.subversionR   t   urlRÌ   R   t   fatalR    (   R‰   RÅ   Rÿ   t   linkR   (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR&   f  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 %sRO   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(!   RP   t   replaceR¿   RX   t
   subprocesst   PIPER   t   logR)   RQ   t   copyt   updatet   Popent   STDOUTRg   R,   R?   R  R  R   t   readlinet   rstripRU   t   tuplet   stdout_level_matchest   show_progressRæ   t   communicatet   waitt
   returncodeRù   R    Rì   (   RZ   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(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyR'     sp    0			
	c         C   s   t  j |  ƒ } | d k r t St  j | ƒ } t g  | D]@ } t g  | D]' } | t d d d d d g ƒ k ^ qH ƒ ^ q8 ƒ S(   sØ   
    Attempt to determine if this is a pre-release using PEP386/PEP426 rules.

    Will return True if it is a pre-release and False if not. Versions are
    assumed to be a pre-release if they cannot be parsed.
    t   at   bt   ct   rct   devN(   R   t   _suggest_normalized_versionRP   Rk   t   _normalized_keyt   anyt   set(   t   verst
   normalizedt   parsedt   xt   y(    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   is_prereleaseÂ  s
    (   s
   setuptoolss   pips   pythons
   distribute(O   R,   R4   R)   R9   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   pip._vendorR   t   pip._vendor.distlibR   t   __all__R!   Rl   R   R5   R   R   RP   R   RV   Re   R   t   objectRj   R   t   compileR‚   Rz   R   R   R   R   R   R   R   R   R   R   R   R¥   R¨   R©   Rª   R¯   Rk   R¾   RÄ   R¦   R    RÙ   R"   R#   R$   R%   R&   t   DEBUGR'   R;  (    (    (    s/   /var/www/testScraper/venv/build/pip/pip/util.pyt   <module>   s’   .															
															'	"			-	L				?