
Rc           @  s  d  Z  d d k l 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 l Z d d k l Z d d k l Z d d k l Z d d k l Z l Z l Z d	 Z e e i d
   d Z d   Z d d d  Z y e d   Z Wn e j
 o d   Z n Xd   Z  d   Z! e i" d e i#  Z$ d   Z% e& d d  Z( d   Z) e) d    Z* d e+ f d     YZ, d e+ f d     YZ- d S(   sH   
Support for installing and building the "wheel" binary package format.
i(   t   with_statementN(   t   urlsafe_b64encode(   t   distutils_scheme(   t   logger(   t
   pep425tags(   t   call_subprocesst   normalize_patht   make_path_relatives   .whls   setuptools>=0.8i    c          C  si   t  }  y* t i d  } | t j o
 t }  n Wn t i j
 o n X|  p t i d t  n |  S(   sB   
    Return True if we have a setuptools that supports wheel.
    t
   setuptoolss"   %s is required for wheel installs.(   t   Falset   pkg_resourcest   get_distributiont   setuptools_requirementt   Truet   DistributionNotFoundR   t   warn(   t	   fulfilledt   installed_setuptools(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   wheel_setuptools_support   s    t   sha256i   i   c   	      C  s   t  i |  } d } t |   i i   } zW | ~ } | i |  } x8 | o0 | t |  7} | i |  | i |  } qJ WWd QXd t | i	    i
 d  i d  } | | f S(   s6   Return (hash, length) for path using hashlib.new(algo)i    Ns   sha256=t   latin1t   =(   t   hashlibt   newt   opent   __exit__t	   __enter__t   readt   lent   updateR   t   digestt   decodet   rstrip(	   t   patht   algot	   blocksizet   ht   lengtht   _[1]t   ft   blockR   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   rehash)   s    # (c         C  s"   t  |  t  o |  i d  S|  S(   Nt   ascii(   t
   isinstancet   unicodet   encode(   t   s(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   binary8   s    c         C  s"   t  |  t  o |  i d  Sd  S(   NR*   (   R+   t   strR-   (   R.   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyR/   =   s    c         C  sK   t  i d d j  o h  } d } n h d d 6} d } t |  | | |  S(   Ni    i   t   bt    t   newline(   t   syst   version_infoR   (   t   namet   modet   nlt   bin(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   open_for_csvA   s    
c         C  s   t  i i |   o t |  d  } zl | i   } | i t d   p t St i	 i
 t i    } t d  | t t  i  } | i   } Wd | i   Xt |  d  } z | i |  | i |  Wd | i   Xt Sd S(   sL   Replace #!python with #!/path/to/python
    Return True if file was changed.t   rbs   #!pythons   #!Nt   wb(   t   osR!   t   isfileR   t   readlinet
   startswithR/   R	   R4   t
   executableR-   t   getfilesystemencodingt   linesepR   t   closet   writeR   (   R!   t   scriptt	   firstlinet   exenamet   rest(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt
   fix_scriptJ   s     sZ   ^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
                                \.dist-info$c         C  s   |  i  d d  } x t i |  D] } t i |  } | o | i d  | j ot t t i i | | d   i	 i
   } zB | ~ } x2 | D]* } | i   i   } | d j o t Sq WWd QXq" q" Wt S(   sP   
    Return True if the extracted wheel in wheeldir should go into purelib.
    t   -t   _R6   t   WHEELs   root-is-purelib: trueN(   t   replaceR=   t   listdirt   dist_info_ret   matcht   groupR   R!   t   joinR   R   t   lowerR    R   R	   (   R6   t   wheeldirt   name_foldedt   itemRQ   R&   t   wheelt   line(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   root_is_purelibd   s     5 c           s  t  |  d | d | } t |    o | d  n | d  g   g    i t i i  t i i } h    t    d    t       f d   d     f d  } | |  t	   p t
 d   x  D] } d }	 x{ t i t i i  |   D][ }
 d }	 |
 d	 j o
 t }	 n t i i  | |
  } | |
 } | | | t d
 |	 qWq Wt i i  d d  } t i i  d d  } t | d  i i   } z | ~ } t | d  i i   } z | ~ } t i |  } t i |  } xl | D]d }   i | d | d  | d <| d  j o" t | d  \ | d <| d <n | i |  qWx(   D]  } | i   | d d f  qWWd QXWd QXt i | |  d S(   s   Install a wheelt   usert   homet   purelibt   platlibc         S  s   t  |  |  i t i i d  S(   Nt   /(   R   RN   R=   R!   t   sep(   t   srct   p(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   normpath   s    c           sD    |     }  |   } |  | <| o  i  |  n d S(   s6   Map archive RECORD paths to installation RECORD paths.N(   t   add(   t   srcfilet   destfilet   modifiedt   oldpatht   newpath(   RU   t   lib_dirt   changedRc   t	   installed(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   record_installed   s
    
