509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
Àfc           @   s~  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 m
 Z
 d d l m Z d d l m Z m Z m Z m Z d d l 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  d d l m! Z! d d l" m# Z# d d	 l$ m% Z% d d
 l& m' Z' d d l( m) Z) d d l* m+ Z+ d d l, m- Z- e j. d ƒ Z/ e j. d e j0 ƒ Z1 e j. d ƒ Z2 e j. d e j0 ƒ j3 Z4 d j5 ƒ  Z6 d d d d g Z7 d Z8 d Z9 e9 j: d e j; d  d e ƒ Z< d „  Z= d „  Z> d „  Z? e@ d „ ZA e@ d  „ ZB e@ d! „ ZC e@ e e@ d" „ ZD e@ d# „ ZE d$ „  ZF e j. d% e j0 ƒ ZG eF d& „  ƒ ZH d' eI f d( „  ƒ  YZJ d) eJ f d* „  ƒ  YZK d e f d+ „  ƒ  YZL e j. d, ƒ jM ZN d- „  ZO d. „  ZP d d/ „ ZQ d0 „  ZR d1 eI f d2 „  ƒ  YZS d3 e jT f d4 „  ƒ  YZU e jV jW d5 „ ZX eQ e8 ƒ eX ƒ ZX d6 „  ZY d7 „  ZZ d S(8   s#   PyPI and direct package downloadingiÿÿÿÿN(   t   wraps(   t   six(   t   urllibt   http_clientt   configparsert   map(   t   CHECKOUT_DISTt   Distributiont   BINARY_DISTt   normalize_patht   SOURCE_DISTt   Environmentt   find_distributionst	   safe_namet   safe_versiont   to_filenamet   Requirementt   DEVELOP_DISTt   EGG_DIST(   t   ssl_support(   t   log(   t   DistutilsError(   t	   translate(   t   get_all_headers(   t   unescape(   t   Wheels   ^egg=([-A-Za-z0-9_.+!]+)$s   href\s*=\s*['"]?([^'"> ]+)s�   <a href="([^"#]+)">([^<]+)</a>
\s+\(<a (?:title="MD5 hash"
\s+)href="[^?]+\?:action=show_md5&amp;digest=([0-9a-f]{32})">md5</a>\)s   ([-+.a-z0-9]{2,}):s   .tar.gz .tar.bz2 .tar .zip .tgzt   PackageIndext   distros_for_urlt   parse_bdist_wininstt   interpret_distro_namei   s<   setuptools/{setuptools.__version__} Python-urllib/{py_major}t   py_majori   t
   setuptoolsc         C   s<   y t  j |  ƒ SWn$ t k
 r7 t d |  f ƒ ‚ n Xd  S(   Ns1   Not a URL, existing file, or requirement spec: %r(   R   t   parset
   ValueErrorR   (   t   spec(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   parse_requirement_arg2   s
    c         C   sâ   |  j  ƒ  } d \ } } } | j d ƒ rÕ | j d ƒ rL |  d  } d } qÕ | j d d ƒ r~ |  d d !} |  d  } d } qÕ | j d	 ƒ r  |  d
  } d } qÕ | j d d ƒ rÕ |  d d !} |  d  } d } qÕ n  | | | f S(   s=   Return (base,pyversion) or (None,None) for possible .exe names   .exes
   .win32.exeiöÿÿÿt   win32s	   .win32-pyiðÿÿÿiùÿÿÿiüÿÿÿs   .win-amd64.exeiòÿÿÿs	   win-amd64s   .win-amd64-pyiìÿÿÿN(   NNN(   t   lowert   Nonet   endswitht
   startswith(   t   nameR%   t   baset   py_vert   plat(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR   ;   s$    
	
	
	
c   	      C   s´   t  j j |  ƒ } | \ } } } } } } t  j j | j d ƒ d ƒ } | d k rƒ | d k rƒ t  j j | j d ƒ d ƒ } n  d | k rª | j d d ƒ \ } } n  | | f S(   Nt   /iÿÿÿÿs   sourceforge.nett   downloadiþÿÿÿt   #i   (   R   R    t   urlparset   unquotet   split(	   t   urlt   partst   schemet   servert   patht
   parameterst   queryt   fragmentR*   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   egg_info_for_urlS   s    "c         c   sŠ   t  |  ƒ \ } } x t |  | | ƒ D] } | Vq% W| r† t j | ƒ } | r† x1 t |  | j d ƒ | d t ƒD] } | Vqq Wq† n  d S(   sE   Yield egg or source distribution objects that might be found at a URLi   t
   precedenceN(   R;   t   distros_for_locationt   EGG_FRAGMENTt   matchR   t   groupR   (   R3   t   metadataR*   R:   t   distR?   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR   ^   s    	"c      
   C   sA  | j  d ƒ r | d  } n  | j  d ƒ rM d | k rM t j |  | | ƒ g S| j  d ƒ r° d | k r° t | ƒ } | j ƒ  s„ g  St d |  d | j d | j d	 t d
 ƒ g S| j  d ƒ rü t | ƒ \ } } } | d k	 rü t
 |  | | | t | ƒ Sn  x> t D]6 } | j  | ƒ r| t | ƒ  } t
 |  | | ƒ SqWg  S(   s:   Yield egg or source distribution objects based on basenames   .egg.zipiüÿÿÿs   .eggt   -s   .whlt   locationt   project_namet   versionR<   i   s   .exeN(   R'   R   t   from_locationR   t   is_compatibleRE   RF   R   R   R&   R   R   t
   EXTENSIONSt   len(   RD   t   basenameRA   t   wheelt   win_baseR+   t   platformt   ext(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR=   l   s.    		c         C   s"   t  t |  ƒ t j j |  ƒ | ƒ S(   sE   Yield possible egg or source distribution objects based on a filename(   R=   R	   t   osR7   RK   (   t   filenameRA   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   distros_for_filename�   s    c         c   sœ   | j  d ƒ } | r4 t d „  | d Dƒ ƒ r4 d Sxa t d t | ƒ d ƒ D]F } t |  | d j | |  ƒ d j | | ƒ d | d | d | ƒVqN Wd S(	   sØ   Generate alternative interpretations of a source distro name

    Note: if `location` is a filesystem filename, you should call
    ``pkg_resources.normalize_path()`` on it before passing it to this
    routine!
    RC   c         s   s!   |  ] } t  j d  | ƒ Vq d S(   s	   py\d\.\d$N(   t   reR?   (   t   .0t   p(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pys	   <genexpr>«   s    i   Ni   t
   py_versionR<   RN   (   R2   t   anyt   rangeRJ   R   t   join(   RD   RK   RA   RV   R<   RN   R4   RU   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR   ”   s    ! )c         c   s’   t  ƒ  } | j } | d k rS xm t j j | j |  ƒ D] } | | ƒ | Vq7 Wn; x8 |  D]0 } | | ƒ } | | k rZ | | ƒ | VqZ qZ Wd S(   sH   List unique elements, preserving order. Remember all elements ever seen.N(   t   sett   addR&   R   t   movest   filterfalset   __contains__(   t   iterablet   keyt   seent   seen_addt   elementt   k(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   unique_everseen¸   s    		

c            s   t  ˆ  ƒ ‡  f d †  ƒ } | S(   ss   
    Wrap a function returning an iterable such that the resulting iterable
    only ever yields unique items.
    c             s   t  ˆ  |  | Ž  ƒ S(   N(   Re   (   t   argst   kwargs(   t   func(    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   wrapperÐ   s    (   R    (   Rh   Ri   (    (   Rh   s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   unique_valuesÊ   s    s3   <([^>]*\srel\s{0,10}=\s{0,10}['"]?([^'" >]+)[^>]*)>c         c   s  x¨ t  j | ƒ D]— } | j ƒ  \ } } t t t j | j ƒ  j d ƒ ƒ ƒ } d | k sg d | k r x= t	 j | ƒ D]) } t
 j j |  t | j d ƒ ƒ ƒ Vqw Wq q Wxj d	 D]b } | j | ƒ } | d k r² t	 j | | ƒ } | rt
 j j |  t | j d ƒ ƒ ƒ Vqq² q² Wd S(
   sE   Find rel="homepage" and rel="download" links in `page`, yielding URLst   ,t   homepageR.   i   s   <th>Home Pages   <th>Download URLiÿÿÿÿN(   s   <th>Home Pages   <th>Download URL(   t   RELt   finditert   groupsRZ   R   t   strt   stripR%   R2   t   HREFR   R    t   urljoint
   htmldecodeR@   t   findt   search(   R3   t   pageR?   t   tagt   relt   relst   pos(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   find_external_linksÛ   s    '.t   ContentCheckerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sP   
    A null content checker that defines the interface for checking content
    c         C   s   d S(   s3   
        Feed a block of data to the hash.
        N(    (   t   selft   block(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   feedó   s    c         C   s   t  S(   sC   
        Check the hash. Return False if validation fails.
        (   t   True(   R~   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   is_validù   s    c         C   s   d S(   su   
        Call reporter with information about the checker (hash name)
        substituted into the template.
        N(    (   R~   t   reportert   template(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   reportÿ   s    (   t   __name__t
   __module__t   __doc__R€   R‚   R…   (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR}   î   s   		t   HashCheckerc           B   sJ   e  Z e j d  ƒ Z d „  Z e d „  ƒ Z d „  Z d „  Z	 d „  Z
 RS(   sK   (?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=(?P<expected>[a-f0-9]+)c         C   s(   | |  _  t j | ƒ |  _ | |  _ d  S(   N(   t	   hash_namet   hashlibt   newt   hasht   expected(   R~   RŠ   RŽ   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   __init__  s    	c         C   sR   t  j j | ƒ d } | s# t ƒ  S|  j j | ƒ } | sB t ƒ  S|  | j ƒ  �  S(   s5   Construct a (possibly null) ContentChecker from a URLiÿÿÿÿ(   R   R    R0   R}   t   patternRv   t	   groupdict(   t   clsR3   R:   R?   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   from_url  s    c         C   s   |  j  j | ƒ d  S(   N(   R�   t   update(   R~   R   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR€     s    c         C   s   |  j  j ƒ  |  j k S(   N(   R�   t	   hexdigestRŽ   (   R~   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR‚      s    c         C   s   | |  j  } | | ƒ S(   N(   RŠ   (   R~   Rƒ   R„   t   msg(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR…   #  s    (   R†   R‡   RS   t   compileR�   R�   t   classmethodR“   R€   R‚   R…   (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR‰     s   				c           B   sv  e  Z d  Z d d% d& e d „ Z e d „ Z e d „ Z e d „ Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d& d „ Z d „  Z d& d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z e e e d& d „ Z e e d „ Z d „  Z d Z d „  Z d „  Z d& d „ Z d „  Z d „  Z d „  Z d „  Z  d „  Z! e" e d „ ƒ Z# d  „  Z$ d! „  Z% d" „  Z& d# „  Z' d$ „  Z( RS('   s;   A distribution index that scans web pages for download URLss   https://pypi.python.org/simplet   *c         O   sÈ   t  j |  | | Ž | d | j d ƒ  |  _ i  |  _ i  |  _ i  |  _ t j d j	 t
 t | ƒ ƒ ƒ j |  _ g  |  _ | o— t j o— | p— t j ƒ  } | rµ t j | ƒ |  _ n t j j |  _ d  S(   NR-   t   |(   R   R�   R'   t	   index_urlt   scanned_urlst   fetched_urlst   package_pagesRS   R—   RY   R   R   R?   t   allowst   to_scanR   t   is_availablet   find_ca_bundlet
   opener_fort   openerR   t   requestt   urlopen(   R~   R›   t   hostst	   ca_bundlet
   verify_sslRf   t   kwt   use_ssl(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR�   +  s    			'		c         C   sg  | |  j  k r | r d St |  j  | <t | ƒ sD |  j | ƒ d St t | ƒ ƒ } | r‚ |  j | ƒ so d S|  j d | ƒ n  | sž | sž | |  j k r¸ t t	 |  j
 | ƒ ƒ d S|  j | ƒ sØ t |  j | <d S|  j d | ƒ t |  j | <d } |  j | | | ƒ } | d k r!d St |  j | j <d | j j d d ƒ j ƒ  k r`| j ƒ  d S| j } | j ƒ  } t | t ƒ sÏt | t j j ƒ r¢d } n | j j d	 ƒ p·d } | j | d
 ƒ } n  | j ƒ  xH t j | ƒ D]7 }	 t j j | t |	 j  d ƒ ƒ ƒ }
 |  j! |
 ƒ qéW| j" |  j# ƒ rct$ | d d ƒ d k rc|  j% | | ƒ } n  d S(   s<   Evaluate a URL as a possible download, and maybe retrieve itNs   Found link: %ss
   Reading %ss<   Download error on %s: %%s -- Some packages may not be found!t   htmls   content-typet    s   latin-1t   charsett   ignorei   t   codei”  (&   Rœ   R�   t
   URL_SCHEMEt   process_filenamet   listR   t   url_okt   debugR�   R   R[   t   infot   open_urlR&   R3   t   headerst   getR%   t   closet   readt
   isinstanceRp   R   t   errort	   HTTPErrort	   get_paramt   decodeRr   Rn   R    Rs   Rt   R@   t   process_urlR(   R›   t   getattrt   process_index(   R~   R3   t   retrievet   distst   tmplt   fR*   Rw   R®   R?   t   link(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRÁ   @  sP    !
		
$*c         C   sÌ   t  j j | ƒ s& |  j d | ƒ d  St  j j | ƒ r� | r� t  j j | ƒ } x9 t  j | ƒ D]% } |  j t  j j | | ƒ t	 ƒ qa Wn  t
 | ƒ } | rÈ |  j d | ƒ t t |  j | ƒ ƒ n  d  S(   Ns   Not found: %ss	   Found: %s(   RP   R7   t   existst   warnt   isdirt   realpatht   listdirR²   RY   R�   RR   Rµ   R³   R   R[   (   R~   t   fnt   nestedR7   t   itemRÅ   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR²   s  s    &c         C   s‰   t  | ƒ } | o* | j d ƒ j ƒ  d k } | sR |  j t j j | ƒ d ƒ rV t Sd } | ru t | | ƒ ‚ n |  j	 | | ƒ d  S(   Ni   t   filesN   
Note: Bypassing %s (disallowed host; see http://bit.ly/2hrImnY for details).
(
   R±   R@   R%   RŸ   R   R    R0   R�   R   RÊ   (   R~   R3   t   fatalt   st   is_fileR–   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR´   ƒ  s    !%c         C   sB   t  t j j | ƒ } d „  | Dƒ } t t j |  j | ƒ ƒ d  S(   Nc         s   s@   |  ]6 } t  j | ƒ D]  } | j d  ƒ r | | f Vq q d S(   s	   .egg-linkN(   RP   RÍ   R'   (   RT   R7   t   entry(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pys	   <genexpr>“  s   (   t   filterRP   R7   RË   R³   t	   itertoolst   starmapt   scan_egg_link(   R~   t   search_patht   dirst	   egg_links(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   scan_egg_links�  s    
c      
   C   s¿   t  t j j | | ƒ ƒ �( } t t d  t t j	 | ƒ ƒ ƒ } Wd  QXt
 | ƒ d k r[ d  S| \ } } xQ t t j j | | ƒ ƒ D]4 } t j j | | Œ | _ t | _ |  j | ƒ qƒ Wd  S(   Ni   (   t   openRP   R7   RY   R³   RÖ   R&   R   Rp   Rq   RJ   R   RD   R
   R<   R[   (   R~   R7   RÕ   t	   raw_linest   linest   egg_patht
   setup_pathRB   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRÙ   š  s    '"	c   
         s  ‡  f d †  } xW t  j | ƒ D]F } y, | t j j | t | j d ƒ ƒ ƒ ƒ Wq t k
 rd q Xq W| | ƒ \ } } | rxy t | | ƒ D]h } t	 | ƒ \ } }	 | j
 d ƒ rì |	 rì | rÜ | d | | f 7} qì ˆ  j | ƒ n  ˆ  j | ƒ q‘ Wt j d „  | ƒ Sd Sd S(   s#   Process the contents of a PyPI pagec            sÁ   |  j  ˆ  j ƒ r½ t t t j j |  t ˆ  j ƒ j d ƒ ƒ ƒ } t | ƒ d k r½ d | d k r½ t	 | d ƒ } t
 | d ƒ } t ˆ  j j | j ƒ  i  ƒ |  <t | ƒ t | ƒ f Sn  d S(   NR-   i   R/   i   i    (   NN(   R(   R›   R³   R   R   R    R1   RJ   R2   R   R   R�   Rž   t
   setdefaultR%   R   R&   (   RÈ   R4   t   pkgt   ver(   R~   (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   scan­  s    +"i   s   .pys
   #egg=%s-%sc         S   s   d |  j  d d d ƒ S(   Ns   <a href="%s#md5=%s">%s</a>i   i   i   (   R@   (   t   m(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   <lambda>Ð  R­   R­   N(   Rr   Rn   R   R    Rs   Rt   R@   R!   R|   R;   R'   t   need_version_infot   scan_urlt   PYPI_MD5t   sub(
   R~   R3   Rw   Ræ   R?   Rä   Rå   t   new_urlR*   t   frag(    (   R~   s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRÃ   ª  s$    ,c         C   s   |  j  d | ƒ d  S(   NsP   Page at %s links to .py file(s) without version info; an index scan is required.(   t   scan_all(   R~   R3   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRé   Õ  s    c         G   sO   |  j  |  j k r; | r+ |  j | | Œ n  |  j d ƒ n  |  j |  j  ƒ d  S(   Ns6   Scanning index of all packages (this may take a while)(   R›   R�   RÊ   R¶   Rê   (   R~   R–   Rf   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRï   Û  s    
c         C   s­   |  j  |  j | j d ƒ |  j j | j ƒ sN |  j  |  j | j d ƒ n  |  j j | j ƒ ss |  j | ƒ n  x3 t |  j j | j d ƒ ƒ D] } |  j  | ƒ q’ Wd  S(   NR-   (    (	   Rê   R›   t   unsafe_nameRž   R¹   R`   RE   t   not_found_in_indexR³   (   R~   t   requirementR3   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   find_packagesä  s    %c         C   sk   |  j  ƒ  |  j | ƒ x8 |  | j D]) } | | k r; | S|  j d | | ƒ q% Wt t |  ƒ j | | ƒ S(   Ns   %s does not match %s(   t   prescanRó   R`   Rµ   t   superR   t   obtain(   R~   Rò   t	   installerRB   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRö   ó  s    
c         C   si   | j  |  j d | ƒ | j ƒ  se | j ƒ  t j | ƒ t d | j j t j	 j
 | ƒ f ƒ ‚ n  d S(   s-   
        checker is a ContentChecker
        s   Validating %%s checksum for %ss7   %s validation failed for %s; possible download problem?N(   R…   Rµ   R‚   Rº   RP   t   unlinkR   R�   R)   R7   RK   (   R~   t   checkerRQ   t   tfp(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt
   check_hashü  s    
c         C   sr   xk | D]c } |  j  d k sJ t | ƒ sJ | j d ƒ sJ t t | ƒ ƒ rZ |  j | ƒ q |  j  j | ƒ q Wd S(   s;   Add `urls` to the list that will be prescanned for searchess   file:N(   R    R&   R±   R(   R³   R   Rê   t   append(   R~   t   urlsR3   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   add_find_links  s    c         C   s2   |  j  r% t t |  j |  j  ƒ ƒ n  d |  _  d S(   s7   Scan urls scheduled for prescanning (e.g. --find-links)N(   R    R³   R   Rê   R&   (   R~   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRô     s    	c         C   sN   |  | j  r  |  j d } } n |  j d } } | | | j ƒ |  j ƒ  d  S(   Ns#   Couldn't retrieve index page for %rs3   Couldn't find index page for %r (maybe misspelled?)(   R`   R¶   RÊ   Rð   Rï   (   R~   Rò   t   methR–   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRñ   !  s    
c         C   s½   t  | t ƒ s¡ t | ƒ } | r| |  j | j d ƒ | | ƒ } t | ƒ \ } } | j d ƒ rx |  j | | | ƒ } n  | St j	 j
 | ƒ r’ | St | ƒ } n  t |  j | | ƒ d d ƒ S(   s  Locate and/or download `spec` to `tmpdir`, returning a local path

        `spec` may be a ``Requirement`` object, or a string containing a URL,
        an existing local filename, or a project/version requirement spec
        (i.e. the string form of a ``Requirement`` object).  If it is the URL
        of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one
        that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is
        automatically created alongside the downloaded file.

        If `spec` is a ``Requirement`` object or a string containing a
        project/version requirement spec, this method returns the location of
        a matching distribution (possibly after downloading it to `tmpdir`).
        If `spec` is a locally existing file or directory name, it is simply
        returned unchanged.  If `spec` is a URL, it is downloaded to a subpath
        of `tmpdir`, and the local filename is returned.  Various errors may be
        raised if a problem occurs during downloading.
        i   s   .pyRD   N(   R¼   R   R±   t   _download_urlR@   R;   R'   t	   gen_setupRP   R7   RÉ   R#   RÂ   t   fetch_distributionR&   (   R~   R"   t   tmpdirR5   t   foundR*   R:   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR.   +  s    c   	         sF  ˆ j  d | ƒ i  ‰ d } d ‡  ‡ ‡ ‡ ‡ f d † } | rf ˆ j ƒ  ˆ j | ƒ | | ƒ } n  | r‹ | d k	 r‹ | | | ƒ } n  | d k rÂ ˆ j d k	 r³ ˆ j ƒ  n  | | ƒ } n  | d k rñ | rñ ˆ j | ƒ | | ƒ } n  | d k rˆ j d ˆ rd pd | ƒ n# ˆ j  d | ƒ | j d | j ƒ Sd S(	   s|  Obtain a distribution suitable for fulfilling `requirement`

        `requirement` must be a ``pkg_resources.Requirement`` instance.
        If necessary, or if the `force_scan` flag is set, the requirement is
        searched for in the (online) package index as well as the locally
        installed packages.  If a distribution matching `requirement` is found,
        the returned distribution's ``location`` is the value you would have
        gotten from calling the ``download()`` method with the matching
        distribution's URL or filename.  If no matching distribution is found,
        ``None`` is returned.

        If the `source` flag is set, only source distributions and source
        checkout links will be considered.  Unless the `develop_ok` flag is
        set, development and system eggs (i.e., those using the ``.egg-info``
        format) will be ignored.
        s   Searching for %sc            sØ   | d  k r ˆ } n  x¼ | |  j D]­ } | j t k rn ˆ  rn | ˆ k r# ˆ j d | ƒ d ˆ | <q# q# n  | |  k o� | j t k p� ˆ } | r# ˆ j | j ˆ ƒ } | | _ t	 j
 j | j ƒ rÐ | Sq# q# Wd  S(   Ns&   Skipping development or system egg: %si   (   R&   R`   R<   R   RÊ   R
   R.   RD   t   download_locationRP   R7   RÉ   (   t   reqt   envRB   t   testt   loc(   t
   develop_okR~   t   skippedt   sourceR  (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRu   e  s     	
	s:   No local packages or working download links found for %s%ss   a source distribution of R­   s   Best match: %sRD   N(   R¶   R&   Rô   Ró   R    RÊ   t   cloneR  (	   R~   Rò   R  t
   force_scanR  R
  t   local_indexRB   Ru   (    (   R
  R~   R  R  R  s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR  M  s0    

c         C   s/   |  j  | | | | ƒ } | d k	 r+ | j Sd S(   s3  Obtain a file suitable for fulfilling `requirement`

        DEPRECATED; use the ``fetch_distribution()`` method now instead.  For
        backward compatibility, this routine is identical but returns the
        ``location`` of the downloaded distribution instead of a distribution
        object.
        N(   R  R&   RD   (   R~   Rò   R  R  R  RB   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   fetch™  s    c      
   C   sp  t  j | ƒ } | rL g  t | | j d ƒ d  ƒ D] } | j r1 | ^ q1 pO g  } t | ƒ d k rAt j j	 | ƒ } t j j
 | ƒ | k rÞ t j j | | ƒ } d d l m }	 |	 | | ƒ sÞ t j | | ƒ | } qÞ n  t t j j | d ƒ d ƒ �? }
 |
 j d | d j | d j t j j | ƒ d f ƒ Wd  QX| S| r`t d | | f ƒ ‚ n t d	 ƒ ‚ d  S(
   Ni   iÿÿÿÿ(   t   samefiles   setup.pyt   wsI   from setuptools import setup
setup(name=%r, version=%r, py_modules=[%r])
i    s†   Can't unambiguously interpret project/version identifier %r; any dashes in the name or version should be escaped using underscores. %rsp   Can't process plain .py files without an '#egg=name-version' suffix to enable automatic setup script generation.(   R>   R?   R   R@   R&   RF   RJ   RP   R7   RK   t   dirnameRY   t   setuptools.command.easy_installR  t   shutilt   copy2RÞ   t   writeRE   t   splitextR   (   R~   RQ   R:   R  R?   t   dRÅ   RK   t   dstR  RÑ   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR  ¦  s2    4!!i    c      
   C   s‰  |  j  d | ƒ d  } zXt j | ƒ } |  j | ƒ } t | t j j ƒ rn t	 d | | j
 | j f ƒ ‚ n  | j  ƒ  } d } |  j } d } d | k rÛ t | d ƒ }	 t t t |	 ƒ ƒ } |  j | | | | | ƒ n  t | d ƒ �} }
 x` t rO| j | ƒ } | rK| j | ƒ |
 j | ƒ | d 7} |  j | | | | | ƒ qð Pqð W|  j | | |
 ƒ Wd  QX| SWd  | r„| j ƒ  n  Xd  S(	   Ns   Downloading %ss   Can't download %s: %s %si    iÿÿÿÿs   content-lengths   Content-Lengtht   wbi   (   R¶   R&   R‰   R“   R·   R¼   R   R½   R¾   R   R°   R–   t   dl_blocksizeR   t   maxR   t   intt
   reporthookRÞ   R�   R»   R€   R  Rû   Rº   (   R~   R3   RQ   t   fpRù   R¸   t   blocknumt   bst   sizet   sizesRú   R   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   _download_toÑ  s:    		
c         C   s   d  S(   N(    (   R~   R3   RQ   R!  t   blksizeR#  (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR  õ  s    c         C   s§  | j  d ƒ r t | ƒ Sy t | |  j ƒ SWnst t j f k
 r¥ } d j g  | j D] } t	 | ƒ ^ qX ƒ } | rŒ |  j
 | | ƒ q£t d | | f ƒ ‚ nþ t j j k
 r¾ } | St j j k
 r} | rï |  j
 | | j ƒ q£t d | | j f ƒ ‚ n˜ t j k
 rU} | r9|  j
 | | j ƒ q£t d | | j f ƒ ‚ nN t j t j f k
 r¢} | r‰|  j
 | | ƒ q£t d | | f ƒ ‚ n Xd  S(   Ns   file:t    s   %s %ss   Download error for %s: %ss;   %s returned a bad status line. The server might be down, %s(   R(   t
   local_opent   open_with_authR¤   R!   R   t
   InvalidURLRY   Rf   Rp   RÊ   R   R   R½   R¾   t   URLErrort   reasont   BadStatusLinet   linet   HTTPExceptiont   socket(   R~   R3   t   warningt   vt   argR–   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR·   ø  s6    
+c         C   sH  t  | ƒ \ } } | rL x7 d | k rH | j d d ƒ j d d ƒ } q Wn d } | j d ƒ rn | d  } n  t j j | | ƒ } | d k sž | j d	 ƒ r® |  j | | ƒ S| d
 k sÉ | j d ƒ rÙ |  j | | ƒ S| j d ƒ rø |  j	 | | ƒ S| d k r$t
 j j t
 j j | ƒ d ƒ S|  j | t ƒ |  j | | ƒ Sd  S(   Ns   ..t   .s   \t   _t   __downloaded__s   .egg.zipiüÿÿÿt   svns   svn+t   gits   git+s   hg+RÑ   i   (   R;   t   replaceR'   RP   R7   RY   R(   t   _download_svnt   _download_gitt   _download_hgR   R¥   t   url2pathnameR    R0   R´   R�   t   _attempt_download(   R~   R5   R3   R  R)   R:   RQ   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR     s$    % c         C   s   |  j  | t ƒ d  S(   N(   RÁ   R�   (   R~   R3   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRê   8  s    c         C   sK   |  j  | | ƒ } d | j d d ƒ j ƒ  k rC |  j | | | ƒ S| Sd  S(   NR¬   s   content-typeR­   (   R%  R¹   R%   t   _download_html(   R~   R3   RQ   R¸   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR>  ;  s    c         C   s‘   t  | ƒ } xW | D]O } | j ƒ  r t j d | ƒ r^ | j ƒ  t j | ƒ |  j | | ƒ SPq q W| j ƒ  t j | ƒ t d | ƒ ‚ d  S(   Ns    <title>([^- ]+ - )?Revision \d+:s   Unexpected HTML page found at (	   RÞ   Rq   RS   Rv   Rº   RP   Rø   R:  R   (   R~   R3   R¸   RQ   RÑ   R.  (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR?  B  s    

c         C   sl  | j  d d ƒ d } d } | j ƒ  j d ƒ r;d | k r;t j j | ƒ \ } } } } } }	 | r;| j d ƒ r;d | d	 k r;| d	 j  d d ƒ \ } } t j j | ƒ \ }
 } |
 r8d
 |
 k rø |
 j  d
 d ƒ \ } } d | | f } n
 d |
 } | } | | | | | |	 f } t j j | ƒ } q8q;n  |  j d | | ƒ t	 j
 d | | | f ƒ | S(   NR/   i   i    R­   s   svn:t   @s   //R-   i   t   :s    --username=%s --password=%ss    --username=s'   Doing subversion checkout from %s to %ss   svn checkout%s -q %s %s(   R2   R%   R(   R   R    R0   t	   splitusert
   urlunparseR¶   RP   t   system(   R~   R3   RQ   t   credsR5   t   netlocR7   RU   t   qRÇ   t   autht   hostt   usert   pwR4   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR:  Q  s$    !$&
c         C   s¥   t  j j |  ƒ \ } } } } } | j d d ƒ d } | j d d ƒ d } d  } d | k rz | j d d ƒ \ } } n  t  j j | | | | d f ƒ }  |  | f S(   Nt   +i   iÿÿÿÿR/   i    R@  R­   (   R   R    t   urlsplitR2   R&   t   rsplitt
   urlunsplit(   R3   t
   pop_prefixR5   RF  R7   R9   Rî   t   rev(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   _vcs_split_rev_from_urlf  s    !!c         C   s•   | j  d d ƒ d } |  j | d t ƒ\ } } |  j d | | ƒ t j d | | f ƒ | d  k	 r‘ |  j d | ƒ t j d | | f ƒ n  | S(	   NR/   i   i    RP  s   Doing git clone from %s to %ss   git clone --quiet %s %ss   Checking out %ss"   (cd %s && git checkout --quiet %s)(   R2   RR  R�   R¶   RP   RD  R&   (   R~   R3   RQ   RQ  (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR;  x  s    	c         C   s•   | j  d d ƒ d } |  j | d t ƒ\ } } |  j d | | ƒ t j d | | f ƒ | d  k	 r‘ |  j d | ƒ t j d | | f ƒ n  | S(	   NR/   i   i    RP  s   Doing hg clone from %s to %ss   hg clone --quiet %s %ss   Updating to %ss   (cd %s && hg up -C -r %s -q)(   R2   RR  R�   R¶   RP   RD  R&   (   R~   R3   RQ   RQ  (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR<  ˆ  s    	c         G   s   t  j | | Œ d  S(   N(   R   Rµ   (   R~   R–   Rf   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRµ   ˜  s    c         G   s   t  j | | Œ d  S(   N(   R   R¶   (   R~   R–   Rf   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR¶   ›  s    c         G   s   t  j | | Œ d  S(   N(   R   RÊ   (   R~   R–   Rf   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRÊ   ž  s    (   R™   N()   R†   R‡   Rˆ   R&   R�   R�   t   FalseRÁ   R²   R´   RÝ   RÙ   RÃ   Ré   Rï   Ró   Rö   Rû   Rþ   Rô   Rñ   R.   R  R  R  R  R%  R  R·   R   Rê   R>  R?  R:  t   staticmethodRR  R;  R<  Rµ   R¶   RÊ   (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR   (  sL   3	
		+								
	#J	)	$	#									s!   &(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?c         C   s   |  j  d ƒ } t | ƒ S(   Ni   (   R@   R   (   R?   t   what(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   decode_entity§  s    c         C   s   t  t |  ƒ S(   s'   Decode HTML entities in the given text.(   t
   entity_subRV  (   t   text(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRt   ¬  s    c            s   ‡  f d †  } | S(   Nc            s   ‡  ‡ f d †  } | S(   Nc             s?   t  j ƒ  } t  j ˆ ƒ z ˆ  |  | Ž  SWd  t  j | ƒ Xd  S(   N(   R0  t   getdefaulttimeoutt   setdefaulttimeout(   Rf   Rg   t   old_timeout(   Rh   t   timeout(    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   _socket_timeout³  s
    (    (   Rh   R]  (   R\  (   Rh   s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR]  ²  s    (    (   R\  R]  (    (   R\  s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   socket_timeout±  s    c         C   sI   t  j j |  ƒ } | j ƒ  } t j | ƒ } | j ƒ  } | j d d ƒ S(   sq  
    A function compatible with Python 2.3-3.3 that will encode
    auth from a URL suitable for an HTTP header.
    >>> str(_encode_auth('username%3Apassword'))
    'dXNlcm5hbWU6cGFzc3dvcmQ='

    Long auth strings should not cause a newline to be inserted.
    >>> long_auth = 'username:' + 'password'*10
    >>> chr(10) in str(_encode_auth(long_auth))
    False
    s   
R­   (   R   R    R1   t   encodet   base64t   encodestringRÀ   R9  (   RH  t   auth_st
   auth_bytest   encoded_bytest   encoded(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   _encode_authÀ  s
    t
   Credentialc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s:   
    A username/password pair. Use like a namedtuple.
    c         C   s   | |  _  | |  _ d  S(   N(   t   usernamet   password(   R~   Rh  Ri  (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR�   Ü  s    	c         c   s   |  j  V|  j Vd  S(   N(   Rh  Ri  (   R~   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   __iter__à  s    c         C   s   d t  |  ƒ S(   Ns   %(username)s:%(password)s(   t   vars(   R~   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   __str__ä  s    (   R†   R‡   Rˆ   R�   Rj  Rl  (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRg  ×  s   		t
   PyPIConfigc           B   s2   e  Z d  „  Z e d „  ƒ Z d „  Z d „  Z RS(   c         C   su   t  j d d d g d ƒ } t j j |  | ƒ t j j t j j d ƒ d ƒ } t j j	 | ƒ rq |  j
 | ƒ n  d S(   s%   
        Load from ~/.pypirc
        Rh  Ri  t
   repositoryR­   t   ~s   .pypircN(   t   dictt   fromkeysR   t   RawConfigParserR�   RP   R7   RY   t
   expanduserRÉ   R»   (   R~   t   defaultst   rc(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR�   é  s
    !c         C   sM   g  |  j  ƒ  D]$ } |  j | d ƒ j ƒ  r | ^ q } t t |  j | ƒ ƒ S(   NRn  (   t   sectionsR¹   Rq   Rp  R   t   _get_repo_cred(   R~   t   sectiont   sections_with_repositories(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   creds_by_repositoryô  s    $c         C   sO   |  j  | d ƒ j ƒ  } | t |  j  | d ƒ j ƒ  |  j  | d ƒ j ƒ  ƒ f S(   NRn  Rh  Ri  (   R¹   Rq   Rg  (   R~   Rx  t   repo(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRw  ý  s    c         C   s7   x0 |  j  j ƒ  D] \ } } | j | ƒ r | Sq Wd S(   sŒ   
        If the URL indicated appears to be a repository defined in this
        config, return the credential for that repository.
        N(   Rz  t   itemsR(   (   R~   R3   Rn  t   cred(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   find_credential  s    (   R†   R‡   R�   t   propertyRz  Rw  R~  (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyRm  è  s   			c         C   sÐ  t  j j |  ƒ \ } } } } } } | j d ƒ rE t j d ƒ ‚ n  | d	 k rl t  j j | ƒ \ } }	 n d
 } | sÁ t ƒ  j	 |  ƒ }
 |
 rÁ t
 |
 ƒ } |
 j |  f } t j d | Œ qÁ n  | r&d t | ƒ } | |	 | | | | f } t  j j | ƒ } t  j j | ƒ } | j d | ƒ n t  j j |  ƒ } | j d t ƒ | | ƒ } | rÌt  j j | j ƒ \ } } } } } } | | k rÌ| |	 k rÌ| | | | | | f } t  j j | ƒ | _ qÌn  | S(   s4   Open a urllib2 request, handling HTTP authenticationRA  s   nonnumeric port: ''t   httpt   httpss*   Authenticating as %s for %s (from .pypirc)s   Basic t   Authorizations
   User-Agent(   R€  R�  N(   R   R    R0   R'   R   R*  RB  R&   Rm  R~  Rp   Rh  R   R¶   Rf  RC  R¥   t   Requestt
   add_headert
   user_agentR3   (   R3   R¤   R5   RF  R7   t   paramsR9   Rî   RH  RI  R}  R¶   R4   Rí   R¥   R   t   s2t   h2t   path2t   param2t   query2t   frag2(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR)    s6    $'c         C   s   |  S(   N(    (   R3   (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt
   fix_sf_url?  s    c         C   s—  t  j j |  ƒ \ } } } } } } t  j j | ƒ } t j j | ƒ rX t  j j |  ƒ S| j	 d ƒ rPt j j
 | ƒ rPg  } x¿ t j | ƒ D]‡ }	 t j j | |	 ƒ }
 |	 d k rÞ t |
 d ƒ � } | j ƒ  } Wd QXPn t j j
 |
 ƒ rý |	 d 7}	 n  | j d j d |	 ƒ ƒ q� Wd } | j d |  d	 d
 j | ƒ ƒ } d \ } } n d \ } } } i d d 6} t j | ƒ } t  j j |  | | | | ƒ S(   s7   Read a local path, with special support for directoriesR-   s
   index.htmlt   rNs   <a href="{name}">{name}</a>R)   sB   <html><head><title>{url}</title></head><body>{files}</body></html>R3   t   filess   
