
_Tc           @   s  d  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
 rq d d l Z n Xd 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 d d l m Z 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" d d l m# Z$ d d	 l% m& Z& m' Z' m( Z( m) Z) m* Z* d
 g Z+ d Z, d
 e- f d     YZ. d e- f d     YZ/ d e- f d     YZ0 d e- f d     YZ1 d   Z2 d   Z3 e4 d  Z5 d   Z6 d S(   s!   Routines related to PyPI, indexesiN(   t   logger(   t   Inf(   t   normalize_namet   splitext(   t   DistributionNotFoundt   BestVersionAlreadyInstalled(
   t   WindowsErrort   BytesIOt   Queuet   httplibt   urlparset   URLErrort	   HTTPErrort   ut   productt   url2pathname(   t   Empty(   t   urlopent   path_to_url2t   url_to_patht   geturlt   Urllib2HeadRequestt   PackageFinders   last.pypi.python.orgc           B   s   e  Z d  Z e d d d  Z d   Z e d    Z d   Z	 d   Z
 d   Z e j   Z d   Z e j d  Z e j d	 e j  Z e j d
  Z d   Z d   Z d   Z d   Z d   Z d d d  Z RS(   s   This finds packages.

    This is meant to match easy_install's technique for looking for
    packages, by reading pages and looking for appropriate links
    c         C   s{   | |  _  | |  _ g  |  _ t   |  _ t   |  _ | rn |  j | |  |  _ t	 j
 d d j |  j   n	 g  |  _ d  S(   Ns   Using PyPI mirrors: %ss   , (   t
   find_linkst
   index_urlst   dependency_linkst	   PageCachet   cachet   sett   logged_linkst   _get_mirror_urlst   mirror_urlsR    t   infot   join(   t   selfR   R   t   use_mirrorst   mirrorst   main_mirror_url(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   __init__*   s    			 c         C   s   |  j  j |  d  S(   N(   R   t   extend(   R"   t   links(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   add_dependency_links8   s    c            s   g    g      f d   } x |  D] } | j  d  r t |  } t j j |  r t j j |  } xR t j |  D] } | t j j | |   qz Wq t j j |  r | |  q q%  j	 |  q% W   f S(   st   
        Sort locations into "files" (archives) and "urls", and return
        a pair of lists (files,urls)
        c            sL   t  |   } t j | d t d d k r;  j |  n   j |  d  S(   Nt   stricti    s	   text/html(   R   t	   mimetypest
   guess_typet   Falset   append(   t   patht   url(   t   filest   urls(    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt	   sort_pathJ   s    s   file:(
   t
   startswithR   t   osR/   t   isdirt   realpatht   listdirR!   t   isfileR.   (   t	   locationsR3   R0   R/   t   item(    (   R1   R2   sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   _sort_locations?   s     c            sq  | j    d  } |  j r t t j |  j d     } |  j | |  } | d  k r |  j t |  j d    |  p} | j    q n  |  j |  j }   f d   }   d  k	 r g  | D] } | |  ^ q |  j	 } n t
 |  j	  } | j |  j  xH | j D]= }	   d  k	 r| d  k	 rt j | j |	  g | } qqW|  j |  \ }
 } g  | D] } t |  ^ q`} t j d |  x | D] } t j d |  qWg  } | j |  j g  |  j	 D] } t | d  ^ q| j j     g  } xy |  j | |  D]e } t j d | j  t j d 7_ z) | j |  j | j | j j     Wd  t j d 8_ XqWt
 |  j g  |  j D] } t |  ^ q| j j     } | rt j d d	 j g  | D] \ } } }	 | j ^ q  n  t
 |  j g  |
 D] } t |  ^ q| j j     } | rm| rm| rm| rmt j d
 |  t d |   n  | j d  k	 r| j | j j t | j j f  n  | r| j  d t!  t j d d	 j g  | D] \ } } }	 t" | j  ^ q  | | } n  | | | } g  } x | D]| \ } } }	 |	 | j# k rt j d | |	 d j g  | j# j$ D] } d j |  ^ q^ f  qn  | j | |	 f  qWt% | d d   d t! } t& g  | D] \ } }	 | t k r| ^ q } | rT| rT| d d t k r+t j d | j j  t'  n% t j d | j j | d d f  d  S| st j d | d	 j g  | D] \ } } }	 |	 ^ qs f  t d |   n  | d d t k rt j d | j j d	 j g  | d D] \ } }	 |	 ^ q pd f  t'  n  t( |  d k ret j d | d d d	 j g  | D] \ } }	 |	 ^ qB f  n  | d d S(   Ni    c            s2   t  j |     } | j d  s. | d } n  | S(   Nt   /(   t	   posixpathR!   t   endswith(   R0   t   loc(   t   url_name(    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   mkurl_pypi_urln   s    s#   URLs to search for versions for %s:s   * %ss   -fs   Analyzing links from page %si   s   dependency_links found: %ss   , s<   Could not find any downloads that satisfy the requirement %ss$   No distributions at all found for %st   reverses   Local files found: %ss-   Ignoring link %s, version %s doesn't match %st   ,t    t   keyc         S   s   t  j |  d  S(   Ni   (   t   pkg_resourcest   parse_version(   t   v(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   <lambda>   s    i   sL   Existing installed version (%s) is most up-to-date and satisfies requirementsU   Existing installed version (%s) satisfies requirement (most up-to-date version is %s)sN   Could not find a version that satisfies the requirement %s (from versions: %s)s,   No distributions matching the version for %ss=   Installed version (%s) is most up-to-date (past versions: %s)t   nones)   Using version %s (newest of versions: %s)()   RA   t   NoneR   t   LinkR>   R!   t	   _get_paget   _find_url_nameR   R   t   listR'   R   t   absolute_versionsR0   R<   R    t   debugt   _package_versionst   namet   lowert
   _get_pagest   indentR(   R    t   fatalR   t   satisfied_byR.   t   parsed_versionR   t   versiont   sortt   TrueR   t   reqt   specst   sortedt   boolR   t   len(   R"   R^   t   upgradet   main_index_urlt   paget   all_index_urlsRB   R0   R:   R[   t   file_locationst   url_locationst   locationt   found_versionst   page_versionst   dependency_versionst   parsedt   linkt   file_versionst   all_versionst   applicable_versionsRZ   t   st   existing_applicable(    (   RA   sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   find_requirement^   s    		1	&#5)	4<	1%?	<1				3	@		;c         C   s   | j  j d  s$ | j  d 7_  n  |  j | |  } | d k rW t j d |  d St | j  } xY | j D]N } t	 j
 | j j d   } | t |  k rp t j d | | f  | Sqp Wd S(   s   Finds the true URL name of a package, when the given name isn't quite correct.
        This is usually used to implement case-insensitivity.R=   s   Cannot fetch index base URL %sNs!   Real name of requirement %s is %s(   R0   R?   RN   RL   R    RX   R   RA   R(   R>   t   basenameR/   t   rstript   notify(   R"   t	   index_urlRA   R^   Re   t	   norm_nameRn   t   base(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRO      s    c   
   	   C   s   t    } x | D] } | j |  q Wg  } t   } g  } xn t t d t |    D]Q } t j d |  j d | | | | f  }	 |	 j	 t
  | j |	  |	 j   qX Wx | D] }	 |	 j   q W| S(   s   Yields (page, page_url) from the given locations, skipping
        locations that have errors, and adding download/homepage linksi
   t   targett   args(   R   t   putR   t   ranget   minRb   t	   threadingt   Threadt   _get_queued_paget	   setDaemonR]   R.   t   startR!   (
   R"   R:   R^   t   pending_queueRi   t   donet   seent   threadst   it   t(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRV      s    		"'c         C   s   x y | j  t  } Wn t k
 r* d  SX| | k r= q n  | j |  |  j | |  } | d  k rn q n  | j |  x! | j   D] } | j |  q Wq d  S(   N(	   t   getR-   t
   QueueEmptyt   addRN   RL   R.   t	   rel_linksR}   (   R"   R^   R   R   R   Ri   Re   Rn   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR      s    s   #egg=([^&]*)s   ([a-z0-9_.]+)-([a-z0-9_.-]+)s   -py([123]\.?[0-9]?)$c         C   sq   g  g  } } t    } xP | D]H } | | k r | j |  | j rU | j |  qe | j |  q q W| | S(   sg   Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates(   R   R   t   egg_fragmentR.   (   R"   R(   t   eggst   no_eggsR   Rn   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   _sort_links   s    		c         c   s@   x9 |  j  |  D]( } x |  j | |  D] } | Vq) Wq Wd  S(   N(   R   t   _link_package_versions(   R"   R(   t   search_nameRn   RI   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRS     s    c         C   s  | j  r | j  } n| j   \ } } | sd | |  j k r` t j d |  |  j j |  n  g  S| j d  r | d  } d | } n  | d k r | |  j k r t j d | | f  |  j j |  n  g  Sd	 | j k r%| d k r%| |  j k r!t j d
 |  |  j j |  n  g  S|  j | | |  } | d k rat j d | | f  g  S|  j
 j |  } | r| | j    } | j d  } | t j d  k rt j d |  g  Sn  t j d | | f  t j |  | | f g S(   s   
        Return an iterable of triples (pkg_resources_version_key,
        link, python_version) that can be extracted from the given
        link.

        Meant to be overridden by subclasses, not called by clients.
        s   Skipping link %s; not a files   .taris   .tar.gzs   .tar.bz2s   .tgzs   .zips,   Skipping link %s; unknown archive format: %st   macosx10s   Skipping link %s; macosx10 ones-   Skipping link %s; wrong project name (not %s)i   i   s/   Skipping %s because Python version is incorrects   Found link %s, version: %s(   s   .tar.gzs   .tar.bz2s   .tars   .tgzs   .zipN(   R   R   R   R    RR   R   R?   R/   t   _egg_info_matchesRL   t   _py_version_ret   searchR   t   groupt   sysR[   RG   RH   (   R"   Rn   R   t   egg_infot   extR[   t   matcht
   py_version(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     sH    	
c         C   s   |  j  j |  } | s- t j d |  d  S| j d  j   } | j d d  } | j | j    r | j d  t	 |  j
 d  Sd  Sd  S(   Ns%   Could not parse version from link: %si    t   _t   -(   t   _egg_info_reR   R    RR   RL   R   RU   t   replaceR4   Rb   t   lstrip(   R"   R   R   Rn   R   RT   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   A  s     c         C   s   t  j | | d |  j S(   NR   (   t   HTMLPaget   get_pageR   (   R"   Rn   R^   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRN   N  s    c         C   s   | s" t  |  } t j |  n  t   } x\ | D]T } d pG d pG d | k r] d | } n  | j d  sy d | } n  | j |  q2 Wt |  S(   sq   Retrieves a list of URLs from the main mirror DNS entry
        unless a list of mirror URLs are passed.
        s   http://s   https://s   file://s	   http://%ss   /simples
   %s/simple/(   t   get_mirrorst   randomt   shuffleR   R?   R   RP   (   R"   R$   R%   R   t
   mirror_url(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   Q  s    	N(   t   __name__t
   __module__t   __doc__R-   RL   R&   R)   t   staticmethodR<   Rt   RO   RV   R   t   Lockt	   _log_lockR   t   ret   compilet   _egg_fragment_ret   IR   R   R   RS   R   R   RN   R   (    (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   #   s$   		g						/		R   c           B   sV   e  Z d  Z d Z d   Z d   Z d   Z d   Z e d  Z	 d   Z
 d   Z RS(	   s   Cache of HTML pagesi   c         C   s   i  |  _  i  |  _ i  |  _ d  S(   N(   t	   _failurest   _pagest	   _archives(   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR&   k  s    		c         C   s   |  j  j | d  |  j k S(   Ni    (   R   R   t   failure_limit(   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   too_many_failuresp  s    c         C   s   |  j  j |  S(   N(   R   R   (   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   s  s    c         C   s   |  j  j | t  S(   N(   R   R   R-   (   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt
   is_archivev  s    c         C   s   | |  j  | <d  S(   N(   R   (   R"   R0   t   value(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   set_is_archivey  s    c         C   s$   |  j  j | d  | |  j  | <d  S(   Ni    (   R   R   (   R"   R0   t   level(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   add_page_failure|  s    c         C   s"   x | D] } | |  j  | <q Wd  S(   N(   R   (   R"   R2   Re   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   add_page  s    (   R   R   R   R   R&   R   R   R   R]   R   R   R   (    (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   f  s   					R   c           B   s  e  Z d  Z e j d e j  Z e j d e j  Z e j d e j  Z e j d e j e j	 B Z
 e j d e j  Z d d  Z d   Z e d e d   Z e d	    Z e d
    Z e d    Z d   Z d d  Z d   Z e j d e j  Z d   Z RS(   s'   Represents one page, along with its URLs   <th>\s*home\s*pages   <th>\s*download\s+urls&   <[^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*>s(   href=(?:"([^"]*)"|'([^']*)'|([^>\s\n]*))s!   <base\s+href\s*=\s*['"]?([^'">]+)c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   contentR0   t   headers(   R"   R   R0   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR&     s    		c         C   s   |  j  S(   N(   R0   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   __str__  s    c      
   C   sU  | j  } | j d d  d } | j |  r2 d  Sd d l m } xT | j D]I } | j   j |  rL | t	 |  d k rL t
 j d t    d  SqL W| d  k	 r | j |  } | d  k	 r | Sn  y| r| d  k	 r | j |  r d  Sn  | j }	 x d d	 d
 d d g D]w }
 |	 j |
  r|  j |  } | j   j d  rNPqt
 j d | | f  | d  k	 r| j |  n  d  SqqWn  t
 j d |  t j |  \ } } } } } } | d k r't j j t |   r'| j d  s| d 7} n  t j | d  } t
 j d |  n  t |  } t |  } | j   } | j   } | j d d   } | d  k	 r| d k rt j d t  |   j   } n  | d k rt! j" |  } qn  |  t# |  | |  } WnMt$ t% t& j' t& j( t) t* f k
 r+t+ j,   d } t- |  } t. | t& j'  rJt
 j } d } d } n t. | t%  rt
 j } t/ | d  rt. | j0 t& j'  rd } d } qd } n? t. | t$  r| j1 d k rt
 j } d } n t
 j } d } | d | | f  | d | j  | f  | d  k	 r'| j2 | |  n  d  SX| d  k	 rQ| j3 | | g |  n  | S(   Nt   #i   i    i(   t
   VcsSupports   +:s&   Cannot look at %(scheme)s URL %(link)ss   .tars   .tar.gzs   .tar.bz2s   .tgzs   .zips	   text/htmls,   Skipping page %s because of Content-Type: %ss   Getting page %st   fileR=   s
   index.htmls#    file: URL is directory, getting %ss   Content-Encodingt   gzipt   fileobjt   deflates	   timed outt   reasoni   i  s   Could not fetch URL %s: %ss7   Will skip URL %s when looking for download links for %s(4   R0   t   splitR   RL   t   pip.vcsR   t   schemesRU   R4   Rb   R    RR   t   localsR   R   t   filenameR?   t   _get_content_typeR   R
   R5   R/   R6   R   t   urljoinR   R   R    t   readR   R   t   GzipFileR   t   zlibt
   decompressR   R   R   t   sockett   timeoutt   errort   OSErrorR   R   t   exc_infot   strt
   isinstancet   hasattrR   t   codeR   R   (   t   clsRn   R^   R   t   skip_archivesR0   R   t   schemet   instR   t   bad_extt   content_typet   netlocR/   t   paramst   queryt   fragmentt   respt   real_urlR   t   contentst   encodingt   et   desct   log_methR   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s    	+	!$!%			$					c         C   s   t  j |   \ } } } } } | d k r. d St |  d i | d 6} t |  } zH t | d  r | j d	 k r | d k r d S| j   j d
 d  SWd | j   Xd S(   s;   Get the Content-Type of the given url, using a HEAD requestt   httpt   httpst   ftpt   ftpsRE   R   t   HostR   i   s   content-typeN(   s   https   httpss   ftpR   (   s   ftpR   (	   R
   t   urlsplitR   R   R   R   R    R   t   close(   R0   R   R   R/   R   R   R^   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s    *c         C   sU   t  |  d  sN |  j j |  j  } | r? | j d  |  _ qN |  j |  _ n  |  j S(   Nt	   _base_urli   (   R   t   _base_reR   R   R   R   R0   (   R"   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   base_url  s    c         c   s}   xv |  j  j |  j  D]_ } | j d  pF | j d  pF | j d  } |  j t j |  j |   } t | |   Vq Wd S(   s   Yields all links in the pagei   i   i   N(	   t   _href_ret   finditerR   R   t
   clean_linkR
   R   R   RM   (   R"   R   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR(     s    -c         c   s<   x |  j    D] } | Vq Wx |  j   D] } | Vq) Wd  S(   N(   t   explicit_rel_linkst   scraped_rel_links(   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s    	t   homepaget   downloadc         c   s   x |  j  j |  j  D] } | j d  j   j   } x! | D] } | | k r> Pq> q> Wq |  j j | j d   } | s q n  | j d  p | j d  p | j d  } |  j t	 j
 |  j |   } t | |   Vq Wd S(   s)   Yields all links with the given relationsi   i    i   i   N(   t   _rel_reR   R   R   RU   R   R   R   R   R
   R   R   RM   (   R"   t   relsR   t
   found_relst   relR0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s    -c         c   s   x |  j  |  j f D] } | j |  j  } | s7 q n  |  j j |  j d | j   } | sd q n  | j d  p | j d  p | j d  } | s q n  |  j t j	 |  j
 |   } t | |   Vq Wd  S(   Nt   posi   i   i   (   t   _homepage_ret   _download_reR   R   R   t   endR   R   R
   R   R   RM   (   R"   t   regexR   t
   href_matchR0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   )  s    !-s   [^a-z0-9$&+,/:;=?@.#%_\\|-]c         C   s   |  j  j d   |  S(   s   Makes sure a link is fully encoded.  That is, if a ' ' shows up in
        the link, it will be rewritten to %20 (while not over-quoting
        % or other characters).c         S   s   d t  |  j d   S(   Ns   %%%2xi    (   t   ordR   (   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRJ   >  s    (   t	   _clean_ret   sub(   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   9  s    	N(   s   homepages   download(   R   R   R   R   R   R   R  R  R   t   SR   R   RL   R&   R   t   classmethodR]   R   R   R   t   propertyR   R(   R   R   R   R
  R   (    (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s$   	W
		RM   c           B   s   e  Z d d   Z d   Z d   Z d   Z d   Z e d    Z	 e d    Z
 e d    Z d   Z e d	    Z e j d
  Z e d    Z e j d  Z e d    Z e d    Z RS(   c         C   s   | |  _  | |  _ d  S(   N(   R0   t
   comes_from(   R"   R0   R  (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR&   C  s    	c         C   s(   |  j  r d |  j |  j  f S|  j Sd  S(   Ns   %s (from %s)(   R  R0   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   G  s    	c         C   s   d |  S(   Ns	   <Link %s>(    (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   __repr__M  s    c         C   s   |  j  | j  k S(   N(   R0   (   R"   t   other(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   __eq__P  s    c         C   s   t  |  j  S(   N(   t   hashR0   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   __hash__S  s    c         C   s2   |  j  } t j |  } | s. t d |   | S(   Ns   URL %r produced no filename(   t   url_fragmentR>   Ru   t   AssertionError(   R"   R0   RT   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   V  s    	c         C   s   t  j |  j  d S(   Ni    (   R
   R   R0   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   ]  s    c         C   s   t  j |  j  d S(   Ni   (   R
   R   R0   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR/   a  s    c         C   s   t  t j |  j j d    S(   NR=   (   R   R>   Ru   R/   Rv   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   e  s    c         C   sH   |  j  } | j d d  d } | j d d  d } | j d  } | S(   NR   i   i    t   ?R=   (   R0   R   Rv   (   R"   R0   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR  h  s
    	s   #egg=([^&]*)c         C   s,   |  j  j |  j  } | s d  S| j d  S(   Ni   (   R   R   R0   RL   R   (   R"   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR   r  s    s   md5=([a-f0-9]+)c         C   s,   |  j  j |  j  } | r( | j d  Sd  S(   Ni   (   t   _md5_reR   R0   R   RL   (   R"   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   md5_hash{  s    c         C   s0   t  j |  j j d d  d j d d  d  S(   NR   i   i    R  (   R>   Ru   R0   R   (   R"   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   show_url  s    N(   R   R   RL   R&   R   R  R  R  R  R   R   R/   R   R  R   R   R   R   R  R  R  (    (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyRM   A  s   					c         C   s;   t  |   } | j } | s1 t | j  d } n  t |  S(   sP   Get a requirement from the URL, if possible.  This looks for #egg
    in the URLi    (   RM   R   R   R   t   package_to_requirement(   R0   Rn   R   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   get_requirement_from_url  s
    	c         C   sa   t  j d |   } | r9 | j d  } | j d  } n |  } d } | rY d | | f S| Sd S(   s)   Translate a name like Foo-1.2 to Foo==1.3s   ^(.*?)-(dev|\d.*)i   i   RE   s   %s==%sN(   R   R   R   (   t   package_nameR   RT   R[   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR    s    c         C   s   |  d k r t }  n  y t j |   d }  Wn t j k
 rC g  SX|  j d d  } g  t | d  D] } d | | d f ^ qg S(   s7  Return the list of mirrors from the last record found on the DNS
    entry::

    >>> from pip.index import get_mirrors
    >>> get_mirrors()
    ['a.pypi.python.org', 'b.pypi.python.org', 'c.pypi.python.org',
    'd.pypi.python.org']

    Originally written for the distutils2 project by Alexis Metaireau.
    i    t   .i   s   %s.%sN(   RL   t   DEFAULT_MIRROR_URLR   t   gethostbyname_ext   gaierrorR   t   string_range(   t   hostnamet
   end_letterRr   (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR     s    	c         c   si   xb t  t |    D]N } xE t t j d | d D]* } d j |  } | V| |  k r3 d Sq3 Wq Wd S(   s   Compute the range of string between "a" and last.

    This works for simple "a to z" lists, but also for "a to zz" lists.
    t   repeati   RE   N(   R~   Rb   R   t   stringt   ascii_lowercaseR!   (   t   lastt   kt   xt   result(    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyR"    s     (7   R   R   R5   R   R   R+   R   t   ImportErrort   dummy_threadingR>   RG   R   R   R&  R   t   pip.logR    t   pip.utilR   R   R   t   pip.exceptionsR   R   t   pip.backwardcompatR   R   R   R	   R
   R   R   R   R   R   R   R   t   pip.downloadR   R   R   R   R   t   __all__R  t   objectR   R   R   RM   R  R  RL   R   R"  (    (    (    sa   /var/www/send.findwatt.com/datamanager/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/index.pyt   <module>   sB   F(	 DF	
	