
OcIc           @   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 d d k Z d d k Z d d k Z y d d k Z d d k Z Wn e j
 o n Xd e f d     YZ d e f d     YZ d   Z d   Z d	   Z d
   Z d d  Z d d  Z d   Z d   Z d   Z d   Z d d  Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d   Z' d   Z( d f  d     YZ) d e) f d     YZ* d f  d      YZ+ d! e i, f d"     YZ, d# f  d$     YZ- d%   Z. d&   Z/ d'   Z0 d(   Z1 d)   Z2 d*   Z3 d+   Z4 d,   Z5 d-   Z6 d S(.   sS  Wrapper class around a real path like "/usr/bin/env"

The RPath (short for Remote Path) and associated classes make some
function calls more convenient and also make working with files on
remote systems transparent.

For instance, suppose

rp = RPath(connection_object, "/usr/bin/env")

Then rp.getperms() returns the permissions of that file, and
rp.delete() deletes that file.  Both of these will work the same even
if "usr/bin/env" is on a different computer.  So many rdiff-backup
functions use rpaths so they don't have to know whether the files they
are dealing with are local or remote.

iNt   SkipFileExceptionc           B   s   e  Z d  Z RS(   s   Signal that the current file should be skipped but then continue

	This exception will often be raised when there is problem reading
	an individual file, but it makes sense for the rest of the backup
	to keep going.

	(   t   __name__t
   __module__t   __doc__(    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    .   s   t   RPathExceptionc           B   s   e  Z RS(    (   R   R   (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   8   s    c         C   s;   t  i } x+ |  i |  } | p Pn | i |  q d S(   s6   Copies file inputfp to outputfp in blocksize intervalsN(   t   Globalst	   blocksizet   readt   write(   t   inputfpt   outputfpR   t   inbuf(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   copyfileobj:   s    	 c         C   sU   t  i } xE |  i |  } | i |  } | | j o d Sq | p d Sq q d S(   s2   True if file objects fp1 and fp2 contain same datai   N(   R   R   R   t   None(   t   fp1t   fp2R   t   buf1t   buf2(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   cmpfileobjB   s    	  c          G   s<   x5 |  D]- } | i    p t d | i     q q Wd S(   s4   Make sure that all the rps exist, raise error if nots   File %s does not existN(   t   lstatR   t   get_indexpath(   t   rpst   rp(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   check_for_filesK   s     c         C   sE   y t  |  |  Wn- t i j
 o t |  |  |  i   n Xd S(   s(   Move rpin to rpout, renaming if possibleN(   t   renamet   ost   errort   copyt   delete(   t   rpint   rpout(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   moveQ   s
     i    c         C   s  t  i d |  i | i f d  |  i   p# | i   o | i   n d Sn | i   o4 |  i   p t |  |  o | i   q d Sn |  i   o t |  | |  Sn8|  i	   o | i
   n|  i   oZ t i o t i d |  i   @ } n | i |  i    t i o t i |  qn |  i   o) |  i   \ } } | i d | |  n |  i   o) |  i   \ } } | i d | |  nJ |  i   o | i   n/ |  i   o | i   n t d |  i   d S(   s   Copy RPath rpin to rpout.  Works for symlinks, dirs, etc.

	Returns close value of input for regular file, which can be used
	to pass hashes on.

	s   Regular copying %s to %si   Ni  t   ct   bs   File %s has unknown type(   t   logt   Logt   indext   pathR   R   t   isregt   cmpt   copy_reg_filet   isdirt   mkdirt   issymR   t   symlink_permsR   t   umaskt   getpermst   symlinkt   readlinkt	   ischardevt
   getdevnumst   makedevt   isblkdevt   isfifot   mkfifot   issockt   mksockR   (   R   R   t   compresst
   orig_umaskt   majort   minor(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   X   s<        
 
   c      
   C   s   y] | i  |  i  j oF | i  t i j	 o3 | i  i i |  i | i |  } | i   | Sn Wn t j
 o n Xy  | i |  i	 d  d | SWnF t
 j
 o: } | i t i j o t i i d |  i  q   n Xd S(   s=   Copy regular file rpin to rpout, possibly avoiding connectiont   rbR9   s   'IOError - Result too large' while reading %s. If you are using a Mac, this is probably the result of HFS+ filesystem corruption. Please exclude this file from your backup before proceeding.N(   t   connR   t   local_connectiont   rpathR(   R%   t   setdatat   AttributeErrort   write_from_fileobjt   opent   IOErrort   errnot   ERANGER"   R#   t
   FatalError(   R   R   R9   t   vt   e(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR(   {   s    !
  c         C   s  t  |  |  |  i   ou | i   p d Sn |  i d  | i d  } } t | |  } | i   p | i   o t d   n | Sn|  i   o | i   Sn |  i   o' | i   o |  i	   | i	   j Sn |  i
   o' | i
   o |  i   | i   j Sn~ |  i   o' | i   o |  i   | i   j SnJ |  i   o | i   Sn/ |  i   o | i   Sn t d |  i   d S(   s   True if rpin has the same data as rpout

	cmp does not compare file ownership, permissions, or times, or
	examine the contents of a directory.

	R=   s   Error closing files   File %s has unknown typeN(   R   R&   R   RD   R   t   closeR   R)   R+   R0   R1   R2   R4   R5   R7   R%   (   R   R   R   R   t   result(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR'      s,      '''  c         C   s  t  i d |  i | i f d  |  i   | i   j p |  i   p t  t i o  | i	 | i
 i i |     n t i o | i |  i    n |  i   o d Sn t i o1 |  i   o$ |  i   o | i |  i    n t i o1 |  i   o$ |  i   o | i |  i    n | i |  i    t i o | i |  i    n |  i   p | i  |  i!    n t i" o | i# |  i$    n d S(   s   Change file attributes of rpout to match rpin

	Only changes the chmoddable bits, uid/gid ownership, and
	timestamps, so both must already exist.

	s    Copying attributes from %s to %si   N(%   R"   R#   R$   R%   R   t	   isspecialt   AssertionErrorR   t   change_ownershipt   chownR>   t
   user_groupt	   map_rpatht	   eas_writet   write_eat   get_eaR+   t   resource_forks_writeR&   t   has_resource_forkt   write_resource_forkt   get_resource_forkt   carbonfile_writet   has_carbonfilet   write_carbonfilet   get_carbonfilet   chmodR.   t
   acls_writet	   write_aclt   get_aclt   isdevt   setmtimet   getmtimet   win_acls_writet   write_win_aclt   get_win_acl(   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   copy_attribs   s*     -
 
  
  
 c         C   s  t  i d |  i | i f d  t |  |  t i o t | i |  i	    n t i
 o | i |  i    n |  i   o d Sn t i o> |  i   o1 |  i   o$ | i   o | i |  i    n t i o> |  i   o1 |  i   o$ | i   o | i |  i    n |  i   o) | i   o | i |  i   d @ n | i |  i    t i o | i |  i   d d n |  i   p | i |  i    n d S(   s   Change file attributes of rpout to match rpin

	Like above, but used to give increments the same attributes as the
	originals.  Therefore, don't copy all directory acl and
	permissions.

	s   Copying inc attrs from %s to %si   Ni  t	   map_namesi    (    R"   R#   R$   R%   R   R   RO   t   applyRP   t	   getuidgidRS   RT   RU   R+   RV   R&   RW   RX   RY   RZ   R[   R\   R]   R)   R^   R.   R_   R`   Ra   Rb   Rc   Rd   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   copy_attribs_inc   s*     
 
  
  c         C   s'  t  |  |  t i o# |  i   | i   j o
 d } n |  i   | i   j o
 d } n |  i   o | i   o
 d } nz |  i   o | i   o
 d } nV |  i   o | i   o
 d } n2 |  i	   | i	   j o |  i
   | i
   j } t i d |  i   | i   | f d  | S(   s   True if rp1 has the same file attributes as rp2

	Does not compare file access times.  If not changing
	ownership, do not check user/group id.

	i   s    Compare attribs of %s and %s: %si   N(   R   R   RO   Rk   R   R.   R+   R4   R1   t   getctimeRd   R"   R#   R   (   t   rp1t   rp2RL   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   cmp_attribs   s     #
 

 
 
	 c         C   s2   t  |  | |  |  i   o t |  |  n d S(   s'   Copy file and then copy over attributesN(   R   R   Rh   (   R   R   R9   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   copy_with_attribs   s     c            s    i   i  j p t  t i    f d   d    i   p  i   nC i   oZ   i    i   j oA   i   d j o. t i d   i  i f d    i   n y    i  i i	   i  i  Wn t
 j
 o } | i t i j o' t i d   i  i f d    n   i  i i  i d    i  i i  i    i  i i	   i  i  n X  i  _ h  d
 d	 <  _ d
 S(   s   Rename rp_source to rp_destc              s   d   i    i  f S(   s   Renaming %s to %s(   R%   (    (   t   rp_destt	   rp_source(    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   <lambda>   s    i   i    s4   Warning: Attempt to rename over same inode: %s to %si   s   OSError while renaming %s to %si   i  t   typeN(   R>   RN   R"   R#   R   R   t   getinodeR%   R   R   t   OSErrorRF   t   EEXISTR^   t   unlinkt   dataR   (   Rs   Rr   R   (    (   Rs   Rr   s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR      s*     &	 	!c         C   st   t  i d j oZ y t i |   SWqj t j
 o6 } | i t i j o | i t i j o   qf qj Xn t |   S(   s  Generate the data dictionary for the given RPath

	This is a global function so that os.name can be called locally,
	thus avoiding network lag and so that we only need to send the
	filename over the network, thus avoiding the need to pickle an
	(incomplete) rpath object.
	t   nt(	   R   t   namet   Ct   make_file_dictRw   RF   t   EILSEQt   EINVALt   make_file_dict_python(   t   filenameR   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR~     s    &c         C   s  y t  i |   } Wn# t  i j
 o h  d d <Sn Xh  } | t i } t i |  o
 d } n	t i |  o
 d } n t i |  o/ d } | i	 } d | d ?| d @f | d <n t i
 |  o/ d } | i	 } d | d ?| d @f | d <nq t i |  o
 d
 } nW t i |  o d } t  i |   | d <n* t i |  o
 d } n t i |    | | d <| t i | d <t i |  | d <| t i | d <| t i | d <| t i | d <| t i | d <| t i | d <t  i d j o9 t i |   } | t i @o d | d <d | d <q:n | d j p
 | d j pI t | t i  | d <t | t i  | d <t | t i   | d <n | S(   s5  Create the data dictionary using a Python call to os.lstat
	
	We do this on Windows since Python's implementation is much better
	than the one in cmodule.c    Eventually, we will move to using
	this on all platforms since CPUs have gotten much faster than
	they were when it was necessary to write cmodule.c
	Ru   t   regt   dirt   devR    i   i   t   devnumsR!   t   fifot   symt   linknamet   sockt   sizet   permst   uidt   gidt   inodet   devloct   nlinkR{   t   mtimet   atimet   ctimeN(   R    (   R!   (!   R   R   R   R   t   statt   ST_MODEt   S_ISREGt   S_ISDIRt   S_ISCHRt   st_rdevt   S_ISBLKt   S_ISFIFOt   S_ISLNKR0   t   S_ISSOCKR}   t   UnknownFileErrort   ST_SIZEt   S_IMODEt   ST_UIDt   ST_GIDt   ST_INOt   ST_DEVt   ST_NLINKR|   t	   win32filet   GetFileAttributest   winntt   FILE_ATTRIBUTE_REPARSE_POINTt   longt   ST_MTIMEt   ST_ATIMEt   ST_CTIME(   R   t	   statblockRz   t   modeRu   t   st   attribs(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   '  sX     
 
	 	  
 


c         C   s{   |  i  t i j p t  t i t i t i  } y | i |  i  Wn. t i	 j
 o } t
 d t |    n Xd S(   s   Make a local socket at the given path

	This takes an rpath so that it will be checked by Security.
	(Miscellaneous strings will not be.)

	s   Socket error: N(   R>   R   R?   RN   t   sockett   AF_UNIXt   SOCK_STREAMt   bindR%   R   R    t   str(   R@   R   t   exc(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   make_socket_local\  s     c         C   s*   |  i  t i j p t  t |  i d  S(   s7   Return open GzipFile.  See security note directly aboveR=   (   R>   R   R?   RN   t   GzipFileR%   (   R@   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   gzip_open_local_readi  s    c         C   s*   |  i  t i j p t  t |  i d  S(   s0   Return open file (provided for security reasons)R=   (   R>   R   R?   RN   RD   R%   (   R@   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   open_local_readn  s    c         C   s1  |  i  d  } | d d j o8 d } t |  d j  o d Sn | d d !\ } } n2 d } t |  d j  o d Sn | d \ } } t i |  d j o d Sn | d	 j p1 | d
 j p$ | d j p | d j p
 | d j p d Sn | o d i | d   } n d i | d   } | | | | f S(   sG   Returns None or tuple of 
	(is_compressed, timestr, type, and basename)t   .it   gzi   i   ii   it   snapshotR   t   missingt   diffRz   N(   t   splitt   lenR   t   Timet   stringtotimet   join(   t   basenamet   dotsplitt
   compressedt
   timestringt   extt   basestr(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_incfile_infos  s&       ' c         C   s?   |  i    p t  |  i   o t d   n |  i   d S(   sS   Deletes the directory at rp.path if empty. Raises if the
	directory contains files.s   Directory contains files.N(   R)   RN   t   contains_filesR   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   delete_dir_no_files  s    t   RORPathc        
   B   s  e  Z d  Z dH d  Z d   Z d   Z d   Z d   Z d   Z	 d d d d d d d d d	 d
 	 Z
 d	 d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d    Z! d!   Z" d"   Z# d#   Z$ d$   Z% d%   Z& d&   Z' d'   Z( d(   Z) d)   Z* d*   Z+ d+   Z, d,   Z- d-   Z. d.   Z/ d/   Z0 d0   Z1 d1   Z2 d2   Z3 d3   Z4 d4   Z5 d5   Z6 d6   Z7 d7   Z8 d8   Z9 d9   Z: d:   Z; d;   Z< d<   Z= d=   Z> d>   Z? d?   Z@ d@   ZA dA   ZB dB   ZC dC   ZD dD   ZE dE   ZF dF   ZG dG   ZH RS(I   s.  Read Only RPath - carry information about a path

	These contain information about a file, and possible the file's
	data, but do not have a connection and cannot be written to or
	changed.  The advantage of these objects is that they can be
	communicated by encoding their index and data dictionary.

	c         C   s<   | |  _  | o | |  _ n h  d  d <|  _ d  |  _ d  S(   NRu   (   R$   Rz   R   t   file(   t   selfR$   Rz   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __init__  s
    	 c         C   s   h  d d <|  _ d |  _ d S(   s   Set inside of self to type NoneRu   N(   R   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   zero  s    c         C   s#   | i  i   |  _  d |  i  d <d S(   s?   Set self.data the same as dir_rp.data but with safe permissionsi  R   N(   Rz   R   (   R   t   dir_rp(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   make_zero_dir  s    c         C   s   d S(   Ni   (    (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __nonzero__  s    c         C   s?  |  i  | i  j o d Sn x|  i i   D]} |  i   o | d j o q+ | d j o t i o q+ | d j o q+ | d j o q+ | d j o |  i   o q+ | d	 j o t i o q+ | d
 j o t i	 o q+ | d j o t i
 o q+ | d j o t i o q+ | d j o t i o q+ | d j p | d j oI | i i | d  } | o) | d j o | |  i | j o d Sq7q+ | d j p | d j o; |  i   p) |  i   d j p t i p t i o q+ y | i | } Wn t j
 o d Sn X|  i | | j o d Sq+ q+ Wd S(   s(   True iff the two rorpaths are equivalentR   R   t   unamet   gnameR   R   R   R   t   eat   aclt   win_aclt
   carbonfilet   resourceforkR   R   R   i   N(   s   uids   gids   unameR   (   R$   R   Rz   t   keysR+   R   t   preserve_atimeR&   t
   eas_activet   acls_activet   win_acls_activet   carbonfile_activet   resource_forks_activet   gett   getnumlinkst   compare_inodet   preserve_hardlinkst   KeyError(   R   t   othert   keyt
   other_namet	   other_val(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __eq__  sR               !  	 c         C   sE  x|  i  i   D]} | d j o q | d j o1 |  i   o$ | i   o | i   d j o q | d j o t i o q | d j o q | d	 j p | d
 j o q | d j o |  i   o q | d j o q | d j o t i o q | d j o t i o q | d j o t i	 o q | d j o t i
 o q | d j o t i o q | d j o q | d j p | d j o q | i  i |  p |  i  | | i  | j o d Sq q W|  i   o^ |  i   oP t i oF y( t i |   | i   j o d Sn WqAt j
 o d SqAXn d S(   s  True iff the two rorpaths are kinda equivalent

		Sometimes because permissions cannot be set, a file cannot be
		replicated exactly on the remote side.  This function tells
		you whether the two files are close enough.  self must be the
		original rpath.

		R   R   R   R   Ru   i    R   R   R   R   R   R   R   R   R   R   R   t   sha1t
   mirrornamet   incnamei   (   s   uids   gids   unames   gname(   Rz   R   RM   R&   t   getsizeR   R   RS   R_   Re   RZ   RV   t   has_keyR   R+   RO   RQ   RR   Rk   R   (   R   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   equal_loose  sR    	              % i   i    i   c         C   s  | o; |  i  | i  j o( t i d |  i  | i  f |
  d Sn x|  i i   D]} | d j o |  i   p | o qR | d j o |	 o qR | d j o t i o qR | d j o qR | d	 j p | d
 j o qR | d j o |  i	   p | o qR | d j o |  i	   p | o qR | d j o | o qR | d j o | o qR | d j o | o qR | i i
 |  p |  i | | i | j oa | i i
 |  p t i d | f |
  n, t i d | |  i | | i | f |
  d SqR qR Wd S(   s;   Like __eq__, but log more information.  Useful when testings   Index %s != index %sR   R   R   R   Ru   R   R   R   R   R   R   R   R   R   s   Second is missing key %ss   Value of %s differs: %s vs %si   N(   s   uids   gids   unames   gname(   R$   R"   R#   R   Rz   R   R+   R   R   R&   R   (   R   R   t   check_indext   compare_inodest   compare_ownershipt   compare_aclst   compare_east   compare_win_aclst   compare_sizet   compare_typet	   verbosityR   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   equal_verbose  sH         # #   	c      
   C   sT   |  i    d j o t i o t i } |  i | d | d t i d t i d t i S(   s7   Like equal_verbose, but set parameters like __eq__ doesi   R   R   R   R   (   R   R   R   R   R   R   R   R   (   R   R   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   equal_verbose_auto  s    		c         C   s   |  i  |  S(   N(   R   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __ne__!  s    c         C   s   d |  i  |  i f S(   s   Pretty print file statisticss   Index: %s
Data: %s(   R$   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __str__#  s    c         C   s   d |  i    |  i   f S(   s   Return summary strings   %s %s(   R   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   summary_string'  s    c         C   s   |  i  |  i f S(   s   Return picklable state

		This is necessary in case the RORPath is carrying around a
		file object, which can't/shouldn't be pickled.

		(   R$   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __getstate__+  s    c         C   s   | \ |  _  |  _ d S(   s*   Reproduce RORPath from __getstate__ outputN(   R$   Rz   (   R   t
   rorp_state(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __setstate__4  s    c         C   s   t  |  i |  i i    S(   s    Return new rorpath based on self(   R   R$   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   getRORPath8  s    c         C   s   |  i  d S(   s   Returns type of file

		The allowable types are None if the file doesn't exist, 'reg'
		for a regular file, 'dir' for a directory, 'dev' for a device
		file, 'fifo' for a fifo, 'sock' for a socket, and 'sym' for a
		symlink.
		
		Ru   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   <  s    	c         C   s   |  i  d d j S(   s   True if self is a dirRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR)   H  s    c         C   s   |  i  d d j S(   s   True if self is a regular fileRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR&   L  s    c         C   s   |  i  d d j S(   s   True if path is of a symlinkRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR+   P  s    c         C   s   |  i  d d j S(   s   True if path is a fifoRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR5   T  s    c         C   s)   |  i  d d j o |  i  d d d j S(   s'   True if path is a character device fileRu   R   R   i    R    (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR1   X  s    c         C   s)   |  i  d d j o |  i  d d d j S(   s#   True if path is a block device fileRu   R   R   i    R!   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR4   \  s    c         C   s   |  i  d d j S(   s   True if path is a device fileRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRb   `  s    c         C   s   |  i  d d j S(   s   True if path is a socketRu   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR7   d  s    c         C   s>   |  i  d } | d j p$ | d j p | d j p
 | d j S(   s4   True if the file is a sock, symlink, device, or fifoRu   R   R   R   R   (   Rz   (   R   Ru   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRM   h  s    c         C   s*   |  i  i d  o |  i  d Sn d Sd S(   s   Return permission block of fileR   i    N(   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR.   n  s     c         C   s-   y |  i  d SWn t j
 o d Sn Xd S(   s"   Return username that owns the fileR   N(   Rz   R   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   getunames  s      c         C   s-   y |  i  d SWn t j
 o d Sn Xd S(   s#   Return groupname that owns the fileR   N(   Rz   R   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   getgnamex  s      c         C   s   |  i  i d  S(   s"   True if rpath has a size parameterR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   hassize}  s    c         C   s   |  i  d S(   s   Return length of file in bytesR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    c         C   s   |  i  d |  i  d f S(   s   Return userid/groupid of fileR   R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRk     s    c         C   s   |  i  d S(   s   Return access time in secondsR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   getatime  s    c         C   s   |  i  d S(   s#   Return modification time in secondsR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRd     s    c         C   s   |  i  d S(   s   Return change time in secondsR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRm     s    c         C   s   |  i  d S(   s   Return inode number of fileR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRv     s    c         C   s   |  i  d S(   s   Device number file resides onR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt	   getdevloc  s    c         C   s*   |  i  i d  o |  i  d Sn d Sd S(   s#   Number of places inode is linked toR   i   N(   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s     c         C   s   |  i  d S(   s   Wrapper around os.readlink()R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR0     s    c         C   s   |  i  d d S(   s4   Return a devices major/minor numbers from dictionaryR   i   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR2     s    c            sG   | o   i  p t    f d   } t | |    _  d   _ d S(   s:   Right now just set self.file to be the already opened filec              s   d    _ d  S(   N(   R   t   file_already_open(    (   R   (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   closing_hook  s    N(   R   RN   t   RPathFileHookR   R  (   R   R   R  (    (   R   s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   setfile  s    c         C   s"   |  i  p d Sn d i |  i   S(   s[   Return path of index portion

		For instance, if the index is ("a", "b"), return "a/b".

		R   t   /(   R$   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    
 c         C   s   |  i  d S(   s   If there is a file attached, say what it is

		Currently the choices are 'snapshot' meaning an exact copy of
		something, and 'diff' for an rdiff style diff.

		t   filetype(   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_attached_filetype  s    c         C   s   | |  i  d <d S(   s!   Set the type of the attached fileR  N(   Rz   (   R   Ru   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_attached_filetype  s    c         C   s   |  i  i d  S(   s   True if rorp is a signature/diff for a hardlink file

		This indicates that a file's data need not be transferred
		because it is hardlinked on the remote side.

		t   linked(   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   isflaglinked  s    c         C   s   |  i  d S(   s3   Return previous index that a file is hard linked toR  (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_link_flag  s    c         C   s   | |  i  d <d S(   s8   Signal that rorp is a signature/diff for a hardlink fileR  N(   Rz   (   R   R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   flaglinked  s    c         C   sK   | d j o t  d |   n |  i o t  d   n d |  _ |  i S(   s;   Return file type object if any was given using self.setfileR=   s   Bad mode %ss   Attempt to open same file twicei   (   R   R  R   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRD     s     
	c         C   sd   |  i  oV x |  i  i t i  o q W|  i  i   p t d |  i |  i f  d |  _	 n d S(   s*   If file is present, discard data and closes(   Error closing file
data = %s
index = %s
N(
   R   R   R   R   RK   RN   Rz   R$   R   R  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   close_if_necessary  s    
  	c         C   s   | |  i  d <d S(   s9   Record access control list in dictionary.  Does not writeR   N(   Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_acl  s    c         C   sG   y |  i  d SWn1 t j
 o% t |  i  } |  i  d <| Sn Xd S(   s1   Return access control list object from dictionaryR   N(   Rz   R   t   get_blank_aclR$   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRa     s
     c         C   s   | |  i  d <d S(   s9   Record extended attributes in dictionary.  Does not writeR   N(   Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_ea  s    c         C   sG   y |  i  d SWn1 t j
 o% t |  i  } |  i  d <| Sn Xd S(   s!   Return extended attributes objectR   N(   Rz   R   t   get_blank_eaR$   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRU     s
     c         C   s   |  i  i d  S(   s(   True if rpath has a carbonfile parameterR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR[     s    c         C   s   |  i  d S(   s   Returns the carbonfile dataR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR]     s    c         C   s   | |  i  d <d S(   s6   Record carbonfile data in dictionary.  Does not write.R   N(   Rz   (   R   t   cfile(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_carbonfile  s    c         C   s   |  i  i d  S(   s*   True if rpath has a resourcefork parameterR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRW     s    c         C   s   |  i  d S(   s'   Return the resource fork in binary dataR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRY     s    c         C   s   | |  i  d <d S(   s3   Record resource fork in dictionary.  Does not writeR   N(   Rz   (   R   t   rfork(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_resource_fork  s    c         C   s   | |  i  d <d S(   s@   Record Windows access control list in dictionary. Does not writeR   N(   Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_win_acl  s    c         C   sG   y |  i  d SWn1 t j
 o% t |  i  } |  i  d <| Sn Xd S(   s1   Return access control list object from dictionaryR   N(   Rz   R   t   get_blank_win_aclR$   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRg     s
     c         C   s   |  i  i d  S(   s3   True if rorp has an alternate mirror name specifiedR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   has_alt_mirror_name"  s    c         C   s   |  i  d S(   s1   Return alternate mirror name (for long filenames)R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_alt_mirror_name&  s    c         C   s   | |  i  d <d S(   s   Set alternate mirror name to filename

		Instead of writing to the traditional mirror file, store
		mirror information in filename in the long filename
		directory.

		R   N(   Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_alt_mirror_name*  s    c         C   s   |  i  i d  S(   s6   True if rorp has an alternate increment base specifiedR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   has_alt_inc_name4  s    c         C   s   |  i  d S(   s<   Return alternate increment base (used for long name support)R   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_alt_inc_name8  s    c         C   s   | |  i  d <d S(   s   Set alternate increment name to name

		If set, increments will be in the long name directory with
		name as their base.  If the alt mirror name is set, this
		should be set to the same.

		R   N(   Rz   (   R   R|   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_alt_inc_name<  s    c         C   s   |  i  i d  S(   s%   True iff self has its sha1 digest setR   (   Rz   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   has_sha1F  s    c         C   s   |  i  d S(   s;   Return sha1 digest.  Causes exception unless set_sha1 firstR   (   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_sha1J  s    c         C   s   | |  i  d <d S(   s'   Set sha1 hash (should be in hexdecimal)R   N(   Rz   (   R   t   digest(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   set_sha1N  s    N(I   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R  R  R   t   gettypeR)   R&   R+   R5   R1   R4   Rb   R7   RM   R.   R  R	  R
  R   Rk   R  Rd   Rm   Rv   R  R   R0   R2   R  R   R  R  R  R  R  RD   R  R  Ra   R  RU   R[   R]   R  RW   RY   R!  R"  Rg   R$  R%  R&  R'  R(  R)  R*  R+  R-  (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s   				!	(	 
								
																																																			
			
		t   RPathc           B   sK  e  Z d  Z e i d  Z d= d> d  Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d? d   Z% d!   Z& d@ d"  Z' d#   Z( d$   Z) d> d%  Z* d> d&  Z+ d> d'  Z, d(   Z- d)   Z. d*   Z/ d+   Z0 d,   Z1 d-   Z2 d.   Z3 d> d/  Z4 d> d0  Z5 d> d1  Z6 d> d2  Z7 d3   Z8 d4 d5  Z9 d6   Z: d7   Z; d8   Z< d9   Z= d:   Z> d;   Z? d<   Z@ RS(A   s!  Remote Path class - wrapper around a possibly non-local pathname

	This class contains a dictionary called "data" which should
	contain all the information about the file sufficient for
	identification (i.e. if two files have the the same (==) data
	dictionary, they are the same file).

	s	   [\\\"\$`]c         C   s   | |  _  | |  _ | |  _ | d j	 oD | d j o d d i |  |  _ ql d i | f |  |  _ n d |  _ | p | d j o | |  _ n |  i   d S(   s  RPath constructor

		connection = self.conn is the Connection the RPath will use to
		make system calls, and index is the name of the rpath used for
		comparison, and should be a tuple consisting of the parts of
		the rpath after the base split up.  For instance ("foo",
		"bar") for "foo/bar" (no base), and ("local", "bin") for
		"/usr/local/bin" if the base is "/usr".

		For the root directory "/", the index is empty and the base is
		"/".

		R  N(	   R>   R$   t   baseR   R   R%   R   Rz   RA   (   R   t
   connectionR0  R$   Rz   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   ^  s    			 	 c         C   s   d |  i  |  i |  i f S(   Ns   Path: %s
Index: %s
Data: %s(   R%   R$   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR  v  s    c         C   s   |  i  i |  i |  i |  i f S(   s   Return picklable state

		The rpath's connection will be encoded as its conn_number.  It
		and the other information is put in a tuple. Data and any attached
		file won't be saved.

		(   R>   t   conn_numberR0  R$   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR  z  s    c         C   sN   | \ } |  _  |  _ |  _ t i | |  _ d i |  i  f |  i  |  _ d S(   s(   Reproduce RPath from __getstate__ outputR  N(   R0  R$   Rz   R   t   connection_dictR>   R   R%   (   R   t   rpath_stateR2  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s    c         C   sC   |  i  i i |  i  |  _ |  i   o |  i  i i |   n d S(   s%   Set data dictionary using the wrapperN(   R>   R@   R~   R%   Rz   R   t   setdata_local(   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRA     s     c         C   sP   |  i  d } |  i   | |  i  d j p! t d |  i | |  i  d f  d S(   s   Raise an error if consistency of rp broken

		This is useful for debugging when the cache and disk get out
		of sync and you need to find out where it happened.

		Ru   s   
Name: %s
Old: %s --> New: %s
N(   Rz   RA   RN   R%   (   R   t   temptype(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   check_consistency  s
    
c         C   s   y$ |  i  i i |  i | t i @ Wn t j
 ov } | i d j oZ |  i   oL t	 i
 d |  i | | d @f d  |  i  i i |  i | d @t i @ q   n X| |  i d <d S(   s   Wrapper around os.chmods!   Inappropriate file type or formatsU   Warning: Unable to set permissions of %s to %o - trying again without sticky bit (%o)i  i   R   N(   R>   R   R^   R%   R   t   permission_maskRw   t   strerrorR)   R"   R#   Rz   (   R   t   permissionsRJ   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR^     s    $	c         C   s   t  i d |  i | f d  y# |  i i i |  i | | f  Wn6 t j
 o* t  i d |  i | | f f d  n X| |  i d <| |  i d <d S(   s   Change file modification timess   Setting time of %s to %di   sI   Cannot change times of %s to %s - problem is probably64->32bit conversioni   R   R   N(   R"   R#   R%   R>   R   t   utimet   OverflowErrorRz   (   R   t
   accesstimet   modtime(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   settime  s     #	c            s   t  i    f d   d    d j  o t  i d  i d  n y/  i i i  i t t i      f  Wnm t j
 o$ t  i d  i   f d  nL t	 j
 o2  i i i
 d j p  i   o   q n X   i d <d	 S(
   s)   Set only modtime (access time to present)c              s   d   i    f S(   s   Setting time of %s to %d(   R%   (    (   R>  R   (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRt     s    i   i    s.   Warning: modification time of %s isbefore 1970i   sI   Cannot change mtime of %s to %s - problem is probably64->32bit conversionR{   R   N(   R"   R#   R%   R>   R   R;  R   t   timeR<  Rw   R|   R)   Rz   (   R   R>  (    (   R>  R   s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRc     s     	 /	$c         C   s   |  i    oQ y  |  i i i |  i | |  Wqt t j
 o t i d |  i d  qt Xn t i	 |  i | |  | |  i
 d <| |  i
 d <d S(   s   Set file's uid and gids<   Warning: lchown missing, cannot change ownership of symlink i   R   R   N(   R+   R>   R}   t   lchownR%   RB   R"   R#   R   RP   Rz   (   R   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRP     s      	c         C   s;   t  i d |  i d  |  i i i |  i  |  i   d  S(   Ns   Making directory i   (   R"   R#   R%   R>   R   R*   RA   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR*     s    c         C   s;   t  i d |  i d  |  i i i |  i  |  i   d  S(   Ns   Making directory path i   (   R"   R#   R%   R>   R   t   makedirsRA   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRB    s    c         C   sC   t  i d |  i d  |  i i i |  i  h  d  d <|  _ d  S(   Ns   Removing directory i   Ru   (   R"   R#   R%   R>   R   t   rmdirR   Rz   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRC    s    c         C   s   |  i  i i |  i  S(   s2   Return list of string paths returned by os.listdir(   R>   R   t   listdirR%   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRD    s    c         C   s;   |  i  i i | |  i  |  i   |  i   p t  d S(   s.   Make symlink at self.path pointing to linktextN(   R>   R   R/   R%   RA   R+   RN   (   R   t   linktext(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR/     s    
c         C   sD   t  i d |  i | f d  |  i i i | |  i  |  i   d S(   s,   Make self into a hardlink joined to linkpaths   Hard linking %s to %si   N(   R"   R#   R%   R>   R   t   linkRA   (   R   t   linkpath(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   hardlink  s    c         C   s8   |  i  i i |  i  |  i   |  i   p t  d S(   s   Make a fifo at self.pathN(   R>   R   R6   R%   RA   R5   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR6     s    
c         C   s5   |  i  i i |   |  i   |  i   p t  d S(   s   Make a socket at self.pathN(   R>   R@   R   RA   R7   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR8     s    
c         C   s[   t  i d |  i d  |  i i |  i d  i   |  i   |  i   p t |  i  d S(   s"   Make sure file at self.path existss	   Touching i   t   wN(	   R"   R#   R%   R>   RD   RK   RA   R&   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   touch   s    
c         C   sb   |  i    o |  i   d d j Sn: |  i   o |  i   d d j Sn |  i   d d j Sd S(   s?   Return true if current process has full permissions on the filei   i  i@   i8   i   i   N(   t   isownerR.   t   isgroup(   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   hasfullperms  s
      c         C   sb   |  i    o |  i   d d j Sn: |  i   o |  i   d d j Sn |  i   d d j Sd S(   s?   Return true if current process has read permissions on the filei   i   i@   i    i   i   N(   RK  R.   RL  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   readable  s
      c         C   sb   |  i    o |  i   d d j Sn: |  i   o |  i   d d j Sn |  i   d d j Sd S(   s6   Return true if current process has execute permissionsi   i@   i   i   i   i   N(   RK  R.   RL  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   executable  s
      c         C   sa   y |  i  i i   } Wn t j
 o t Sn X| d j p$ |  i i d  o | |  i d j S(   s5   Return true if current process is owner of rp or rooti    R   (   R>   R   t   getuidRB   t   TrueRz   R   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRK    s    	c         C   s3   |  i  i d  o  |  i  d |  i i i d  j S(   s&   Return true if process has group of rpR   t   process_groups(   Rz   R   R>   R   R   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRL  "  s    c         C   s  t  i d |  i d  |  i   oY y |  i   Wq t i j
 o5 t i o |  i	   n |  i
 i i |  i  q Xny y |  i
 i i |  i  Wn[ t j
 oO } | i t i t i f j o' |  i d  |  i
 i i |  i  q   n X|  i   d S(   s;   Delete file at self.path.  Recursively deletes directories.s   Deleting %si   i  N(   R"   R#   R%   R)   RC  R   R   R   t   fsync_directoriest   fsyncR>   t   shutilt   rmtreeRy   Rw   RF   t   EPERMt   EACCESR^   RA   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   '  s      
  c         C   s   t  i d |  i d  |  i   p t Sn |  i   } xG | D]? } |  i |  } | i   p t Sq? | i   o t Sq? q? Wt S(   s<   Returns true if self (or subdir) contains any regular files.s+   Determining if directory contains files: %si   (	   R"   R#   R%   R)   t   FalseRD  t   appendRQ  R   (   R   t   dir_entriest   entryt   child_rp(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR   <  s     c         C   s   d |  i  i d   |  i  S(   s0   Return quoted self.path for use with os.system()s   "%s"c         S   s   d  |  i  d  S(   s   \i    (   t   group(   t   m(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRt   N  s    (   t   regex_chars_to_quotet   subR%   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   quoteK  s    c         C   sg   d i  t d   |  i i d    } |  i d d j o d | } n | p
 d } n |  i |  S(   s   Return RPath canonical version of self.path

		This just means that redundant /'s will be removed, including
		the trailing one, even for directories.  ".." components will
		be retained.

		R  c         S   s   |  o
 |  d  j S(   R   (    (   t   x(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRt   X  s    i    R   (   R   t   filterR%   R   t   newpath(   R   Re  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt	   normalizeP  s      
c         C   sc   |  i    } | i i d  d j o d | i f Sn | i i d  } d i | d   | d f S(   s  Returns a tuple of strings (dirname, basename)

		Basename is never '' unless self is root, so it is unlike
		os.path.basename.  If path is just above root (so dirname is
		root), then dirname is ''.  In all other cases dirname is not
		the empty string.  Also, dirsplit depends on the format of
		self, so basename could be ".." and dirname could be a
		subdirectory.  For an atomic relative path, dirname will be
		'.'.

		R  iR   (   Rf  R%   t   findR   R   (   R   t   normedt   comps(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   dirsplit^  s
     c         C   ss   |  i  o$ |  i |  i |  i |  i  d   Sn |  i   d } | o |  i |  i |  Sn |  i |  i d  Sd S(   s(   Return new RPath of directory self is inii    R  N(   R$   t	   __class__R>   R0  Rj  (   R   t   dirname(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_parent_rpo  s    
$ c         C   s   |  i  |  i | |  S(   s<   Return new RPath with the same connection but different path(   Rk  R>   (   R   Re  R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRe  w  s    c         C   s#   |  i  |  i |  i |  i | f  S(   s4   Return new RPath with same connection by adjoing ext(   Rk  R>   R0  R$   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRZ  {  s    c         C   s(   |  i  |  i d i |  i | f  |  S(   s4   Like append, but add ext to path instead of to indexR  (   Rk  R>   R   R0  (   R   R   t	   new_index(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   append_path  s    c         C   s   |  i  |  i |  i |  S(   s'   Return similar RPath but with new index(   Rk  R>   R0  (   R   R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRn    s    c         C   s%   |  i  |  i |  i | h  d d < S(   s>   Return similar RPath with given index, but initialize to emptyRu   N(   Rk  R>   R0  R   (   R   R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   new_index_empty  s    c         C   s   |  i  t i j o/ | o t |  i |  SqB t |  i |  Sn | oN | d j p | d j o |  i  i i |   Sq |  i  i i |  i |  SnH | d j p | d j o |  i  i i |   Sn |  i  i |  i |  Sd S(   s  Return open file.  Supports modes "w" and "r".

		If compress is true, data written/read will be gzip
		compressed/decompressed on the fly.  The extra complications
		below are for security reasons - try to make the extent of the
		risk apparent from the remote call.

		t   rR=   N(	   R>   R   R?   R   R%   RD   R@   R   R   (   R   R   R9   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRD     s    	 c         C   s   t  i d |  i d  |  i   p t d |  i  |  i d d | } t | |  | i   o t d   n |  i	   | i   S(   s   Reads fp and writes to self.path.  Closes both when done

		If compress is true, fp will be gzip compressed before being
		written to self.  Returns closing value of fp.

		s   Writing file object to i   s   File %s already existst   wbR9   s   Error closing file(
   R"   R#   R%   R   RN   RD   R   RK   R   RA   (   R   t   fpR9   t   outfp(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRC     s     
c         C   sg   |  i    p t d |  i f  |  i d d | } | i |  | i   p t  |  i   d S(   s   Write string s into rpaths   File %s already existsRr  R9   N(   R   RN   R%   RD   R   RK   RA   (   R   R   R9   Rt  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   write_string  s
    "c         C   se   |  i  o |  i  d } n
 |  i } t |  } | o& | \ |  _ |  _ |  _ |  _ d Sn d Sd S(   sv   Return true if path looks like an increment file

		Also sets various inc information used by the *inc* functions.

		ii   N(   R$   R0  R   t   inc_compressedt   inc_timestrt   inc_typet   inc_basestrR   (   R   R   t   inc_info(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt	   isincfile  s    
 	c         C   s   |  i  S(   s%   Return true if inc file is compressed(   Rv  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   isinccompressed  s    c         C   s   |  i  S(   s    Return type of an increment file(   Rx  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   getinctype  s    c         C   s   t  i |  i  S(   s+   Return time in seconds of an increment file(   R   R   Rw  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   getinctime  s    c         C   sR   |  i  o. |  i |  i |  i |  i  d  |  i f  Sn |  i |  i |  i  Sd S(   s8   Return the base filename of an increment file in rp formiN(   R$   Rk  R>   R0  Ry  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt
   getincbase  s    
c         C   s7   |  i    } | i o | i d Sn | i   d Sd S(   s4   Return the base filename string of an increment fileii   N(   R  R$   Rj  (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   getincbase_str  s    
 c      	   C   s   | d j o d } t  i d B} n+ | d j o d } t  i d B} n t  y2 |  i i i |  i | |  i i i | |   Wnc t	 t
 f j
 oQ } t | t
  p | i t i j o% t i d |  i d  |  i   q n X|  i   d S(	   s=   Make a special file with specified type, and major/minor numsR    t   chri  R!   t   blks)   unable to mknod %s -- using touch insteadi   N(   R   t   S_IFCHRt   S_IFBLKR   R>   R   t   mknodR%   R3   Rw   RB   t
   isinstanceRF   RW  R"   R#   RJ  RA   (   R   Ru   R;   R<   t   datatypeR   RJ   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR3     s     2#c         C   s8   | p |  i  i i i |   n t i | i    d S(   s   fsync the current file or directory

		If fp is none, get the file description by opening the file.
		This can be useful for directories.

		N(   R>   R@   R/  t   fsync_localR   RT  t   fileno(   R   Rs  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRT    s     c         C   sy  |  i  t i j p t  y6 t i |  i t i  } t i |  t i	 |  Wn"t
 j
 o} t   i d  o t i	 |  n | i t i t i t i f j p |  i   o   n |  i   o
 d } n; |  i   } | p |  i   |  i   } n |  i d  t i |  i t i  } | d j	 o |  i |  n | o |   n t i |  t i	 |  n Xd S(   s   fsync current file, run locally

		If thunk is given, run it before syncing but after gathering
		the file's file descriptor.

		t   fdi  N(   R>   R   R?   RN   R   RD   R%   t   O_RDONLYRT  RK   Rw   t   localsR   RF   RW  RX  t   EBADFR)   RM  R   R.   RA   R^   t   O_RDWR(   R   t   thunkR  RJ   t   oldperms(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s2     "  

  c         C   s/   |  i  |  t i o |  i   i    n d S(   s&   fsync self and directory self is underN(   RT  R   RS  Rm  (   R   Rs  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   fsync_with_dir   s    
 c         C   s7   |  i  d |  } | i   } | i   p t  | S(   s:   Open file as a regular file, read data, close, return dataR=   (   RD   R   RK   RN   (   R   R   Rs  R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_data%  s    c         C   sB   y |  i  d } Wn* t j
 o t |   } |  i  d <n X| S(   s7   Return access control list object, setting if necessaryR   (   Rz   R   t   acl_get(   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRa   ,  s
      i   c         C   s!   | i  |  |  | |  i d <d S(   se   Change access control list of rp

		If map_names is true, map the ids in acl by user/group names.

		R   N(   t   write_to_rpRz   (   R   R   Ri   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR`   2  s    c         C   sB   y |  i  d } Wn* t j
 o t |   } |  i  d <n X| S(   s7   Return extended attributes object, setting if necessaryR   (   Rz   R   t   ea_get(   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRU   ;  s
      c         C   s   | i  |   | |  i d <d S(   s    Change extended attributes of rpR   N(   R  Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRT   A  s    c         C   sT  | p d Sn t  i d |  i f d  d d k l } d d k l } d d k } d d k } | |  i  } | i	   } | d | _
 | d | _ | d	 | _ | d
 | _ | i |  yp | d } | |  }	 |	 i | i i  \ }
 } } } d | d f |
 _ |	 i | i i |
  |  i |  Wn  t j
 o |  i |  n Xd S(   s   Write new carbon data to self.Ns   Writing carbon data to %si   i(   t   FSSpec(   t   FSReft   creatorRu   t   locationt   flagst
   createDatei    (   R"   R#   R$   t   Carbon.FileR  R  t   Carbon.Filest   MacOSR%   t   FSpGetFInfot   Creatort   Typet   Locationt   Flagst   FSpSetFInfot   FSGetCatalogInfot   Filest   kFSCatInfoCreateDateR  t   FSSetCatalogInfoR  R   (   R   R  R  R  t   CarbonR  t   fsobjt
   finderinfot   cdatet   fsreft   cataloginfot   d1t   d2t   d3(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR\   F  s.     
! c         C   s   |  i    p t  y |  i d } Wn t j
 o yO |  i i t i i |  i d d  d  } | i	   } | i
   p t  Wn! t t f j
 o } d } n X| |  i d <n X| S(   s/   Return resource fork data, setting if necessaryR   s   ..namedforkt   rsrcR=   t    (   R&   RN   Rz   R   R>   RD   R   R%   R   R   RK   RE   Rw   (   R   R   t   rfork_fpRJ   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRY   `  s     !	 c         C   sw   t  i d |  i f d  |  i i t i i |  i d d  d  } | i |  | i	   p t
  |  i |  d S(   s   Write new resource fork to selfs   Writing resource fork to %si   s   ..namedforkR  Rr  N(   R"   R#   R$   R>   RD   R   R%   R   R   RK   RN   R!  (   R   t
   rfork_dataRs  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRX   n  s
    *c         C   sB   y |  i  d } Wn* t j
 o t |   } |  i  d <n X| S(   s8   Return Windows access control list, setting if necessaryR   (   Rz   R   t   win_acl_get(   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRg   v  s
      c         C   s   t  |  |  | |  i d <d S(   s    Change access control list of rpR   N(   Rf   Rz   (   R   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRf   |  s    (    N(    (    (A   R   R   R   t   ret   compileR`  R   R   R  R  R  RA   R7  R^   R?  Rc   RP   R*   RB  RC  RD  R/   RH  R6   R8   RJ  RM  RN  RO  RK  RL  R   R   Rb  Rf  Rj  Rm  Re  RZ  Ro  Rn  Rp  RD   RC   Ru  R{  R|  R}  R~  R  R  R3   RT  R  R  R  Ra   R`   RU   RT   R\   RY   RX   Rg   Rf   (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR/  S  sx   		
																																						
!								R  c           B   s5   e  Z d  Z d   Z d d  Z d   Z d   Z RS(   s&   Look like a file, but add closing hookc         C   s   | |  _  | |  _ d  S(   N(   R   t   closing_thunk(   R   R   R  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    	ic         C   s   |  i  i |  S(   N(   R   R   (   R   t   length(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    c         C   s   |  i  i |  S(   N(   R   R   (   R   t   buf(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    c         C   s   |  i  i   } |  i   | S(   s%   Close file and then run closing thunk(   R   RK   R  (   R   RL   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRK     s    
(   R   R   R   R   R   R   RK   (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s
   		R   c           B   s    e  Z d  Z d   Z d   Z RS(   s   Like gzip.GzipFile, except remove destructor

	The default GzipFile's destructor prints out some messy error
	messages.  Use this class instead to clean those up.

	c         C   s   d  S(   N(    (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __del__  s    c         C   s+   | d j o |  i  i Sn t |   d  S(   NR  (   t   fileobjR  RB   (   R   R|   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   __getattr__  s     (   R   R   R   R  R  (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s   	t	   MaybeGzipc           B   s>   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z RS(   s  Represent a file object that may or may not be compressed

	We don't want to compress 0 length files.  This class lets us
	delay the opening of the file until either the first write (so we
	know it has data and should be compressed), or close (when there's
	no data).

	c         C   s@   | i    p
 t |  | |  _ | |  _ d |  _ d |  _ d S(   s6   Return file-like object with filename based on base_rpi    N(   R   RN   t   base_rpt   callbackR   R  t   closed(   R   R  R  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s
    			c         C   s+   | d j o |  i  i Sn t |   d  S(   NR  (   R  R  RB   (   R   R|   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s     c         C   sZ   |  i  i o9 |  i  i d  |  i  i d d f } |  i  i |  Sn |  i  i d  Sd S(   s*   Return gzipped rp by adding .gz to base_rpis   .gzN(   R  R$   Rn  Ro  (   R   t   newind(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyt   get_gzipped_rp  s    %c         C   s|   |  i  o |  i  i |  Sn | p d Sn |  i   } |  i o |  i |  n | i d d d |  _  |  i  i |  S(   s   Write buf to fileobjNRr  R9   i   (   R  R   R  R  RD   (   R   R  t   new_rp(    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    
  
 c         C   se   |  i  o d Sn d |  _  |  i o |  i i   Sn |  i o |  i |  i  n |  i i   d S(   s(   Close related fileobj, pass return valuei   N(   R  R   R  RK   R  R  RJ  (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRK     s    
 	
 
 N(	   R   R   R   R   R   R  R  R   RK   (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s   				
c         C   s  |  i  t i j p t  t i |  i d  |  i d <t i |  i d  |  i d <t i o t	 |   |  i d <n t i
 o t |   |  i d <n t i o t |   |  i d <n t i o |  i   o |  i   n t i o$ |  i   o t |   |  i d <n d	 S(
   s   Set eas/acls, uid/gid, resource fork in data dictionary

	This is a global function because it must be called locally, since
	these features may exist or not depending on the connection.

	R   R   R   R   R   R   R   R   N(   R>   R   R?   RN   RQ   t	   uid2unameRz   t	   gid2gnamet   eas_connR  t	   acls_connR  t   win_acls_connR  t   resource_forks_connR&   RY   t   carbonfile_connt   carbonfile_get(   R@   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR5    s    
 
 
c         C   s  d d k  l } d d k  l } d d k } d d k } y | |  i  } | i   } | |  i | i i	  \ } } }	 }
 h  | i
 d <| i d <| i d <| i d <| i d	 d
 <} | SWn4 | i j
 o% t i d |  i f d  d Sn Xd S(   s'   Return carbonfile value for local rpathi(   R  (   R  NR  Ru   R  R  i   R  s*   Cannot read carbonfile information from %si   (   R  R  R  R  R  R%   R  R  R  R  R  R  R  R  R  t   ErrorR"   R#   R   (   R@   R  R  R  R  R  R  R  R  R  R  R  (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s$    '	c         C   s   d p t   d  S(   Ni    (   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s    c         C   s   d p t   d  S(   Ni    (   RN   (   R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s    c         C   s   d p t   d  S(   Ni    (   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s    c         C   s   d p t   d  S(   Ni    (   RN   (   R$   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR     s    c         C   s   d p t   d  S(   Ni    (   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR    s    c         C   s   d p t   d  S(   Ni    (   RN   (   R   (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyRf     s    c           C   s   d p t   d  S(   Ni    (   RN   (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pyR#    s    (7   R   R   R   R  t   sysRU  t   gzipR   R@  RF   R   R   t   staticR"   RQ   R}   R   R   t   ImportErrort	   ExceptionR    R   R   R   R   R   R   R(   R'   Rh   Rl   Rp   Rq   R   R~   R   R   R   R   R   R   R   R/  R  R   R  R5  R  R  R  R  R  R  Rf   R#  (    (    (    s7   /var/lib/python-support/python2.5/rdiff_backup/rpath.pys   <module>$   sX   lH
					#							5						   00								