c      	     s  t  i i |  p t  i |  n xt  i |   D]\ } } } | t |   i t  i i  } | o- | i t  i i d  d i	 d  o q4 n x | D] } t  i i
 | | |  }	 | o1 | d j o$ |	 i	 d  o  i |  q nf | o^ | i	 d  oN | i   i   i i d d  i    o#  p
 t d   i |	  n t  i i |	  p t  i |	  q q Wxx | D]p }
 t  i i
 | |
  } t  i i
 | | |
  } t i | |  t } | o | |  } n  | | |  qWq4 Wd  S(	   Ni   i    s   .dataR2   s
   .dist-infoRK   RL   s   Multiple .dist-info directories(   R=   R!   t   existst   makedirst   walkR   t   lstripR`   t   splitt   endswithRS   t   appendRT   R@   t   project_nameRN   t   AssertionErrort   shutilt   moveR	   (   t   sourcet   destt   is_baset   fixert   dirt   subdirst   filest   basedirR.   t
   destsubdirR'   Re   Rf   Rk   (   t   reqt   info_dirRm   t	   data_dirs(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   clobber   s:     - $+ s!   %s .dist-info directory not foundt   scriptsR|   i    t   RECORDs
   RECORD.pipt   rs   w+i   i   R2   N(   R   RZ   R    R=   R!   R`   t   setR	   t   NoneR   Rv   RO   RS   RJ   R:   R   R   t   csvt   readert   writert   popR)   t   writerowRw   Rx   (   R6   R   RU   R[   R\   t   schemeRy   R   t   datadirR|   t   subdirRz   t   recordt   temp_recordR&   t	   record_int   _[2]t
   record_outR   R   t   rowR'   (    (	   Rl   R   RU   R   Rj   Rk   Rc   Rm   R   sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   move_wheel_filess   sR    
		  

&& " *c           s"   t  i      f d    } | S(   Nc          ?  sJ   t    } x:   |  |   D]) } | | j o | i |  | Vq q Wd  S(   N(   R   Rd   (   t   argst   kwt   seenRW   (   t   fn(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   unique   s    	 (   t	   functoolst   wraps(   R   R   (    (   R   sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   _unique   s    c         c  s   d d k  l } t i | |  i d    } x | D]{ } t i i |  i | d  } | V| i	 d  oD t i i
 |  \ } } | d  } t i i | | d  } | Vq5 q5 Wd S(	   s  
    Yield all the uninstallation paths for dist based on RECORD-without-.pyc

    Yield paths to all the files in RECORD. For each .py file in RECORD, add
    the .pyc in the same directory.

    UninstallPathSet.add() takes care of the __pycache__ .pyc.
    i(   t   FakeFileR   i    s   .pyis   .pycN(   t   pip.reqR   R   R   t   get_metadata_linesR=   R!   RS   t   locationRs   Rr   (   t   distR   R   R   R!   t   dnR   t   base(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   uninstallation_paths   s    
 
t   Wheelc           B  sD   e  Z d  Z e i d e i  Z d   Z d d  Z	 d d  Z
 RS(   s   A wheel files   ^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
                ((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
                \.whl|\.dist-info)$c           s     i  i |  } |   _ | i d  i d d    _ | i d    _ | i d  i d    _ | i d  i d    _	 | i d  i d    _
 t   f d	     i D    _ d  S(
   NR6   RL   RK   t   vert   pyvert   .t   abit   platc         3  sJ   xC |  ]< } x3   i  D]( } x   i D] } | | | f Vq& Wq Wq Wd  S(   N(   t   abist   plats(   t   .0t   xt   yt   z(   t   self(    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pys	   <genexpr>   s   	 (   t   wheel_file_reRQ   t   filenameRR   RN   R6   t   versionRr   t
   pyversionsR   R   R   t	   file_tags(   R   R   t
   wheel_info(    (   R   sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   __init__   s    	c         C  sn   | d j o t i } n g  } |  i D]' } | | j o | | i |  q( q( ~ } | o t |  Sd S(   s   
        Return the lowest index that a file_tag achieves in the supported_tags list
        e.g. if there are 8 supported tags, and one of the file tags is first in the
        list, then return 0.
        N(   R   R   t   supported_tagsR   t   indext   min(   R   t   tagsR&   t   ct   indexes(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   support_index_min  s    >c         C  s6   | d j o t i } n t t |  i |  i   S(   s'   Is this wheel supported on this system?N(   R   R   R   t   boolR   t   intersectionR   (   R   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt	   supported  s    N(   t   __name__t
   __module__t   __doc__t   ret   compilet   VERBOSER   R   R   R   R   (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyR      s   	t   WheelBuilderc           B  s/   e  Z d  Z g  g  d  Z d   Z d   Z RS(   s#   Build wheels from a RequirementSet.c         C  s7   | |  _  | |  _ t |  |  _ | |  _ | |  _ d  S(   N(   t   requirement_sett   finderR   t	   wheel_dirt   build_optionst   global_options(   R   R   R   R   R   R   (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyR     s
    			c      	   C  s   t  i d d | i g t |  i  } t i d | i  t i d |  i  | d d |  i g |  i	 } y! t
 | d | i d t t SWn t i d	 | i  t SXd
 S(   s   Build one wheel.s   -csj   import setuptools;__file__=%r;exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))s#   Running setup.py bdist_wheel for %ss   Destination directory: %st   bdist_wheels   -dt   cwdt   show_stdouts   Failed building wheel for %sN(   R4   RA   t   setup_pyt   listR   R   t   notifyR6   R   R   R   t
   source_dirR	   R   t   error(   R   R   t	   base_argst
   wheel_args(    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt
   _build_one  s    	
c         C  s  |  i  i |  i  |  i  i i   } t i i |  i  p t i	 |  i  n t
 i d d i g  } | D] } | | i qi ~   t
 i d 7_ g  g  } } x` | D]X } | i o t
 i d | i  q n |  i |  o | i |  q | i |  q Wt
 i d 8_ | o< t
 i d d i g  } | D] } | | i q6~   n | o< t
 i d d i g  } | D] } | | i qy~   n d S(	   s   Build wheels.s*   Building wheels for collected packages: %ss   , i   s   Skipping building wheel: %ss   Successfully built %st    s   Failed to build %sN(   R   t   prepare_filesR   t   requirementst   valuesR=   R!   Rn   R   Ro   R   R   RS   R6   t   indentt   is_wheelt   urlR   Rt   (   R   t   reqsetR&   R   t   build_successt   build_failureR   t   _[3](    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   build1  s(    8 
<(   R   R   R   R   R   R   (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyR     s   	i   (.   R   t
   __future__R    R   R   R   R=   R
   R   Rw   R4   t   base64R   t   pip.locationsR   t   pip.logR   t   pipR   t   pip.utilR   R   R   t	   wheel_extR   t   parse_requirementsR   R   R)   R,   R/   t	   NameErrorR:   RJ   R   R   RP   RZ   R	   R   R   R   R   t   objectR   R   (    (    (    sE   /var/www/html/kasc-wg8/erics/lib/python2.6/site-packages/pip/wheel.pyt   <module>   sB   					V	*