Package duplicity :: Module path :: Class ROPath
[hide private]
[frames] | no frames]

Class ROPath

source code

Read only Path

Objects of this class doesn't represent real files, so they don't have a name. They are required to be indexed though.

Instance Methods [hide private]
 
__init__(self, index, stat=None)
ROPath initializer
source code
 
set_from_stat(self)
Set the value of self.type, self.mode from self.stat
source code
 
blank(self)
Black out self - set type and stat to None
source code
 
exists(self)
True if corresponding file exists
source code
 
isreg(self)
True if self corresponds to regular file
source code
 
isdir(self)
True if self is dir
source code
 
issym(self)
True if self is sym
source code
 
isfifo(self)
True if self is fifo
source code
 
issock(self)
True is self is socket
source code
 
isdev(self)
True is self is a device file
source code
 
getdevloc(self)
Return device number path resides on
source code
 
getsize(self)
Return length in bytes from stat object
source code
 
getmtime(self)
Return mod time of path in seconds
source code
 
get_relative_path(self)
Return relative path, created from index
source code
 
getperms(self)
Return permissions mode, owner and group
source code
 
open(self, mode)
Return fileobj associated with self
source code
 
get_data(self)
Return contents of associated fileobj in string
source code
 
setfileobj(self, fileobj)
Set file object returned by open()
source code
 
init_from_tarinfo(self, tarinfo)
Set data from tarinfo object (part of tarfile module)
source code
 
get_ropath(self)
Return ropath copy of self
source code
 
get_tarinfo(self)
Generate a tarfile.TarInfo object based on self
source code
 
__eq__(self, other)
Used to compare two ROPaths.
source code
 
__ne__(self, other) source code
 
compare_verbose(self, other, include_data=0)
Compare ROPaths like __eq__, but log reason if different
source code
 
compare_data(self, other)
Compare data from two regular files, return true if same
source code
 
perms_equal(self, other)
True if self and other have same permissions and ownership
source code
 
copy(self, other)
Copy self to other.
source code
 
copy_attribs(self, other)
Only copy attributes from self to other
source code
 
__repr__(self)
Return string representation
source code
Instance Variables [hide private]
  stat
Set user and group id use numeric id if name lookup fails OR --numeric-owner is set
Method Details [hide private]

get_tarinfo(self)

source code 

Generate a tarfile.TarInfo object based on self

Doesn't set size based on stat, because we may want to replace data wiht other stream. Size should be set separately by calling function.

__eq__(self, other)
(Equality operator)

source code 

Used to compare two ROPaths. Doesn't look at fileobjs

compare_verbose(self, other, include_data=0)

source code 

Compare ROPaths like __eq__, but log reason if different

This is placed in a separate function from __eq__ because __eq__ should be very time sensitive, and logging statements would slow it down. Used when verifying.

If include_data is true, also read all the data of regular files and see if they differ.

copy(self, other)

source code 

Copy self to other. Also copies data. Other must be Path