
Rc           @   s  d  Z  d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k	 Z	 d d k
 Z
 d d k Z d d k Z y d d k Z Wn e j
 o d d k Z n Xd d k l Z d d k l Z l Z l Z l Z d d k l Z l Z l Z d d k l Z l Z l Z l Z l  Z  l! Z! l" Z" l# Z# l$ Z$ l% Z& d d k l' Z' d d k( l) Z) l* Z* l+ Z+ l, Z, l- Z- d d	 k. l/ Z/ l0 Z0 l1 Z1 l2 Z2 d d
 k3 l4 Z4 l5 Z5 l6 Z6 d d k7 l8 Z8 d g Z9 d Z: d e; f d     YZ< d e; f d     YZ= d e; f d     YZ> d e; f d     YZ? e? e  Z@ d   ZA d   ZB eC d  ZD d   ZE d S(   s!   Routines related to PyPI, indexesiN(   t   logger(   t   Inft   normalize_namet   splitextt   is_prerelease(   t   DistributionNotFoundt   BestVersionAlreadyInstalledt   InstallationError(
   t   WindowsErrort   BytesIOt   Queuet   urlparset   URLErrort	   HTTPErrort   ut   productt   url2pathnamet   Empty(   t   CertificateError(   t   urlopent   path_to_url2t   url_to_patht   geturlt   Urllib2HeadRequest(   t   Wheelt	   wheel_extt   wheel_setuptools_supportt   setuptools_requirement(   t   supported_tagst   supported_tags_noarcht   get_platform(   t   html5libt   PackageFinders   last.pypi.python.orgc        
   B   s  e  Z d  Z e d d e g  g  e e e d 	 Z e d    Z e i d    Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z e i   Z d   Z e i d  Z e i d e i  Z e i d  Z 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   |  _ | o6 |  i | |  |  _ t	 i
 d d i |  i   n
 g  |  _ | |  _ t d   | D  |  _ t d   | D  |  _ |	 |  _ |
 |  _ t |  _ t |  _ | |  _ d  S(   Ns   Using PyPI mirrors: %ss   , c         s   s   x |  ] } t  |  Vq Wd  S(   N(   R   (   t   .0t   n(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pys	   <genexpr>D   s   	 c         s   s   x |  ] } t  |  Vq Wd  S(   N(   R   (   R!   R"   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pys	   <genexpr>G   s   	 (   t
   find_linkst
   index_urlst   dependency_linkst	   PageCachet   cachet   sett   logged_linkst   _get_mirror_urlst   mirror_urlsR    t   infot   joint	   use_wheelt   allow_externalt   allow_insecuret   allow_all_externalt   allow_all_insecuret   Falset   need_warn_externalt   need_warn_insecuret   allow_all_prereleases(   t   selfR#   R$   t   use_mirrorst   mirrorst   main_mirror_urlR.   R/   R0   R1   R2   R6   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __init__1   s"    			!						c         C   s   |  i  S(   N(   t
   _use_wheel(   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR.   Z   s    c         C   s6   | |  _  |  i  o t   o t d t   n d  S(   Ns    pip's wheel support requires %s.(   R<   R   R   R   (   R7   t   value(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR.   ^   s    	c         C   s   |  i  i |  d  S(   N(   R%   t   extend(   R7   t   links(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   add_dependency_linksd   s    c   	         sT  g    g      f d   } x)| D]!} t  i i |  } | i d  } | |  i j } | p | o | o
 | } n t |  } | o\ t  i i |  oI t  i i |  } x t  i |  D] } | t  i i	 | |   q WqF| o$ t  i i |  o  i
 |  qFt  i i |  o | |  qFq%  i
 |  q% W   f S(   st   
        Sort locations into "files" (archives) and "urls", and return
        a pair of lists (files,urls)
        c            sN   t  |   } t i | d t d d j o  i |  n   i |  d  S(   Nt   stricti    s	   text/html(   R   t	   mimetypest
   guess_typeR3   t   append(   t   patht   url(   t   filest   urls(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt	   sort_patht   s     s   file:(   t   osRE   t   existst
   startswithR#   R   t   isdirt   realpatht   listdirR-   RD   t   isfile(	   R7   t	   locationsRI   RF   t   is_local_patht   is_file_urlt   is_find_linkRE   t   item(    (   RG   RH   sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   _sort_locationsk   s.     
 !c         C   st   | \ } } } |  i  oS t t  } | t j o
 d } n& | i o | i i   } n | } | | f S| Sd S(   sL  
        Function used to generate link sort key for link tuples.
        The greater the return value, the more preferred it is.
        If not finding wheels, then sorted by version only.
        If finding wheels, then the sort order is by version, then:
          1. existing installs
          2. wheels ordered via Wheel.support_index_min()
          3. source archives
        Note: it was considered to embed this logic into the Link
              comparison operators, but then different sdist links
              with the same version, would have to be considered equal
        i   N(   R.   t   lenR   t   InfLinkt   wheelt   support_index_min(   R7   t
   link_tuplet   parsed_versiont   linkt   _t   support_numt   pri(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   _link_sort_key   s    


c         C   s   t  | d |  i d t S(   s   
        Bring the latest version (and wheels) to the front, but maintain the existing ordering as secondary.
        See the docstring for `_link_sort_key` for details.
        This function is isolated for easier unit testing.
        t   keyt   reverse(   t   sortedRa   t   True(   R7   t   applicable_versions(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   _sort_versions   s    c   )   )      sx    f d   } | i    d  } |  i ox t | |  i d  d t } |  i | |  } | d  j o6 |  i t |  i d d t   |  p | i    q n |  i |  i }   d  j	 o2 g  } | D] } | | |  q ~ |  i }	 n t	 |  i  }	 xK | i
 D]@ }
   d  j	 o- | d  j	 o  t i | i |
  g |	 }	 qqW|  i |	  \ } } |  i |  i  \ } } | i |  g  } | D] } | t | d t q~ }	 |	 i g  } | D] } | t |  q~  t i d |  x |	 D] } t i d |  qWg  } | i |  i g  } |  i D] } | t | d d t q4~ | i i     g  } xy |  i |	 |  D]e } t i d | i  t i d 7_ z) | i |  i | i | i i     Wd  t i d 8_ XqWt	 |  i g  } |  i D] } | t |  q~ | i i     } | oE t i d	 d
 i g  } | D] \ } } }
 | | i qQ~   n t	 |  i g  } | D] } | t |  q~ | i i     } | o | oy | oq | oi t i d |  |  i o t i d | i  n |  i o t i d | i  n t d |   n g  } | i d  j	 o" | i i  t! | i i" f g } n | o[ | i# d t  t i d d
 i g  } | D] \ } } }
 | t$ | i  q~   n | | | | | } g  } x | D] \ }  } }
 |
 | i% j oT t i d | |
 d i g  }! | i% i& D] }" |! d i |"  qI~!  f  qnR t' |
  oD |  i( p | i) o/ | t! j	 o t i d | |
 f  qqn | i* |  | |
 f  qW|  i+ |  } t, g  }# | D]' \ }  } }
 | t! j o |# | qq~#  }$ | oa |$ oZ | d d t! j o t i d | i i"  n& t i d | i i" | d d f  d  S| p t i d | d
 i g  }% | D] \ }  } }
 |% |
 q~%  f  |  i o t i d  n |  i o t i d | i  n t d |   n | d d t! j o_ t i d | i i" d
 i g  }& | d D] \ }  } }
 |& |
 qs~&  p d f  t-  n t. |  d j oP t i d | d d d
 i g  }' | D] \ }  } }
 |' |
 q~'  f  n | d d }( |( i/ d  j	 o |( i/ o t i d  n |( i0 d  j	 o |( i0 o t i d  n |( S(    Nc            s4   t  i |     } | i d  p | d } n | S(   Nt   /(   t	   posixpathR-   t   endswith(   RF   t   loc(   t   url_name(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   mkurl_pypi_url   s    i    t   trusteds#   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 %ssM   Some externally hosted files were ignored (use --allow-external %s to allow).sU   Some insecure and unverifiable files were ignored (use --allow-insecure %s to allow).s$   No distributions at all found for %sRc   s   Local files found: %ss-   Ignoring link %s, version %s doesn't match %st   ,t    sC   Ignoring link %s, version %s is a pre-release (use --pre to allow).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)sJ   Some externally hosted files were ignored (use --allow-external to allow).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)sy   You are installing an externally hosted file. Future versions of pip will default to disallowing externally hosted files.s   You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.(1   Rl   t   NoneR$   t   LinkRe   t	   _get_paget   _find_url_nameR+   R#   t   listt   absolute_versionsRi   R-   RF   RV   R%   R>   R    t   debugt   _package_versionst   namet   lowert
   _get_pagest   indentR?   R,   t   fatalR4   t   warnR5   R   t   satisfied_byR\   RX   t   versiont   sortR   t   reqt   specsR   R6   t   prereleasesRD   Rg   t   boolR   RW   t   internalt
   verifiable()   R7   R   t   upgradeRm   t   main_index_urlt   paget   all_index_urlst   _[1]RF   RQ   R   t   file_locationst   url_locationst   _flocationst   _ulocationst   _[2]t   _[3]t   locationt   found_versionst   _[4]t   page_versionst   _[5]t   dependency_versionst   _[6]t   parsedR]   t   _[7]t   file_versionst   installed_versiont   _[8]t   all_versionsRf   R\   t   _[9]t   st   _[10]t   existing_applicablet   _[11]t   _[12]t   _[13]t   selected_version(    (   Rl   sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   find_requirement   s    
	
:+
 $-. C )	<E	9 
	
	"K 	D"A			;

		L
	Gc         C   s   | i  i d  p | i  d 7_  n |  i | |  } | d j o t i d |  d St | i  } x[ | i D]P } t	 i
 | i i d   } | t |  j o t i d | | f  | Sqt 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.Rh   s   Cannot fetch index base URL %sNs!   Real name of requirement %s is %s(   RF   Rj   Rt   Rr   R    R~   R   Rl   R?   Ri   t   basenameRE   t   rstript   notify(   R7   t	   index_urlRl   R   R   t	   norm_nameR]   t   base(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRu   Q  s    
 	c   
      C   s   t    } x | D] } | i |  q Wg  } t   } g  } xn t t d t |    D]Q } t i d |  i d | | | | f  }	 |	 i	 t
  | i |	  |	 i   qX Wx | D] }	 |	 i   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   minRW   t	   threadingt   Threadt   _get_queued_paget	   setDaemonRe   RD   t   startR-   (
   R7   RQ   R   t   pending_queueR   t   donet   seent   threadst   it   t(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR|   d  s"    	 	 ' c   	      C   sT  xMy | i  t  } Wn t j
 o d  SX| | j o q n | i |  |  i | |  } | d  j o q n | i |  x | i   D] } t | i	  i
   } | |  i j o, |  i o! t |  _ t i d |  q n | i d  j	 oG | i o< | |  i j o, |  i o! t i d |  t |  _ q n | i |  q Wq d  S(   Ns@   Not searching %s for files because external urls are disallowed.s_   Not searching %s for urls, it is an untrusted link and cannot produce safe or verifiable files.(   t   getR3   t
   QueueEmptyt   addRt   Rr   RD   t	   rel_linksR   Rz   R{   R/   R1   Re   R4   R    Rx   Rn   R0   R2   R5   R   (	   R7   R   R   R   R   R   R   R]   t
   normalized(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR   x  s<     				s   #egg=([^&]*)s   ([a-z0-9_.]+)-([a-z0-9_.-]+)s   -py([123]\.?[0-9]?)$c         C   su   g  g  } } t    } xT | D]L } | | j o9 | i |  | i o | i |  qi | i |  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_fragmentRD   (   R7   R?   t   eggst   no_eggsR   R]   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   _sort_links  s    	 
c         c   s@   x9 |  i  |  D]( } x |  i | |  D] } | Vq) Wq Wd  S(   N(   R   t   _link_package_versions(   R7   R?   t   search_nameR]   t   v(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRy     s
      c         C   s    d } |  i  o | t f S| S(   Ns   .tar.gzs   .tar.bz2s   .tars   .tgzs   .zip(   s   .tar.gzs   .tar.bz2s   .tars   .tgzs   .zip(   R.   R   (   R7   t
   extensions(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   _known_extensions  s    
c   
      C   s  t    } d } | i o | i } n| i   \ } } | p: | |  i j o% t i d |  |  i i |  n g  S| i d  o | d  } d | } n | |  i	   j o@ | |  i j o+ t i d | | f  |  i i |  n g  Sd | i
 j oG | d j o: | |  i j o% t i d |  |  i i |  n g  S| i o | i i i   | i   j o | i i } | i i   p t i d |  g  St | d	 d  } | i d
  o\ | d j	 oO t i | i  i i d  o0 | i i d t  p t i d |  g  Sq)n | p |  i | | |  } n | d j o t i d | | f  g  S| i d j	 oQ | i oF t |  i   |  i j o* |  i o t i d |  t |  _ g  S| i d j	 oQ | i oF t |  i   |  i j o* |  i o t i d |  t |  _  g  S|  i! i" |  } | oM | | i#    } | i$ d  }	 |	 t% i d  j o t i d |  g  Sn t i d | | f  t& i' |  | | 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,   Skipping link %s; unknown archive format: %st   macosx10s   .zips   Skipping link %s; macosx10 ones9   Skipping %s because it is not compatible with this Pythont
   comes_fromt   wins   pypi.python.orgt   tagssO   Skipping %s because it is a pypi-hosted binary Wheel on an unsupported platforms-   Skipping link %s; wrong project name (not %s)s,   Skipping %s because it is externally hosted.s<   Skipping %s because it is an insecure and unverifiable file.i   i   s/   Skipping %s because Python version is incorrects   Found link %s, version: %sN((   R   Rr   R   R   R)   R    Rx   R   Rj   R   RE   RY   Rz   R{   R   t	   supportedt   getattrRL   R   RF   t   netlocR   t   _egg_info_matchesR   R   R/   R1   Re   R4   R   R0   R2   R5   t   _py_version_ret   searchR   t   groupt   syst   pkg_resourcest   parse_version(
   R7   R]   R   t   platformR   t   egg_infot   extR   t   matcht
   py_version(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    	

)	
				c         C   s   |  i  i |  } | p t i d |  d  S| i d  i   } | i d d  } | i   d } | i |  o | i d  t	 |  Sd  Sd  S(   Ns%   Could not parse version from link: %si    R^   t   -(
   t   _egg_info_reR   R    Rx   Rr   R   R{   t   replaceRL   RW   (   R7   R   R   R]   R   Rz   t   look_for(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    c         C   s   t  i | | d |  i S(   NR'   (   t   HTMLPaget   get_pageR'   (   R7   R]   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRt   )  s    c         C   s   | p t  |  } t i |  n t   } x | D] } | i d  } t g  } d d d g D] } | | i |  q` ~  p d | } n | i d  p d | } n | i | d  q4 Wt	 |  S(   sq   Retrieves a list of URLs from the main mirror DNS entry
        unless a list of mirror URLs are passed.
        Rh   s   http://s   https://s   file://s	   http://%ss   /simples	   %s/simple(
   t   get_mirrorst   randomt   shuffleR(   R   t   anyRL   Rj   R   Rv   (   R7   R9   R:   R+   t
   mirror_urlR   t   scheme(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR*   ,  s    	 :N(!   t   __name__t
   __module__t   __doc__R3   Rr   R;   t   propertyR.   t   setterR@   RV   Ra   Rg   R   Ru   R|   R   t   Lockt	   _log_lockR   t   ret   compilet   _egg_fragment_ret   IR   R   R   Ry   R   R   R   Rt   R*   (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR    *   s4   		%		(						#				c		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   h  |  _  h  |  _ h  |  _ d  S(   N(   t	   _failurest   _pagest	   _archives(   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR;   G  s    		c         C   s   |  i  i | d  |  i j S(   Ni    (   R   R   t   failure_limit(   R7   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   too_many_failuresL  s    c         C   s   |  i  i |  S(   N(   R   R   (   R7   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR   O  s    c         C   s   |  i  i | t  S(   N(   R   R   R3   (   R7   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt
   is_archiveR  s    c         C   s   | |  i  | <d  S(   N(   R   (   R7   RF   R=   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   set_is_archiveU  s    c         C   s$   |  i  i | d  | |  i  | <d  S(   Ni    (   R   R   (   R7   RF   t   level(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   add_page_failureX  s    c         C   s"   x | D] } | |  i  | <q Wd  S(   N(   R   (   R7   RH   R   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   add_page[  s     (   R   R   R   R   R;   R   R   R   Re   R   R   R  (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR&   B  s   					R   c           B   s   e  Z d  Z e i d e i  Z e i d e i  Z e i d e i e i B Z	 d d d  Z d   Z e d e d   Z e d    Z e d    Z e d	    Z e d
    Z d   Z d d  Z d   Z e i d e i  Z d   Z RS(   s'   Represents one page, along with its URLs   <th>\s*home\s*pages   <th>\s*download\s+urls(   href=(?:"([^"]*)"|'([^']*)'|([^>\s\n]*))c         C   sC   | |  _  t i |  i  d t |  _ | |  _ | |  _ | |  _ d  S(   Nt   namespaceHTMLElements(   t   contentR   t   parseR3   R   RF   t   headersRn   (   R7   R  RF   R  Rn   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR;   h  s
    			c         C   s   |  i  S(   N(   RF   (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __str__o  s    c         C   s@  | i  } | i d d  d } | i |  o d  Sd d k l } xW | i D]L } | i   i |  o0 | t	 |  d j o t
 i d t    d  SqN W| d  j	 o% | i |  } | d  j	 o | Sn y| o | d  j	 o | i |  o d  Sn | i }	 x d d	 d
 d d g D]} }
 |	 i |
  og |  i |  } | i   i d  o Pqt
 i d | | f  | d  j	 o | i |  n d  SqqWn t
 i d |  t i |  \ } } } } } } | d j o^ t i i t |   oE | i d  p | d 7} n t i | d  } t
 i d |  n t |  } t |  } | i   } | i   } | i d d   } | d  j	 oS | d j o" t i d t  |   i   } n | d j o t! i" |  } qn | i d d  } | i   i d  p: t
 i d | | f  | d  j	 o | i |  n d  S|  t# |  | | d | i$ } Wnt% t& t' i( t' i) t* t+ f j
 ot, i-   d } t. |  } t/ | t' i(  o t
 i } d } d } n t/ | t&  o t0 | d  o@ t/ | i1 t2 i3  p t/ | i1 t4  o d | } t
 i5 } n
 t
 i } t0 | d  o& t/ | i1 t' i(  o d } d } qd } nC t/ | t%  o# | i6 d j o t
 i } d } n t
 i } d } | d  | | f  | d! | i  | f  | d  j	 o | i7 | |  n d  SX| d  j	 o | i8 | | 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   fileRh   s
   index.htmls#    file: URL is directory, getting %ss   Content-Encodingt   gzipt   fileobjt   deflates   Content-Typet   unknownRn   s	   timed outt   reasons6   There was a problem confirming the ssl certificate: %si   i  s   Could not fetch URL %s: %ss7   Will skip URL %s when looking for download links for %s(9   RF   t   splitR   Rr   t   pip.vcsR  t   schemesR{   RL   RW   R    Rx   t   localsR   R   t   filenameRj   t   _get_content_typeR   R   RJ   RE   RM   R   t   urljoinR   R   R,   t   readR   R
  t   GzipFileR	   t   zlibt
   decompressR   Rn   R   R   t   sockett   timeoutt   errort   OSErrorR   R   t   exc_infot   strt
   isinstancet   hasattrR  t   sslt   SSLErrorR   R   t   codeR   R  (   t   clsR]   R   R'   t   skip_archivesRF   R  R   t   instR  t   bad_extt   content_typeR   RE   t   paramst   queryt   fragmentt   respt   real_urlR  t   contentst   encodingt   et   desct   log_methR   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR   r  s    	
 -				 !&"		%&	
9
	&

 	
	c         C   s   t  i |   \ } } } } } | d j o d St |  d h | d 6} t |  } zL t | d  o" | i d	 j o | d j o d S| i   i d
 d  SWd | i   Xd S(   s;   Get the Content-Type of the given url, using a HEAD requestt   httpt   httpst   ftpt   ftpsRp   R  t   HostR$  i   s   content-typeN(   s   https   httpss   ftpR7  (   s   ftpR7  (	   R   t   urlsplitR   R   R!  R$  R,   R   t   close(   RF   R   R   RE   R+  R,  R   R-  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR    s    -c      	   C   s   t  |  d  p d  } g  } |  i i d  D]0 } | i d d  i   d j o | | q- q- ~ } | oF y  t | d i d d    } Wq t t f j
 o d  } q Xn | |  _	 n |  i	 S(   Nt   _api_versions   .//metaRz   Rp   s   api-versioni    R=   (
   R!  Rr   R   t   findallR   R{   t   intt	   TypeErrort
   ValueErrorR;  (   R7   R;  R   t   xt   metas(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   api_version  s    3 c         C   sl   t  |  d  pU |  i i d  } | d  j	 o& | i d  o | i d  |  _ qe |  i |  _ n |  i S(   Nt	   _base_urls   .//baset   href(   R!  R   t   findRr   R   RC  RF   (   R7   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   base_url   s    c         c   s   x |  i  i d  D] } | i d  o | i d  } |  i t i |  i |   } d } |  i oE |  i d j o5 t	 | i d  o d | i d  i
   j  } n t | |  d | Vq q Wd S(   s   Yields all links in the pages   .//aRD  i   t   relR   N(   R   R<  R   t
   clean_linkR   R  RF  Rr   RB  R   R  Rs   (   R7   t   anchorRD  RF   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR?   
  s     "c         c   s<   x |  i    D] } | Vq Wx |  i   D] } | Vq) Wd  S(   N(   t   explicit_rel_linkst   scraped_rel_links(   R7   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s     	 t   homepaget   downloadc         c   s   t  |  } x |  i i d  D] } | i d  o | i d  oo t  | i d  i    } | | @oE | i d  } |  i t i |  i |   } t	 | |  d t
 Vq q q Wd S(   s)   Yields all links with the given relationss   .//aRG  RD  Rn   N(   R(   R   R<  R   R  RH  R   R  RF  Rs   R3   (   R7   t   relsRI  t
   found_relsRD  RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRJ  $  s      c         c   s   x |  i  |  i f D] } | i |  i  } | p q n |  i i |  i d | i   } | p q n | i d  p | i d  p | i d  } | p q n |  i t i	 |  i
 |   } t | |  d t Vq Wd  S(   Nt   posi   i   i   Rn   (   t   _homepage_ret   _download_reR   R  t   _href_ret   endR   RH  R   R  RF  Rs   R3   (   R7   t   regexR   t
   href_matchRF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRK  2  s     !/s   [^a-z0-9$&+,/:;=?@.#%_\\|-]c         C   s   |  i  i 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  |  i d   S(   s   %%%2xi    (   t   ordR   (   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   <lambda>H  s    (   t	   _clean_ret   sub(   R7   RF   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRH  C  s    	N(   s   homepageRM  (   R   R   R   R   R   R   RQ  RR  t   SRS  Rr   R;   R  t   classmethodRe   R   t   staticmethodR  R   RB  RF  R?   R   RJ  RK  RY  RH  (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR   `  s"   	l
		Rs   c           B   s  e  Z d d d d   Z d   Z d   Z d   Z d   Z 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 i d  Z e d    Z e i d  Z e d    Z e d    Z e d    Z e d    Z RS(   c         C   sk   | |  _  | |  _ | |  _ | |  _ d  |  _ | t j o- |  i   d t j o t	 |  i
  |  _ n d  S(   Ni   (   RF   R   R   Rn   Rr   RY   R   R   R   R   R  (   R7   RF   R   R   Rn   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR;   M  s    					$c         C   s0   |  i  o d |  i |  i  f St |  i  Sd  S(   Ns   %s (from %s)(   R   RF   R  (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR  X  s    
c         C   s   d |  S(   Ns	   <Link %s>(    (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __repr__^  s    c         C   s   |  i  | i  j S(   N(   RF   (   R7   t   other(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __eq__a  s    c         C   s   |  i  | i  j S(   N(   RF   (   R7   R_  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __ne__d  s    c         C   s   |  i  | i  j  S(   N(   RF   (   R7   R_  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __lt__g  s    c         C   s   |  i  | i  j S(   N(   RF   (   R7   R_  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __le__j  s    c         C   s   |  i  | i  j S(   N(   RF   (   R7   R_  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __gt__m  s    c         C   s   |  i  | i  j S(   N(   RF   (   R7   R_  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __ge__p  s    c         C   s   t  |  i  S(   N(   t   hashRF   (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   __hash__s  s    c         C   s\   t  i |  i  \ } } } } } t i | i d   p | } | p t d |  i  | S(   NRh   s   URL %r produced no filename(   R   R9  RF   Ri   R   R   t   AssertionError(   R7   R^   R   RE   Rz   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR  v  s    !c         C   s   t  i |  i  d S(   Ni    (   R   R9  RF   (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR   }  s    c         C   s   t  i |  i  d S(   Ni   (   R   R9  RF   (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRE     s    c         C   s   t  t i |  i i d    S(   NRh   (   R   Ri   R   RE   R   (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    c         C   s=   t  i |  i  \ } } } } } t  i | | | | d  f  S(   N(   R   R9  RF   t
   urlunsplitRr   (   R7   R   R   RE   R+  R,  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   url_without_fragment  s    !s   #egg=([^&]*)c         C   s.   |  i  i |  i  } | p d  S| i d  S(   Ni   (   R   R   RF   Rr   R   (   R7   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    s2   (sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)c         C   s.   |  i  i |  i  } | o | i d  Sd  S(   Ni   (   t   _hash_reR   RF   R   Rr   (   R7   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRf    s    c         C   s.   |  i  i |  i  } | o | i d  Sd  S(   Ni   (   Rk  R   RF   R   Rr   (   R7   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt	   hash_name  s    c         C   s0   t  i |  i i d d  d i d d  d  S(   NR  i   i    t   ?(   Ri   R   RF   R  (   R7   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   show_url  s    c         C   s   |  i  p t |  i d d  } | d j	 o | o} y% t |  i d d  } t |  } Wn t t f j
 o d } n X| d j p | d j o d S|  i o t St	 Sn | d j	 o t	 Sd S(   s   
        Returns True if this link can be verified after download, False if it
        cannot, and None if we cannot determine.
        Rn   RB  i   N(
   Rn   R   R   Rr   R=  R?  R>  Rf  Re   R3   (   R7   Rn   RB  (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    
N(   R   R   Rr   R;   R  R^  R`  Ra  Rb  Rc  Rd  Re  Rg  R   R  R   RE   R   Rj  R   R   R   R   Rk  Rf  Rl  Rn  R   (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRs   K  s,   										c         C   s=   t  |   } | i } | p t | i  d } n t |  S(   sP   Get a requirement from the URL, if possible.  This looks for #egg
    in the URLi    (   Rs   R   R   R  t   package_to_requirement(   RF   R]   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   get_requirement_from_url  s
    	c         C   se   t  i d |   } | o" | i d  } | i d  } n |  } d } | o d | | f S| Sd S(   s)   Translate a name like Foo-1.2 to Foo==1.3s   ^(.*?)-(dev|\d.*)i   i   Rp   s   %s==%sN(   R   R   R   (   t   package_nameR   Rz   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRo    s    c      
   C   s   |  d j o
 t }  n d } y t i |   d } Wn t i j
 o g  SX| p | t j o
 d } n | i d d  } g  } t | d  D] } | d | | d f q ~ 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    s   z.pypi.python.orgt   .i   s   %s.%sN(   Rr   t   DEFAULT_MIRROR_HOSTNAMER  t   gethostbyname_ext   gaierrorR  t   string_range(   t   hostnamet   last_mirror_hostnamet
   end_letterR   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyR     s    

c         c   sk   xd t  t |    D]P } xG t t i d | d D], } d i |  } | V| |  j o d Sq3 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   Rp   N(   R   RW   R   t   stringt   ascii_lowercaseR-   (   t   lastt   kR@  t   result(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyRv    s      (F   R   R   RJ   R   R
  RB   Ri   R   R   R  R"  R{  R  R   t   ImportErrort   dummy_threadingt   pip.logR    t   pip.utilR   R   R   R   t   pip.exceptionsR   R   R   t   pip.backwardcompatR   R	   R
   R   R   R   R   R   R   R   R   R   t   pip.downloadR   R   R   R   R   t	   pip.wheelR   R   R   R   t   pip.pep425tagsR   R   R   t
   pip.vendorR   t   __all__Rs  t   objectR    R&   R   Rs   RX   Rp  Ro  Rr   R   Rv  (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/index.pyt   <module>   sL   "F("	  	
	