
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
•�abc           @   sã  d  d l  Z  d  d l m Z d  d l Z d  d l 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 y d  d l Z Wn e k
 rÍ d Z n Xd  d l Z d  d l Z d  d l Z d  d l Z d  d l Z y d  d l Z Wn e k
 r9d  d l Z n Xd  d l Z d d l m Z d d l m Z m Z m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z- m. Z. m/ Z/ m0 Z0 e
 j1 e2 ƒ Z3 d Z4 e j5 e4 ƒ Z6 d Z7 d	 e7 d
 Z8 e7 d Z9 d Z: d e: d e9 d e4 d e: d e9 d Z; d Z< d e; d e< d e; d Z= e8 d e4 e8 d Z> d e> d Z? d e7 d e? d e= d Z@ e j5 e@ ƒ ZA d e: d e9 d
 ZB e j5 eB ƒ ZC d „  ZD d  „  ZE d! „  ZF d" „  ZG d d d# „ ZH d$ „  ZI d% „  ZJ d& „  ZK e jL d' „  ƒ ZM e jL d( „  ƒ ZN e jL d) d* „ ƒ ZO d+ eP f d, „  ƒ  YZQ d- „  ZR d. eP f d/ „  ƒ  YZS d0 „  ZT d1 eP f d2 „  ƒ  YZU e j5 d3 e jV ƒ ZW d4 „  ZX d d5 „ ZY d6 „  ZZ d7 „  Z[ d8 „  Z\ d9 „  Z] d: „  Z^ e j5 d; e j_ ƒ Z` e j5 d< ƒ Za d d= „ Zb e j5 d> ƒ Zc d? „  Zd d@ „  Ze dA „  Zf dB Zg dC „  Zh dD „  Zi dE eP f dF „  ƒ  YZj dG eP f dH „  ƒ  YZk dI eP f dJ „  ƒ  YZl d€ Zm d en dR „ Zo dS „  Zp d� Zq dZ eP f d[ „  ƒ  YZr e j5 d\ ƒ Zs e j5 d] ƒ Zt e j5 d^ ƒ Zu d_ „  Z d` „  Zv e r´d da l mw Zx my Zy mz Zz db e% j{ f dc „  ƒ  YZ{ dd ex f de „  ƒ  YZw df ew e( f dg „  ƒ  YZ| n  e j} dh  Z~ e~ d‚ k rdj e% j f dk „  ƒ  YZ e rdl e% j€ f dm „  ƒ  YZ€ qn  dn e& j� f do „  ƒ  YZ� e rFdp e& j‚ f dq „  ƒ  YZ‚ n  dr e& jƒ f ds „  ƒ  YZƒ dt „  Z„ du eP f dv „  ƒ  YZ… dw e… f dx „  ƒ  YZ† dy e… f dz „  ƒ  YZ‡ d{ e) f d| „  ƒ  YZˆ d} eP f d~ „  ƒ  YZ‰ d „  ZŠ d S(ƒ   iÿÿÿÿN(   t   deque(   t   iglobi   (   t   DistlibException(   t   string_typest	   text_typet   shutilt	   raw_inputt   StringIOt   cache_from_sourcet   urlopent   urljoint   httplibt	   xmlrpclibt	   splittypet   HTTPHandlert   BaseConfiguratort   valid_identt	   Containert   configparsert   URLErrort   ZipFilet   fsdecodet   unquotes   \s*,\s*s
   (\w|[.-])+s   (\*|:(\*|\w+):|t   )s   \*?s   ([<>=!~]=)|[<>]t   (s   )?\s*(s   )(s   )\s*(s   ))*s   (from\s+(?P<diref>.*))s   \(\s*(?P<c1>t   |s   )\s*\)|(?P<c2>s   \s*)s   )*s   \[\s*(?P<ex>s   )?\s*\]s   (?P<dn>s	   \s*)?(\s*s   )?$s   (?P<op>s   )\s*(?P<vn>c         C   sk  d „  } d  } t j |  ƒ } | rg| j ƒ  } | d } | d pK | d } | d sa d  } n d  } | d j ƒ  } | s– d  } d } | d }	 n{ | d d k r³ d	 | } n  t j | ƒ }
 g  |
 D] } | | ƒ ^ qÉ } d
 | d j g  | D] } d | ^ qô ƒ f }	 | d s$d  } n t j	 | d ƒ } t
 d | d | d | d |	 d |  d | ƒ } n  | S(   Nc         S   s   |  j  ƒ  } | d | d f S(   Nt   opt   vn(   t	   groupdict(   t   mt   d(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_constraintY   s    t   dnt   c1t   c2t   direft    i    s   <>!=s   ~=s   %s (%s)s   , s   %s %st   ext   namet   constraintst   extrast   requirementt   sourcet   url(   t   Nonet   REQUIREMENT_REt   matchR   t   stript   RELOP_IDENT_REt   finditert   joint   COMMA_REt   splitR   (   t   sR   t   resultR   R   R&   t   consR+   t   constrt   rst   iteratort   conR(   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   parse_requirementW   s4    	

	0
	c         C   sõ   d „  } i  } xß | D]× \ } } } t  j j |  | ƒ } x° t | ƒ D]¢ } t  j j | | ƒ }	 x„ t |	 ƒ D]v }
 | |  |
 ƒ } | d k r£ | j | d ƒ qo | | |
 ƒ } | j t  j j d ƒ j d ƒ } | d | | | <qo WqG Wq W| S(   s%   Find destinations for resources filesc         S   sG   |  j  t j j d ƒ }  | j  t j j d ƒ } | t |  ƒ j d ƒ S(   Nt   /(   t   replacet   ost   patht   sept   lent   lstrip(   t   baseR@   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_rel_path   s    R=   N(	   R?   R@   R2   R   R,   t   popR>   RA   t   rstrip(   t   resources_roott   rulesRE   t   destinationsRD   t   suffixt   destt   prefixt   abs_baset   abs_globt   abs_patht   resource_filet   rel_patht   rel_dest(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_resources_dests|   s    	!c          C   s:   t  t d ƒ r t }  n t j t t d t j ƒ k }  |  S(   Nt   real_prefixt   base_prefix(   t   hasattrt   syst   TrueRM   t   getattr(   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   in_venv—   s    	c          C   s7   t  j j t j ƒ }  t |  t ƒ s3 t |  ƒ }  n  |  S(   N(   R?   R@   t   normcaseRX   t
   executablet
   isinstanceR   R   (   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_executable¡   s    
c         C   s„   |  } xw t  r t | ƒ } |  } | r7 | r7 | } n  | r	 | d j ƒ  } | | k r] Pn  | r| d | | |  f } q| q	 q	 W| S(   Ni    s	   %c: %s
%s(   RY   R   t   lower(   t   promptt   allowed_charst   error_promptt   defaultt   pR5   t   c(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   proceed±   s    		c         C   sV   t  | t ƒ r | j ƒ  } n  i  } x+ | D]# } | |  k r+ |  | | | <q+ q+ W| S(   N(   R^   R   R4   (   R   t   keysR6   t   key(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   extract_by_keyÁ   s    c         C   sÔ  t  j d d k r+ t j d ƒ |  ƒ }  n  |  j ƒ  } t | ƒ }  y‰ t j |  ƒ } | d d d } x] | j ƒ  D]O \ } } x@ | j ƒ  D]2 \ } } d | | f } t	 | ƒ }	 |	 | | <q� Wqt W| SWn! t
 k
 rï |  j d d ƒ n Xd „  }
 t j ƒ  } y |
 | |  ƒ WnF t j k
 r^|  j ƒ  t j | ƒ } t | ƒ }  |
 | |  ƒ n Xi  } xh | j ƒ  D]Z } i  | | <} xC | j | ƒ D]2 \ } } d | | f } t	 | ƒ }	 |	 | | <q–WqrW| S(	   Ni    i   s   utf-8t
   extensionss   python.exportst   exportss   %s = %sc         S   s0   t  |  d ƒ r |  j | ƒ n |  j | ƒ d  S(   Nt	   read_file(   RW   Rm   t   readfp(   t   cpt   stream(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   read_streamÞ   s    (   RX   t   version_infot   codecst	   getreadert   readR   t   jsont   loadt   itemst   get_export_entryt	   Exceptiont   seekR   t   ConfigParsert   MissingSectionHeaderErrort   closet   textwrapt   dedentt   sections(   Rp   t   datat   jdataR6   t   groupt   entriest   kt   vR5   t   entryRq   Ro   Ri   R&   t   value(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   read_exportsÊ   s@    	
c         C   sø   t  j d d k r+ t j d ƒ | ƒ } n  t j ƒ  } x­ |  j ƒ  D]Ÿ \ } } | j | ƒ xƒ | j ƒ  D]u } | j	 d  k r‹ | j } n d | j | j	 f } | j rÉ d | d j | j ƒ f } n  | j | | j | ƒ qj WqD W| j | ƒ d  S(   Ni    i   s   utf-8s   %s:%ss   %s [%s]s   , (   RX   Rr   Rs   t	   getwriterR   R|   Rx   t   add_sectiont   valuesRK   R,   RM   t   flagsR2   t   setR&   t   write(   Rl   Rp   Ro   R†   R‡   Rˆ   R5   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   write_exportsù   s    	c          c   s*   t  j ƒ  }  z	 |  VWd  t j |  ƒ Xd  S(   N(   t   tempfilet   mkdtempR   t   rmtree(   t   td(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   tempdir  s    	c         c   s7   t  j ƒ  } z t  j |  ƒ d  VWd  t  j | ƒ Xd  S(   N(   R?   t   getcwdt   chdir(   R   t   cwd(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR˜     s
    	i   c         c   s7   t  j ƒ  } z t  j |  ƒ d  VWd  t  j | ƒ Xd  S(   N(   t   sockett   getdefaulttimeoutt   setdefaulttimeout(   t   secondst   cto(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   socket_timeout  s
    	t   cached_propertyc           B   s   e  Z d  „  Z d d „ Z RS(   c         C   s   | |  _  d  S(   N(   t   func(   t   selfR¡   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __init__)  s    c         C   s<   | d  k r |  S|  j | ƒ } t j | |  j j | ƒ | S(   N(   R,   R¡   t   objectt   __setattr__t   __name__(   R¢   t   objt   clsR‰   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __get__.  s
    N(   R¦   t
   __module__R£   R,   R©   (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR    (  s   	c         C   sµ   t  j d k r |  S|  s |  S|  d d k r@ t d |  ƒ ‚ n  |  d d k rc t d |  ƒ ‚ n  |  j d ƒ } x# t  j | k r— | j t  j ƒ qu W| s¥ t  j St  j j | Œ  S(   sÐ  Return 'pathname' as a name that will work on the native filesystem.

    The path is split on '/' and put back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    R=   i    s   path '%s' cannot be absoluteiÿÿÿÿs   path '%s' cannot end with '/'(   R?   RA   t
   ValueErrorR4   t   curdirt   removeR@   R2   (   t   pathnamet   paths(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   convert_path6  s    
t   FileOperatorc           B   sª   e  Z e d  „ Z d „  Z d „  Z d „  Z e d „ Z d d „ Z
 d „  Z d „  Z d „  Z d	 „  Z d
 „  Z e e d d „ Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s#   | |  _  t ƒ  |  _ |  j ƒ  d  S(   N(   t   dry_runR�   t   ensuredt   _init_record(   R¢   R²   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   R  s    	c         C   s%   t  |  _ t ƒ  |  _ t ƒ  |  _ d  S(   N(   t   Falset   recordR�   t   files_writtent   dirs_created(   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR´   W  s    	c         C   s    |  j  r |  j j | ƒ n  d  S(   N(   R¶   R·   t   add(   R¢   R@   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   record_as_written\  s    	c         C   si   t  j j | ƒ s1 t d t  j j | ƒ ƒ ‚ n  t  j j | ƒ sG t St  j | ƒ j t  j | ƒ j k S(   sÎ  Tell if the target is newer than the source.

        Returns true if 'source' exists and is more recently modified than
        'target', or if 'source' exists and 'target' doesn't.

        Returns false if both exist and 'target' is the same age or younger
        than 'source'. Raise PackagingFileError if 'source' does not exist.

        Note that this test is not very accurate: files created in the same
        second will have the same "age".
        s   file '%r' does not exist(   R?   R@   t   existsR   t   abspathRY   t   statt   st_mtime(   R¢   R*   t   target(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   newer`  s    c         C   sÒ   |  j  t j j | ƒ ƒ t j d | | ƒ |  j sÁ d } | r• t j j | ƒ r` d | } q• t j j	 | ƒ r• t j j
 | ƒ r• d | } q• n  | r® t | d ƒ ‚ n  t j | | ƒ n  |  j | ƒ d S(   s8   Copy a file respecting dry-run and force flags.
        s   Copying %s to %ss   %s is a symlinks   %s is a non-regular files    which would be overwrittenN(   t
   ensure_dirR?   R@   t   dirnamet   loggert   infoR²   R,   t   islinkR»   t   isfileR«   R   t   copyfileRº   (   R¢   t   infilet   outfilet   checkt   msg(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   copy_filet  s    	%c         C   s¡   |  j  t j j | ƒ ƒ t j d | | ƒ |  j s� | d  k rS t | d ƒ } n t	 j | d d | ƒ} z t
 j | | ƒ Wd  | j ƒ  Xn  |  j | ƒ d  S(   Ns   Copying stream %s to %st   wbt   wt   encoding(   RÁ   R?   R@   RÂ   RÃ   RÄ   R²   R,   t   openRs   R   t   copyfileobjR~   Rº   (   R¢   t   instreamRÉ   RÏ   t	   outstream(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   copy_stream…  s    	c         C   s[   |  j  t j j | ƒ ƒ |  j sJ t | d ƒ � } | j | ƒ Wd  QXn  |  j | ƒ d  S(   NRÍ   (   RÁ   R?   R@   RÂ   R²   RÐ   R�   Rº   (   R¢   R@   R‚   t   f(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   write_binary_file”  s
    	c         C   sd   |  j  t j j | ƒ ƒ |  j sS t | d ƒ � } | j | j | ƒ ƒ Wd  QXn  |  j | ƒ d  S(   NRÍ   (	   RÁ   R?   R@   RÂ   R²   RÐ   R�   t   encodeRº   (   R¢   R@   R‚   RÏ   RÕ   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   write_text_file›  s
    	c         C   sž   t  j d k s- t  j d k rš t  j d k rš xj | D]_ } |  j rV t j d | ƒ q4 t  j | ƒ j | B| @} t j d | | ƒ t  j | | ƒ q4 Wn  d  S(   Nt   posixt   javas   changing mode of %ss   changing mode of %s to %o(	   R?   R&   t   _nameR²   RÃ   RÄ   R½   t   st_modet   chmod(   R¢   t   bitst   maskt   filesRÕ   t   mode(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   set_mode¢  s    -	c         C   s   |  j  d d | ƒ S(   Nim  iÿ  (   Râ   (   R5   RÕ   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   <lambda>®  R$   c         C   s¶   t  j j | ƒ } | |  j k r² t  j j | ƒ r² |  j j | ƒ t  j j | ƒ \ } } |  j | ƒ t j	 d | ƒ |  j
 s“ t  j | ƒ n  |  j r² |  j j | ƒ q² n  d  S(   Ns   Creating %s(   R?   R@   R¼   R³   R»   R¹   R4   RÁ   RÃ   RÄ   R²   t   mkdirR¶   R¸   (   R¢   R@   R   RÕ   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRÁ   °  s    "		c         C   s�   t  | | ƒ } t j d | | ƒ |  j s | sD |  j | | ƒ rf | sS d  } qf | t | ƒ } n  t j | | | t	 ƒ n  |  j
 | ƒ | S(   Ns   Byte-compiling %s to %s(   R   RÃ   RÄ   R²   RÀ   R,   RB   t
   py_compilet   compileRY   Rº   (   R¢   R@   t   optimizet   forceRM   t   dpatht   diagpath(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   byte_compile¼  s    		c         C   s  t  j j | ƒ rt  j j | ƒ r‘ t  j j | ƒ r‘ t j d | ƒ |  j s` t j	 | ƒ n  |  j
 r| |  j k rŽ |  j j | ƒ qŽ qqt  j j | ƒ r¬ d } n d } t j d | | ƒ |  j sÞ t  j | ƒ n  |  j
 r| |  j k r|  j j | ƒ qqn  d  S(   Ns   Removing directory tree at %st   linkt   files   Removing %s %s(   R?   R@   R»   t   isdirRÅ   RÃ   t   debugR²   R   R”   R¶   R¸   R­   R·   (   R¢   R@   R5   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   ensure_removedÊ  s"    %					c         C   sj   t  } x] | se t j j | ƒ r: t j | t j ƒ } Pn  t j j | ƒ } | | k r\ Pn  | } q	 W| S(   N(   Rµ   R?   R@   R»   t   accesst   W_OKRÂ   (   R¢   R@   R6   t   parent(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   is_writableß  s    	
c         C   s    |  j  |  j f } |  j ƒ  | S(   sV   
        Commit recorded changes, turn off recording, return
        changes.
        (   R·   R¸   R´   (   R¢   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   commitë  s    
c         C   sÇ   |  j  s¹ x9 t |  j ƒ D]( } t j j | ƒ r t j | ƒ q q Wt |  j d t	 ƒ} x\ | D]Q } t j
 | ƒ } | r¥ t j j | | d ƒ } t j | ƒ n  t j | ƒ qa Wn  |  j ƒ  d  S(   Nt   reversei    (   R²   t   listR·   R?   R@   R»   R­   t   sortedR¸   RY   t   listdirR2   t   rmdirR´   (   R¢   RÕ   t   dirsR   t   flistt   sd(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   rollbackõ  s    	N(   R¦   Rª   Rµ   R£   R´   Rº   RÀ   RY   RÌ   R,   RÔ   RÖ   RØ   Râ   t   set_executable_modeRÁ   Rë   Rð   Rô   Rõ   Rþ   (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR±   Q  s    											
c         C   s‹   |  t  j k r t  j |  } n t |  ƒ } | d  k r@ | } nG | j d ƒ } t | | j d ƒ ƒ } x | D] } t | | ƒ } qn W| S(   Nt   .i    (   RX   t   modulest
   __import__R,   R4   RZ   RF   (   t   module_namet   dotted_patht   modR6   t   partsRe   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   resolve  s    	t   ExportEntryc           B   s;   e  Z d  „  Z e d „  ƒ Z d „  Z d „  Z e j Z RS(   c         C   s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   R&   RM   RK   RŽ   (   R¢   R&   RM   RK   RŽ   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£     s    			c         C   s   t  |  j |  j ƒ S(   N(   R  RM   RK   (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR‰     s    c         C   s    d |  j  |  j |  j |  j f S(   Ns   <ExportEntry %s = %s:%s %s>(   R&   RM   RK   RŽ   (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __repr__!  s    c         C   sd   t  | t ƒ s t } nH |  j | j k o] |  j | j k o] |  j | j k o] |  j | j k } | S(   N(   R^   R  Rµ   R&   RM   RK   RŽ   (   R¢   t   otherR6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __eq__%  s    	(	   R¦   Rª   R£   R    R‰   R	  R  R¤   t   __hash__(    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR    s
   			
sµ   (?P<name>(\w|[-.+])+)
                      \s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
                      \s*(\[\s*(?P<flags>\w+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
                      c         C   sS  t  j |  ƒ } | sI d  } d |  k s3 d |  k rOt d |  ƒ ‚ qOn| j ƒ  } | d } | d } | j d ƒ } | d k r” | d  } } n4 | d k r³ t d |  ƒ ‚ n  | j d ƒ \ } } | d	 }	 |	 d  k rd |  k sö d |  k r	t d |  ƒ ‚ n  g  }	 n( g  |	 j d
 ƒ D] }
 |
 j ƒ  ^ q"}	 t | | | |	 ƒ } | S(   Nt   [t   ]s   Invalid specification '%s'R&   t   callablet   :i    i   RŽ   t   ,(	   t   ENTRY_REt   searchR,   R   R   t   countR4   R/   R  (   t   specificationR   R6   R   R&   R@   t   colonsRM   RK   RŽ   RÕ   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRy   7  s2    


	(c         C   s  |  d
 k r d }  n  t j d k rH d t j k rH t j j d ƒ } n t j j d ƒ } t j j | ƒ r� t j | t j	 ƒ } | sä t
 j d | ƒ qä nG y t j | ƒ t } Wn- t k
 rã t
 j d | d t ƒt } n X| s	t j ƒ  } t
 j d	 | ƒ n  t j j | |  ƒ S(   s¦  
    Return the default base location for distlib caches. If the directory does
    not exist, it is created. Use the suffix provided for the base directory,
    and default to '.distlib' if it isn't provided.

    On Windows, if LOCALAPPDATA is defined in the environment, then it is
    assumed to be a directory, and will be the parent directory of the result.
    On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home
    directory - using os.expanduser('~') - will be the parent directory of
    the result.

    The result is just the directory '.distlib' in the parent directory as
    determined above, or with the name specified with ``suffix``.
    s   .distlibt   ntt   LOCALAPPDATAs   $localappdatat   ~s(   Directory exists but is not writable: %ss   Unable to create %st   exc_infos#   Default location unusable, using %sN(   R,   R?   R&   t   environR@   t
   expandvarst
   expanduserRî   Rñ   Rò   RÃ   t   warningt   makedirsRY   t   OSErrorRµ   R’   R“   R2   (   RK   R6   t   usable(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_cache_baseV  s&    	

c         C   s`   t  j j t  j j |  ƒ ƒ \ } } | r? | j d d ƒ } n  | j t  j d ƒ } | | d S(   s  
    Convert an absolute path to a directory name for use in a cache.

    The algorithm used is:

    #. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
    #. Any occurrence of ``os.sep`` is replaced with ``'--'``.
    #. ``'.cache'`` is appended.
    R  s   ---s   --s   .cache(   R?   R@   t
   splitdriveR¼   R>   RA   (   R@   R   Re   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   path_to_cache_dir  s
    
$c         C   s   |  j  d ƒ s |  d S|  S(   NR=   (   t   endswith(   R5   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   ensure_slash�  s    c         C   sk   d  } } d |  k r^ |  j d d ƒ \ } }  d | k rC | } q^ | j d d ƒ \ } } n  | | |  f S(   Nt   @i   R  (   R,   R4   (   t   netloct   usernamet   passwordRM   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   parse_credentials–  s    
	c          C   s    t  j d ƒ }  t  j |  ƒ |  S(   Ni   (   R?   t   umask(   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_process_umask¡  s    c         C   sF   t  } d  } x3 t |  ƒ D]% \ } } t | t ƒ s t } Pq q W| S(   N(   RY   R,   t	   enumerateR^   R   Rµ   (   t   seqR6   t   iR5   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   is_string_sequence¦  s    s3   ([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)s   -py(\d\.?\d?)c         C   s  d } d } t |  ƒ j d d ƒ }  t j |  ƒ } | r[ | j d ƒ } |  | j ƒ   }  n  | rÏ t |  ƒ t | ƒ d k rÏ t j	 t j
 | ƒ d |  ƒ } | rÏ | j ƒ  } |  |  |  | d | f } qÏ n  | d k rt j	 |  ƒ } | r| j d ƒ | j d ƒ | f } qn  | S(   sw   
    Extract name, version, python version from a filename (no extension)

    Return name, version, pyver or None
    t    t   -i   s   \bi   N(   R,   R   R>   t   PYTHON_VERSIONR  R„   t   startRB   t   reR.   t   escapet   endt   PROJECT_NAME_AND_VERSION(   t   filenamet   project_nameR6   t   pyverR   t   n(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   split_filenameµ  s"    "!'s-   (?P<name>[\w .-]+)\s*\(\s*(?P<ver>[^\s)]+)\)$c         C   sR   t  j |  ƒ } | s( t d |  ƒ ‚ n  | j ƒ  } | d j ƒ  j ƒ  | d f S(   sÇ   
    A utility method used to get name and version from a string.

    From e.g. a Provides-Dist value.

    :param p: A value in a form 'foo (1.0)'
    :return: The name and version as a tuple.
    s$   Ill-formed name/version string: '%s'R&   t   ver(   t   NAME_VERSION_RER.   R   R   R/   R`   (   Re   R   R   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   parse_name_and_versionÑ  s
    	c         C   s	  t  ƒ  } t  |  p g  ƒ }  t  | p' g  ƒ } d |  k rS |  j d ƒ | | O} n  x¯ |  D]§ } | d k r| | j | ƒ qZ | j d ƒ rÔ | d } | | k rµ t j d | ƒ n  | | k r| j | ƒ qqZ | | k rô t j d | ƒ n  | j | ƒ qZ W| S(   Nt   *R3  i   s   undeclared extra: %s(   R�   R­   R¹   t
   startswithRÃ   R  (   t	   requestedt	   availableR6   t   rt   unwanted(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt
   get_extrasà  s&    	
c         C   s¤   i  } yq t  |  ƒ } | j ƒ  } | j d ƒ } | j d ƒ sR t j d | ƒ n$ t j d ƒ | ƒ } t j	 | ƒ } Wn& t
 k
 rŸ } t j d |  | ƒ n X| S(   Ns   Content-Types   application/jsons(   Unexpected response for JSON request: %ss   utf-8s&   Failed to get external data for %s: %s(   R	   RÄ   t   getRC  RÃ   Rï   Rs   Rt   Rv   Rw   Rz   t	   exception(   R+   R6   t   respt   headerst   ctt   readert   e(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   _get_external_dataù  s    s'   https://www.red-dove.com/pypi/projects/c         C   s9   d |  d j  ƒ  |  f } t t | ƒ } t | ƒ } | S(   Ns   %s/%s/project.jsoni    (   t   upperR
   t   _external_data_base_urlRP  (   R&   R+   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_project_data  s    c         C   s6   d |  d j  ƒ  |  | f } t t | ƒ } t | ƒ S(   Ns   %s/%s/package-%s.jsoni    (   RQ  R
   RR  RP  (   R&   t   versionR+   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_package_data  s    t   Cachec           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sæ   
    A class implementing a cache for resources that need to live in the file system
    e.g. shared libraries. This class was moved from resources to here because it
    could be used by other modules, e.g. the wheel module.
    c         C   sv   t  j j | ƒ s" t  j | ƒ n  t  j | ƒ j d @d k rQ t j d | ƒ n  t  j j t  j j	 | ƒ ƒ |  _
 d S(   su   
        Initialise an instance.

        :param base: The base directory where the cache should be located.
        i?   i    s   Directory '%s' is not privateN(   R?   R@   Rî   R  R½   RÜ   RÃ   R  R¼   t   normpathRD   (   R¢   RD   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   "  s
    c         C   s
   t  | ƒ S(   sN   
        Converts a resource prefix to a directory name in the cache.
        (   R$  (   R¢   RM   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   prefix_to_dir0  s    c         C   sº   g  } x­ t  j |  j ƒ D]™ } t  j j |  j | ƒ } yZ t  j j | ƒ s^ t  j j | ƒ rn t  j | ƒ n" t  j j | ƒ r� t	 j
 | ƒ n  Wq t k
 r± | j | ƒ q Xq W| S(   s"   
        Clear the cache.
        (   R?   Rù   RD   R@   R2   RÅ   RÆ   R­   Rî   R   R”   Rz   t   append(   R¢   t   not_removedt   fn(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   clear6  s    $(   R¦   Rª   t   __doc__R£   RX  R\  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRV    s   		t
   EventMixinc           B   s>   e  Z d  Z d „  Z e d „ Z d „  Z d „  Z d „  Z RS(   s1   
    A very simple publish/subscribe system.
    c         C   s   i  |  _  d  S(   N(   t   _subscribers(   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   K  s    c         C   s\   |  j  } | | k r+ t | g ƒ | | <n- | | } | rK | j | ƒ n | j | ƒ d S(   s`  
        Add a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be added (and called when the
                           event is published).
        :param append: Whether to append or prepend the subscriber to an
                       existing subscriber list for the event.
        N(   R_  R    RY  t
   appendleft(   R¢   t   eventt
   subscriberRY  t   subst   sq(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR¹   N  s    
	
c         C   s=   |  j  } | | k r( t d | ƒ ‚ n  | | j | ƒ d S(   s™   
        Remove a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be removed.
        s   No subscribers: %rN(   R_  R«   R­   (   R¢   Ra  Rb  Rc  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR­   b  s    	c         C   s   t  |  j j | d ƒ ƒ S(   s�   
        Return an iterator for the subscribers for an event.
        :param event: The event to return subscribers for.
        (    (   t   iterR_  RI  (   R¢   Ra  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   get_subscribersn  s    c         O   s‡   g  } xa |  j  | ƒ D]P } y | | | | Ž } Wn$ t k
 rX t j d ƒ d } n X| j | ƒ q Wt j d | | | | ƒ | S(   s^  
        Publish a event and return a list of values returned by its
        subscribers.

        :param event: The event to publish.
        :param args: The positional arguments to pass to the event's
                     subscribers.
        :param kwargs: The keyword arguments to pass to the event's
                       subscribers.
        s"   Exception during event publications/   publish %s: args = %s, kwargs = %s, result = %sN(   Rf  Rz   RÃ   RJ  R,   RY  Rï   (   R¢   Ra  t   argst   kwargsR6   Rb  R‰   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   publishu  s    
	(	   R¦   Rª   R]  R£   RY   R¹   R­   Rf  Ri  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR^  G  s   			t	   Sequencerc           B   sh   e  Z d  „  Z d „  Z e d „ Z d „  Z d „  Z d „  Z d „  Z	 e
 d „  ƒ Z e
 d „  ƒ Z RS(	   c         C   s"   i  |  _  i  |  _ t ƒ  |  _ d  S(   N(   t   _predst   _succsR�   t   _nodes(   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   �  s    		c         C   s   |  j  j | ƒ d  S(   N(   Rm  R¹   (   R¢   t   node(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   add_node•  s    c         C   s  | |  j  k r" |  j  j | ƒ n  | r	x3 t |  j j | d ƒ ƒ D] } |  j | | ƒ qD Wx3 t |  j j | d ƒ ƒ D] } |  j | | ƒ qz Wx6 t |  j j ƒ  ƒ D] \ } } | sª |  j | =qª qª Wx9 t |  j j ƒ  ƒ D] \ } } | sã |  j | =qã qã Wn  d  S(   N(    (    (   Rm  R­   R�   Rk  RI  Rl  R÷   Rx   (   R¢   Rn  t   edgesRe   R5   R†   R‡   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   remove_node˜  s    """"c         C   sB   |  j  j | t ƒ  ƒ j | ƒ |  j j | t ƒ  ƒ j | ƒ d  S(   N(   Rk  t
   setdefaultR�   R¹   Rl  (   R¢   t   predt   succ(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR¹   ¨  s    c         C   sŽ   y |  j  | } |  j | } Wn! t k
 rA t d | ƒ ‚ n Xy | j | ƒ | j | ƒ Wn' t k
 r‰ t d | | f ƒ ‚ n Xd  S(   Ns   %r not a successor of anythings   %r not a successor of %r(   Rk  Rl  t   KeyErrorR«   R­   (   R¢   Rs  Rt  t   predst   succs(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR­   ­  s    c         C   s+   | |  j  k p* | |  j k p* | |  j k S(   N(   Rk  Rl  Rm  (   R¢   t   step(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   is_stepº  s    c         C   sÞ   |  j  | ƒ s" t d | ƒ ‚ n  g  } g  } t ƒ  } | j | ƒ x� | rÓ | j d ƒ } | | k r” | | k rÐ | j | ƒ | j | ƒ qÐ qG | j | ƒ | j | ƒ |  j j | d ƒ } | j	 | ƒ qG Wt
 | ƒ S(   Ns   Unknown: %ri    (    (   Ry  R«   R�   RY  RF   R­   R¹   Rk  RI  t   extendt   reversed(   R¢   t   finalR6   t   todot   seenRx  Rv  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   get_steps¾  s"    		c            sy   d g ‰ g  ‰ i  ‰ i  ‰ g  ‰ |  j  ‰  ‡  ‡ ‡ ‡ ‡ ‡ ‡ f d †  ‰ x' ˆ  D] } | ˆ k rR ˆ | ƒ qR qR Wˆ S(   Ni    c            s@  ˆ d ˆ |  <ˆ d ˆ |  <ˆ d c d 7<ˆ j  |  ƒ y ˆ  |  } Wn t k
 r` g  } n Xxl | D]d } | ˆ k r¢ ˆ | ƒ t ˆ |  ˆ | ƒ ˆ |  <qh | ˆ k rh t ˆ |  ˆ | ƒ ˆ |  <qh qh Wˆ |  ˆ |  k r<g  } x3 t rˆ j ƒ  } | j  | ƒ | |  k rí Pqí qí Wt | ƒ } ˆ j  | ƒ n  d  S(   Ni    i   (   RY  Rz   t   minRY   RF   t   tuple(   Rn  t
   successorst	   successort   connected_componentt	   component(   t   grapht   indext   index_countert   lowlinksR6   t   stackt   strongconnect(    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR‹  â  s.    

"	 (   Rl  (   R¢   Rn  (    (   R†  R‡  Rˆ  R‰  R6   RŠ  R‹  s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   strong_connections×  s    		!"c         C   s‘   d g } xF |  j  D]; } |  j  | } x% | D] } | j d | | f ƒ q- Wq Wx" |  j D] } | j d | ƒ q\ W| j d ƒ d j | ƒ S(   Ns   digraph G {s     %s -> %s;s     %s;t   }s   
(   Rk  RY  Rm  R2   (   R¢   R6   Rt  Rv  Rs  Rn  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   dot
  s    	(   R¦   Rª   R£   Ro  Rµ   Rq  R¹   R­   Ry  R  t   propertyRŒ  RŽ  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRj  �  s   						3s   .tar.gzs   .tar.bz2s   .tars   .zips   .tgzs   .tbzs   .whlc   
         sæ  ‡  ‡ f d †  } t  j j ˆ  ƒ ‰  t ˆ  ƒ ‰ d  } | d  k rÇ |  j d ƒ rZ d } qÇ |  j d ƒ rx d } d } qÇ |  j d ƒ r– d } d } qÇ |  j d ƒ r´ d } d } qÇ t d |  ƒ ‚ n  z| d k rt |  d ƒ } | rZ| j ƒ  } x | D] } | | ƒ qþ WqZnB t	 j
 |  | ƒ } | rZ| j ƒ  } x | D] } | | ƒ qCWn  | d k r½t j d d k  r½xA | j ƒ  D]0 }	 t |	 j t ƒ s†|	 j j d ƒ |	 _ q†q†Wn  | j ˆ  ƒ Wd  | rá| j ƒ  n  Xd  S(   Nc            s|   t  |  t ƒ s! |  j d ƒ }  n  t j j t j j ˆ  |  ƒ ƒ } | j ˆ  ƒ se | ˆ t j k rx t	 d | ƒ ‚ n  d  S(   Ns   utf-8s   path outside destination: %r(
   R^   R   t   decodeR?   R@   R¼   R2   RC  RA   R«   (   R@   Re   (   t   dest_dirt   plen(    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt
   check_path  s
    !#s   .zips   .whlt   zips   .tar.gzs   .tgzt   tgzs   r:gzs   .tar.bz2s   .tbzt   tbzs   r:bz2s   .tart   tarRF  s   Unknown format for %ri    i   s   utf-8(   s   .zips   .whl(   s   .tar.gzs   .tgz(   s   .tar.bz2s   .tbz(   R?   R@   R¼   RB   R,   R%  R«   R   t   namelistt   tarfileRÐ   t   getnamesRX   Rr   t
   getmembersR^   R&   R   R�  t
   extractallR~   (
   t   archive_filenameR‘  t   formatRÊ   R“  t   archiveRá   t   namesR&   t   tarinfo(    (   R‘  R’  s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   unarchive  sH    				c      	   C   s¬   t  j ƒ  } t |  ƒ } t | d ƒ � } xu t j |  ƒ D]d \ } } } xR | D]J } t j j | | ƒ } | | }	 t j j |	 | ƒ }
 | j | |
 ƒ qP Wq: WWd QX| S(   s*   zip a directory tree into a BytesIO objectRÎ   N(	   t   iot   BytesIORB   R   R?   t   walkR@   R2   R�   (   t	   directoryR6   t   dlent   zft   rootRû   Rà   R&   t   fullt   relRL   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   zip_dirS  s    
R$   t   Kt   Mt   Gt   Tt   Pt   Progressc           B   s†   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z	 e d	 „  ƒ Z
 d
 „  Z e d „  ƒ Z e d „  ƒ Z RS(   t   UNKNOWNi    id   c         C   s8   | |  _  |  _ | |  _ d  |  _ d |  _ t |  _ d  S(   Ni    (   R€  t   curt   maxR,   t   startedt   elapsedRµ   t   done(   R¢   t   minvalt   maxval(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   j  s
    			c         C   sD   | |  _  t j ƒ  } |  j d  k r0 | |  _ n | |  j |  _ d  S(   N(   R´  t   timeR¶  R,   R·  (   R¢   t   curvalt   now(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   updater  s
    	c         C   s   |  j  |  j | ƒ d  S(   N(   R¾  R´  (   R¢   t   incr(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   increment|  s    c         C   s   |  j  |  j ƒ |  S(   N(   R¾  R€  (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR5  €  s    c         C   s/   |  j  d  k	 r" |  j |  j  ƒ n  t |  _ d  S(   N(   Rµ  R,   R¾  RY   R¸  (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   stop„  s    c         C   s   |  j  d  k r |  j S|  j  S(   N(   Rµ  R,   t   unknown(   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   maximum‰  s    c         C   sZ   |  j  r d } nD |  j d  k r* d } n, d |  j |  j |  j |  j } d | } | S(   Ns   100 %s    ?? %g      Y@s   %3d %%(   R¸  Rµ  R,   R´  R€  (   R¢   R6   R‡   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt
   percentage�  s    			"
c         C   sU   | d k r |  j  d  k s- |  j |  j k r6 d } n t j d t j | ƒ ƒ } | S(   Ni    s   ??:??:??s   %H:%M:%S(   Rµ  R,   R´  R€  R»  t   strftimet   gmtime(   R¢   t   durationR6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   format_duration˜  s    -	c         C   sµ   |  j  r d } |  j } nƒ d } |  j d  k r9 d } ne |  j d k sZ |  j |  j k rc d } n; t |  j |  j ƒ } | |  j |  j :} | d |  j } d | |  j | ƒ f S(   Nt   Dones   ETA iÿÿÿÿi    i   s   %s: %s(   R¸  R·  Rµ  R,   R´  R€  t   floatRÈ  (   R¢   RM   t   t(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   ETA¡  s    		!	c         C   sh   |  j  d k r d } n |  j |  j |  j  } x( t D]  } | d k  rL Pn  | d :} q6 Wd | | f S(   Ni    g        iè  g     @�@s   %d %sB/s(   R·  R´  R€  t   UNITS(   R¢   R6   t   unit(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   speed´  s    	(   R¦   Rª   RÂ  R£   R¾  RÀ  R5  RÁ  R�  RÃ  RÄ  RÈ  RÌ  RÏ  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR²  g  s   	
					s   \{([^}]*)\}s   [^/\\,{]\*\*|\*\*[^/\\,}]s   ^[^{]*\}|\{[^}]*$c         C   sZ   t  j |  ƒ r( d } t | |  ƒ ‚ n  t j |  ƒ rP d } t | |  ƒ ‚ n  t |  ƒ S(   sA   Extended globbing function that supports ** and {opt1,opt2,opt3}.s7   invalid glob %r: recursive glob "**" must be used alones2   invalid glob %r: mismatching set marker '{' or '}'(   t   _CHECK_RECURSIVE_GLOBR  R«   t   _CHECK_MISMATCH_SETt   _iglob(   t	   path_globRË   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR   É  s    c         c   sm  t  j |  d ƒ } t | ƒ d k r~ | \ } } } x3| j d ƒ D]4 } x+ t d j | | | f ƒ ƒ D] } | Vqh WqC Wnë d |  k r© xÜ t |  ƒ D] } | Vq— WnÀ |  j d d ƒ \ } } | d k rÖ d } n  | d k rë d } n | j d ƒ } | j d ƒ } x] t j | ƒ D]L \ } } }	 t j	 j
 | ƒ } x( t t j	 j | | ƒ ƒ D] }
 |
 VqVWqWd  S(	   Ni   R  R$   s   **R   RB  R=   s   \(   t	   RICH_GLOBR4   RB   RÒ  R2   t	   std_iglobRC   R?   R¥  R@   RW  (   RÓ  t   rich_path_globRM   R�   RK   t   itemR@   t   radicalt   dirRà   R[  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRÒ  Ô  s(    %		"(   t   HTTPSHandlert   match_hostnamet   CertificateErrort   HTTPSConnectionc           B   s   e  Z d Z e Z d  „  Z RS(   c      
   C   sÝ  t  j |  j |  j f |  j ƒ } t |  d t ƒ rI | |  _ |  j ƒ  n  t	 t
 d ƒ s¯ |  j rm t
 j } n	 t
 j } t
 j | |  j |  j d | d t
 j d |  j ƒ|  _ n® t
 j t
 j ƒ } | j t
 j O_ |  j rõ | j |  j |  j ƒ n  i  } |  j rHt
 j | _ | j d |  j ƒ t t
 d t ƒ rH|  j | d <qHn  | j | | � |  _ |  j rÙ|  j rÙy0 t |  j j ƒ  |  j ƒ t j d	 |  j ƒ WqÙt k
 rÕ|  j j t  j ƒ |  j j  ƒ  ‚  qÙXn  d  S(
   Nt   _tunnel_hostt
   SSLContextt	   cert_reqst   ssl_versiont   ca_certst   cafilet   HAS_SNIt   server_hostnames   Host verified: %s(!   Rš   t   create_connectiont   hostt   portt   timeoutRZ   Rµ   t   sockt   _tunnelRW   t   sslRâ  t   CERT_REQUIREDt	   CERT_NONEt   wrap_sockett   key_filet	   cert_filet   PROTOCOL_SSLv23Rß  t   optionst   OP_NO_SSLv2t   load_cert_chaint   verify_modet   load_verify_locationst   check_domainRÛ  t   getpeercertRÃ   Rï   RÜ  t   shutdownt	   SHUT_RDWRR~   (   R¢   Rê  Rà  t   contextRh  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   connectý  s>    !						N(   R¦   Rª   R,   Râ  RY   Rø  Rý  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRÝ  ø  s   RÚ  c           B   s&   e  Z e d  „ Z d „  Z d „  Z RS(   c         C   s#   t  j |  ƒ | |  _ | |  _ d  S(   N(   t   BaseHTTPSHandlerR£   Râ  Rø  (   R¢   Râ  Rø  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   #  s    	c         O   s7   t  | | Ž  } |  j r3 |  j | _ |  j | _ n  | S(   s  
            This is called to create a connection instance. Normally you'd
            pass a connection class to do_open, but it doesn't actually check for
            a class, and just expects a callable. As long as we behave just as a
            constructor would have, we should be OK. If it ever changes so that
            we *must* pass a class, we'll create an UnsafeHTTPSConnection class
            which just sets check_domain to False in the class definition, and
            choose which one to pass to do_open.
            (   RÝ  Râ  Rø  (   R¢   Rg  Rh  R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   _conn_maker(  s
    
	c         C   s_   y |  j  |  j | ƒ SWnA t k
 rZ } d t | j ƒ k rT t d | j ƒ ‚ q[ ‚  n Xd  S(   Ns   certificate verify faileds*   Unable to verify server certificate for %s(   t   do_openRÿ  R   t   strt   reasonRÜ  Rç  (   R¢   t   reqRO  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt
   https_open8  s    (   R¦   Rª   RY   R£   Rÿ  R  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRÚ  "  s   	t   HTTPSOnlyHandlerc           B   s   e  Z d  „  Z RS(   c         C   s   t  d | ƒ ‚ d  S(   NsA   Unexpected HTTP request on what should be a secure connection: %s(   R   (   R¢   R  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   http_openL  s    (   R¦   Rª   R  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  K  s   i   i   t   HTTPc           B   s   e  Z d  d d „ Z RS(   R$   c         K   s5   | d k r d  } n  |  j |  j | | | � ƒ d  S(   Ni    (   R,   t   _setupt   _connection_class(   R¢   Rç  Rè  Rh  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   X  s    	N(   R¦   Rª   R,   R£   (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  W  s   t   HTTPSc           B   s   e  Z d  d d „ Z RS(   R$   c         K   s5   | d k r d  } n  |  j |  j | | | � ƒ d  S(   Ni    (   R,   R  R	  (   R¢   Rç  Rè  Rh  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   `  s    	N(   R¦   Rª   R,   R£   (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR
  _  s   t	   Transportc           B   s   e  Z d  d „ Z d „  Z RS(   i    c         C   s    | |  _  t j j |  | ƒ d  S(   N(   Ré  R   R  R£   (   R¢   Ré  t   use_datetime(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   g  s    	c         C   sŽ   |  j  | ƒ \ } } } t d k r< t | d |  j ƒ} nN |  j sY | |  j d k r} | |  _ | t j | ƒ f |  _ n  |  j d } | S(   Ni   i   Ré  i    i   (   i   i   (   t   get_host_infot	   _ver_infoR  Ré  t   _connectiont   _extra_headersR   t   HTTPConnection(   R¢   Rç  t   ht   eht   x509R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   make_connectionk  s    	(   R¦   Rª   R£   R  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  f  s   t   SafeTransportc           B   s   e  Z d  d „ Z d „  Z RS(   i    c         C   s    | |  _  t j j |  | ƒ d  S(   N(   Ré  R   R  R£   (   R¢   Ré  R  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   x  s    	c         C   s­   |  j  | ƒ \ } } } | s' i  } n  |  j | d <t d k rU t | d  | � } nT |  j sr | |  j d k rœ | |  _ | t j | d  | � f |  _ n  |  j d } | S(   NRé  i   i   i    i   (   i   i   (	   R  Ré  R  R
  R,   R  R  R   RÝ  (   R¢   Rç  R  R  Rh  R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  |  s    		(   R¦   Rª   R£   R  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  w  s   t   ServerProxyc           B   s   e  Z d  „  Z RS(   c   	      K   s¤   | j  d d  ƒ |  _ } | d  k	 rŠ t | ƒ \ } } | j d d ƒ } | d k r^ t } n t } | | d | ƒ| d <} | |  _ n  t j	 j
 |  | | � d  S(   NRé  R  i    t   httpst	   transport(   RF   R,   Ré  R   RI  R  R  R  R   R  R£   (	   R¢   t   uriRh  Ré  t   schemet   _R  t   tclsRË  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   �  s    	(   R¦   Rª   R£   (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR  Œ  s   c         K   s:   t  j d d k  r  | d 7} n
 d | d <t |  | | � S(   Ni    i   t   bR$   t   newline(   RX   Rr   RÐ   (   R[  Rá   Rh  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   _csv_open¡  s    
t   CSVBasec           B   sG   e  Z i e d  ƒ d 6e d ƒ d 6e d ƒ d 6Z d „  Z d „  Z RS(   R  t	   delimitert   "t	   quotechars   
t   lineterminatorc         C   s   |  S(   N(    (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt	   __enter__°  s    c         G   s   |  j  j ƒ  d  S(   N(   Rp   R~   (   R¢   R  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __exit__³  s    (   R¦   Rª   R  t   defaultsR&  R'  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR!  ©  s   	t	   CSVReaderc           B   s)   e  Z d  „  Z d „  Z d „  Z e Z RS(   c         K   s‚   d | k rM | d } t  j d d k rA t j d ƒ | ƒ } n  | |  _ n t | d d ƒ |  _ t j |  j |  j � |  _ d  S(   NRp   i    i   s   utf-8R@   RF  (	   RX   Rr   Rs   Rt   Rp   R   t   csvRN  R(  (   R¢   Rh  Rp   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   ¸  s    
c         C   s   |  S(   N(    (   R¢   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __iter__Ã  s    c         C   sk   t  |  j ƒ } t j d d k  rg xB t | ƒ D]1 \ } } t | t ƒ s/ | j d ƒ | | <q/ q/ Wn  | S(   Ni    i   s   utf-8(   t   nextRN  RX   Rr   R.  R^   R   R�  (   R¢   R6   R0  R×  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR,  Æ  s    (   R¦   Rª   R£   R+  R,  t   __next__(    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR)  ·  s   			t	   CSVWriterc           B   s   e  Z d  „  Z d „  Z RS(   c         K   s1   t  | d ƒ |  _ t j |  j |  j � |  _ d  S(   NRÎ   (   R   Rp   R*  t   writerR(  (   R¢   R[  Rh  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   Ñ  s    c         C   su   t  j d d k  ra g  } x< | D]4 } t | t ƒ rG | j d ƒ } n  | j | ƒ q  W| } n  |  j j | ƒ d  S(   Ni    i   s   utf-8(   RX   Rr   R^   R   R×   RY  R/  t   writerow(   R¢   t   rowRF  R×  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR0  Õ  s    	(   R¦   Rª   R£   R0  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR.  Ð  s   	t   Configuratorc           B   sH   e  Z e e j ƒ Z d  e d <d d „ Z d „  Z d „  Z d „  Z	 RS(   t   inc_convertt   incc         C   s/   t  t |  ƒ j | ƒ | p% t j ƒ  |  _ d  S(   N(   t   superR2  R£   R?   R—   RD   (   R¢   t   configRD   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£   è  s    c            s!  ‡  ‡ f d †  ‰  | j  d ƒ } t | ƒ s? ˆ j | ƒ } n  | j  d d  ƒ } | j  d d ƒ } | r‘ t g  | D] } ˆ  | ƒ ^ qs ƒ } n  g  | D]( } t | ƒ r˜ | ˆ  | | ƒ f ^ q˜ } t | ƒ } | | | Ž  }	 | rx3 | j ƒ  D]" \ }
 } t |	 |
 ˆ  | ƒ ƒ qô Wn  |	 S(   Nc            s±   t  |  t t f ƒ rC t |  ƒ g  |  D] } ˆ  | ƒ ^ q% ƒ } nj t  |  t ƒ rž d |  k rp ˆ j |  ƒ } q­ i  } x4 |  D] } ˆ  |  | ƒ | | <q} Wn ˆ j |  ƒ } | S(   Ns   ()(   R^   R÷   R�  t   typet   dictt   configure_customt   convert(   t   oR0  R6   R†   (   R:  R¢   (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR:  í  s    .s   ()R   s   [](    (	   RF   R  R  R,   R�  R   R8  Rx   t   setattr(   R¢   R6  Rf   t   propsRg  R;  R†   Rx   Rh  R6   R=  R‡   (    (   R:  R¢   s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR9  ì  s    (5c         C   sI   |  j  | } t | t ƒ rE d | k rE |  j | ƒ |  j  | <} n  | S(   Ns   ()(   R6  R^   R8  R9  (   R¢   Ri   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   __getitem__  s    c         C   sa   t  j j | ƒ s- t  j j |  j | ƒ } n  t j | d d d ƒ� } t j | ƒ } Wd QX| S(   s*   Default converter for the inc:// protocol.RF  RÏ   s   utf-8N(	   R?   R@   t   isabsR2   RD   Rs   RÐ   Rv   Rw   (   R¢   R‰   RÕ   R6   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR3    s
    N(
   R¦   Rª   R8  R   t   value_convertersR,   R£   R9  R>  R3  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR2  ã  s   
		t   SubprocessMixinc           B   s)   e  Z e d d  „ Z d „  Z d „  Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   t   verboset   progress(   R¢   RB  RC  (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyR£     s    	c         C   sž   |  j  } |  j } x{ t r� | j ƒ  } | s1 Pn  | d k	 rM | | | ƒ q | sf t j j d ƒ n t j j | j d ƒ ƒ t j j	 ƒ  q W| j
 ƒ  d S(   s¨   
        Read lines from a subprocess' output stream and either pass to a progress
        callable (if specified) or write progress information to sys.stderr.
        R   s   utf-8N(   RC  RB  RY   t   readlineR,   RX   t   stderrR�   R�  t   flushR~   (   R¢   Rp   Rü  RC  RB  R5   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRN  "  s    			c         K   sà   t  j | d t  j d t  j | �} t j d |  j d | j d f ƒ } | j ƒ  t j d |  j d | j d f ƒ } | j ƒ  | j	 ƒ  | j
 ƒ  | j
 ƒ  |  j d  k	 rÀ |  j d d ƒ n |  j rÜ t j j d ƒ n  | S(   Nt   stdoutRE  R¿   Rg  s   done.t   mains   done.
(   t
   subprocesst   Popent   PIPEt	   threadingt   ThreadRN  RG  R5  RE  t   waitR2   RC  R,   RB  RX   R�   (   R¢   t   cmdRh  Re   t   t1t   t2(    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   run_command7  s    $
$



	N(   R¦   Rª   Rµ   R,   R£   RN  RR  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyRA    s   	c         C   s   t  j d d |  ƒ j ƒ  S(   s,   Normalize a python package name a la PEP 503s   [-_.]+R3  (   R6  t   subR`   (   R&   (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   normalize_nameH  s    (   s   .tar.gzs   .tar.bz2s   .tars   .zips   .tgzs   .tbzs   .whl(   R$   R­  R®  R¯  R°  R±  (   i   i   (‹   Rs   t   collectionsR    t
   contextlibR*  t   globR   RÕ  R£  Rv   t   loggingR?   Rå   R6  R   Rš   Rì  t   ImportErrorR,   RI  RX   R™  R’   R   RL  t   dummy_threadingR»  R$   R   t   compatR   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R   R   R   R   R   t	   getLoggerR¦   RÃ   t   COMMARæ   R3   t   IDENTt   EXTRA_IDENTt   VERSPECt   RELOPt   BARE_CONSTRAINTSt
   DIRECT_REFt   CONSTRAINTSt
   EXTRA_LISTt   EXTRASt   REQUIREMENTR-   t   RELOP_IDENTR0   R<   RT   R[   R_   Rg   Rj   RŠ   R‘   t   contextmanagerR–   R˜   RŸ   R¤   R    R°   R±   R  R  t   VERBOSER  Ry   R"  R$  R&  R+  R-  R1  t   IR9  R4  R>  R@  RA  RH  RP  RR  RS  RU  RV  R^  Rj  t   ARCHIVE_EXTENSIONSRY   R¢  R¬  RÍ  R²  RÔ  RÐ  RÑ  RÒ  RÚ  Rþ  RÛ  RÜ  RÝ  R  Rr   R  R  R
  R  R  R  R   R!  R)  R.  R2  RA  RT  (    (    (    s<   /usr/lib/python2.7/site-packages/pip/_vendor/distlib/util.pyt   <module>   sè   
‚
.	%		
				/	
		¶		)					
						,H‹ 6	]		*)		:+