Ñò
eàKc           @   s1  d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k Z e i e  i Z y
 e Z	 Wn e
 j
 o d Z	 n Xe Z d  d k l Z d d d d g Z d „  Z d d d „  ƒ  YZ e  i g Z d e f d	 „  ƒ  YZ e e i g  Z d
 i ƒ  D] Z e e e e d ƒ qò [ ƒ Z d e f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   DistutilsErrort   AbstractSandboxt   DirectorySandboxt   SandboxViolationt	   run_setupc            s¡  t  i ƒ  } t i } t i } t  i i t  i i ˆ  ƒ ƒ } t  i i | d ƒ } t  i i | ƒ p t  i	 | ƒ n t
 i } t i i ƒ  } z› | t
 _ t  i | ƒ yJ ˆ  g t | ƒ t i (t i i d | ƒ t | ƒ i ‡  f d †  ƒ Wn4 t j
 o( }	 |	 i o |	 i d o ‚  q)n XWd t i i | ƒ x2 t t i ƒ D]! }
 |
 | j o t i |
 =qMqMWt  i | ƒ | t i (| t i (| t
 _ Xd S(   s8   Run a distutils setup script, sandboxed in its directoryt   tempi    c              s   t  d  h ˆ  d 6d d 6ƒ S(   s   setup.pyt   __file__t   __main__t   __name__(   t   execfile(    (   t   setup_script(    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   <lambda>   s   N(   t   ost   getcwdt   syst   argvt   patht   abspatht   dirnamet   joint   isdirt   makedirst   tempfilet   tempdirt   modulest   copyt   chdirt   listt   insertR   t   runt
   SystemExitt   argst   update(   R
   R   t   old_dirt	   save_argvt	   save_patht	   setup_dirt   temp_dirt   save_tmpt   save_modulest   vt   key(    (   R
   s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR      s:    

 		  

c           B   sÑ  e  Z d  Z e Z d „  Z d „  Z d „  Z d „  Z x> d d d g D]- Z	 e
 e e	 ƒ o e e	 ƒ e ƒ  e	 <qF qF Wd' d „ Z e o e d	 e ƒ Z n e d
 e ƒ Z xn d d d d
 d d d d d d d d d d d d d d d g D]- Z	 e
 e e	 ƒ o e e	 ƒ e ƒ  e	 <qì qì Wd „  Z x; d d g D]- Z	 e
 e e	 ƒ o e e	 ƒ e ƒ  e	 <q3q3Wd  „  Z x; d! d" g D]- Z	 e
 e e	 ƒ o e e	 ƒ e ƒ  e	 <qzqzWd# „  Z d$ „  Z d% „  Z d& „  Z RS((   sD   Wrap 'os' module and 'open()' builtin for virtualizing setup scriptsc         C   sS   g  } t  t ƒ D]2 } | i d ƒ o t |  | ƒ o | | q q ~ |  _ d  S(   Nt   _(   t   dirt   _ost
   startswitht   hasattrt   _attrs(   t   selft   _[1]t   name(    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   __init__4   s    c         C   s1   x* |  i  D] } t t | t | | ƒ ƒ q
 Wd  S(   N(   R/   t   setattrR   t   getattr(   R0   t   sourceR2   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   _copy:   s    
 c         C   s   zD |  i  |  ƒ t o |  i t _ n |  i t _ t |  _ | ƒ  SWd t |  _ t o t t _ n t t _ |  i  t	 ƒ Xd S(   s   Run 'func' under os sandboxingN(
   R7   t   _filet   __builtin__t   filet   _opent   opent   Truet   _activet   FalseR,   (   R0   t   func(    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR   >   s    			c            s%   t  t ˆ  ƒ ‰ ‡  ‡ f d †  } | S(   Nc            sB   |  i  o% |  i ˆ  | | | | Ž \ } } n ˆ | | | | Ž S(   N(   R>   t   _remap_pair(   R0   t   srct   dstR   t   kw(   R2   t   original(    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   wrapQ   s    
%(   R5   R,   (   R2   RF   (    (   R2   RE   s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   _mk_dual_path_wrapperO   s    t   renamet   linkt   symlinkc            s,   ˆ p t  t ˆ  ƒ ‰ ‡  ‡ f d †  } | S(   Nc            s6   |  i  o |  i ˆ  | | | Ž } n ˆ | | | Ž S(   N(   R>   t   _remap_input(   R0   R   R   RD   (   R2   RE   (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRF   ^   s    
(   R5   R,   (   R2   RE   RF   (    (   R2   RE   s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   _mk_single_path_wrapper\   s    R:   R<   t   statt   listdirR   t   chmodt   chownt   mkdirt   removet   unlinkt   rmdirt   utimet   lchownt   chroott   lstatt	   startfilet   mkfifot   mknodt   pathconft   accessc            s%   t  t ˆ  ƒ ‰ ‡  ‡ f d †  } | S(   Nc            sO   |  i  o5 |  i ˆ  | | | Ž } |  i ˆ  ˆ | | | Ž ƒ Sˆ | | | Ž S(   N(   R>   RK   t   _remap_output(   R0   R   R   RD   (   R2   RE   (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRF   q   s    
(   R5   R,   (   R2   RF   (    (   R2   RE   s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   _mk_single_with_returno   s    t   readlinkt   tempnamc            s%   t  t ˆ  ƒ ‰ ‡  ‡ f d †  } | S(   Nc            s.   ˆ | | Ž  } |  i  o |  i ˆ  | ƒ S| S(   N(   R>   R^   (   R0   R   RD   t   retval(   R2   RE   (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRF   }   s    
(   R5   R,   (   R2   RF   (    (   R2   RE   s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt	   _mk_query{   s    R   t   tmpnamc         C   s   | S(   s=   Called to remap or validate any path, whether input or output(    (   R0   R   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   _validate_path‡   s    c         O   s   |  i  | ƒ S(   s   Called for path inputs(   Re   (   R0   t	   operationR   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRK   ‹   s    c         C   s   |  i  | ƒ S(   s   Called for path outputs(   Re   (   R0   Rf   R   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR^      s    c         O   s6   |  i  | d | | | Ž |  i  | d | | | Ž f S(   s?   Called for path pairs like rename, link, and symlink operationss   -froms   -to(   RK   (   R0   Rf   RB   RC   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRA   “   s    N(   R   t
   __module__t   __doc__R?   R>   R3   R7   R   RG   R2   R.   R,   t   localst   NoneRL   R8   R;   R_   Rc   Re   RK   R^   RA   (    (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR   /   sF   					    		  		  			c           B   s¬   e  Z d  Z e i d d d d d d d d d	 d
 d d d g ƒ Z e d „ Z d „  Z e	 o d d „ Z	 n d d „ Z
 d „  Z d „  Z d „  Z d „  Z d d „ Z RS(   s<   Restrict operations to a single subdirectory - pseudo-chrootR<   RO   RP   RQ   RR   RS   RT   RU   RV   RW   RZ   R[   Ra   c         C   sV   t  i i t  i i | ƒ ƒ |  _ t  i i |  i d ƒ |  _ | |  _ t i	 |  ƒ d  S(   Nt    (
   R   R   t   normcaset   realpatht   _sandboxR   t   _prefixt   _exceptionsR   R3   (   R0   t   sandboxt
   exceptions(    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR3   ¥   s    !	c         O   s   t  | | | ƒ ‚ d  S(   N(   R   (   R0   Rf   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt
   _violation«   s    t   rc         O   sN   | d j o. |  i  | ƒ o |  i d | | | | Ž n t | | | | Ž S(   NRt   t   rtt   rbt   rUt   UR:   (   Rt   Ru   s   rbs   rURx   (   t   _okRs   R8   (   R0   R   t   modeR   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR8   ¯   s    c         O   sN   | d j o. |  i  | ƒ o |  i d | | | | Ž n t | | | | Ž S(   NRt   Ru   Rv   Rw   Rx   R<   (   Rt   s   rts   rbs   rURx   (   Ry   Rs   R;   (   R0   R   Rz   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR;   ´   s    c         C   s   |  i  d ƒ d  S(   NRd   (   Rs   (   R0   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRd   ¹   s    c         C   s}   |  i  } zc t |  _  t i i t i i | ƒ ƒ } | |  i j p# | |  i j p | i |  i	 ƒ o t
 SWd  | |  _  Xd  S(   N(   R>   R?   R   R   Rl   Rm   Rp   Rn   R-   Ro   R=   (   R0   R   t   activeRm   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRy   ¼   s    		 	c         O   sK   | |  i  j o7 |  i | ƒ o& |  i | t i i | ƒ | | Ž n | S(   s   Called for path inputs(   t	   write_opsRy   Rs   R   R   Rm   (   R0   Rf   R   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRK   Ç   s    !&c         O   sI   |  i  | ƒ p |  i  | ƒ o |  i | | | | | Ž n | | f S(   s?   Called for path pairs like rename, link, and symlink operations(   Ry   Rs   (   R0   Rf   RB   RC   R   RD   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyRA   Í   s    "iÿ  c         C   sI   | t  @o+ |  i | ƒ o |  i d | | | ƒ n t i | | | ƒ S(   s   Called for low-level os.open()s   os.open(   t   WRITE_FLAGSRy   Rs   R,   R<   (   R0   R:   t   flagsRz   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR<   Ó   s    (   R   Rg   Rh   t   dictt   fromkeysR|   t   _EXCEPTIONSR3   Rs   R8   R;   Rd   Ry   RK   RA   R<   (    (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR      s   					s4   O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYi    c           B   s   e  Z d  Z d „  Z RS(   sE   A setup script attempted to modify the filesystem outside the sandboxc         C   s   d |  i  S(   Ns³  SandboxViolation: %s%r %s

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.(   R   (   R0   (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   __str__æ   s    	(   R   Rg   Rh   R‚   (    (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyR   ã   s   (    (   R   R   R9   R   t   operatorR   R2   R,   R:   R8   t	   NameErrorRj   R<   R;   t   distutils.errorsR    t   __all__R   R   t   devnullR   R   t   reducet   or_R1   t   splitt   aR5   R}   R   (    (    (    s6   /usr/lib/python2.6/dist-packages/setuptools/sandbox.pyt   <module>   s"   <
	#l=/