iÈ   t   OKi”  s   Path not founds	   Not founds	   text/htmls   content-type(   iÈ   R�  (   i”  s   Path not founds	   Not found(   R   R    R0   R¥   R=  RP   R7   t   isfileR¦   R'   RË   RÍ   RY   RÞ   R»   Rü   t   formatR   t   StringIOR½   R¾   (   R3   R5   R6   R7   t   paramR9   Rî   RQ   R�  RÇ   t   filepathR   t   bodyRÆ   t   statust   messageR¸   t   body_stream(    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyR(  C  s,    $!!([   Rˆ   t   sysRP   RS   R  R0  R`  R‹   R×   t	   functoolsR    t   setuptools.externR   t   setuptools.extern.six.movesR   R   R   R   R   t   pkg_resourcesR   R   R   R	   R
   R   R   R   R   R   R   R   R   R   t	   distutilsR   t   distutils.errorsR   t   fnmatchR   t   setuptools.py27compatR   t   setuptools.py33compatR   t   setuptools.wheelR   R—   R>   t   IRr   Rë   R?   R±   R2   RI   t   __all__t   _SOCKET_TIMEOUTt   _tmplR’  RF   R…  R#   R   R;   R&   R   R=   RR   R   Re   Rj   Rm   R|   t   objectR}   R‰   R   Rì   RW  RV  Rt   R^  Rf  Rg  Rr  Rm  R¥   R¦   R)  R�  R(  (    (    (    s<   /usr/lib/python2.7/site-packages/setuptools/package_index.pyt   <module>   sv   "X							!"	!ÿ ÿ ~			&.	