Wrapper class around a file like “/usr/bin/env”
This class makes certain file operations more convenient and associates stat information with filenames
- class duplicity.path.DupPath(base, index=(), parseresults=None)
Represent duplicity data files
Based on the file name, files that are compressed or encrypted will have different open() methods.
- __init__(base, index=(), parseresults=None)
The actual filename (no directory) must be the single element of the index, unless parseresults is given.
- filtered_open(mode='rb', gpg_profile=None)
Return fileobj with appropriate encryption/compression
If encryption is specified but no gpg_profile, use config.default_profile.
- class duplicity.path.Path(base, index=())
Path class - wrapper around ordinary local files
Besides caching stat() results, this class organizes various file code.
- __init__(base, index=())
Return new Path with ext added to index
Change permissions of the path
- compare_recursive(other, verbose=None)
Compare self to other Path, descending down directories
Return true if path is a directory and contains child
Remove this file
Remove self by recursively deleting files under it
Return string of canonical version of path
Remove “.”, and trailing slashes where possible. Note that it’s harder to remove “..”, as “foo/bar/..” is not necessarily “foo”, so we can’t use path.normpath()
Return filename of last component
Return directory that self is in
Return temp non existent path in same directory as self
Return true if path is a directory and is empty
Return list generated by os.listdir
- makedev(type, major, minor)
Make a device file with specified type, major/minor nums
Make directory(s) at specified path
Like rename but destination may be on different file system
Return new Path with index index
Return fileobj associated with self
Usually this is just the file data on disk, but can be replaced with arbitrary data using the setfileobj method.
Patch self with diff and then copy attributes over
Return quoted version of s (defaults to self.name)
The output is meant to be interpreted with shells, so can be used with os.system.
- regex_chars_to_quote = re.compile('[\\\\\\"\\$`]')
Rename file at current path to new_path.
Refresh stat cache
Open the file, write 0 bytes, close
Return unquoted version of string s, as quoted by above quote()
Copy file object fin to self. Close both when done.
- class duplicity.path.PathDeleter
Delete a directory. Called by Path.deltree
- can_fast_process(index, path)
True if object can be processed without new branch (stub)
Do any final processing before leaving branch (stub)
- fast_process(index, path)
Process args without new child branch (stub)
- start_process(index, path)
Do some initial processing (stub)
- exception duplicity.path.PathException
- class duplicity.path.ROPath(index, stat=None)
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.
- __init__(index, stat=None)
Black out self - set type and stat to None
Compare data from two regular files, return true if same
- compare_verbose(other, include_data=0)
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.
Only run if include_data is true.
Copy self to other. Also copies data. Other must be Path
Only copy attributes from self to other
True if corresponding file exists
Return contents of associated fileobj in string
Return relative path, created from index
Return ropath copy of self
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.
Return device number path resides on
Return mod time of path in seconds
Return permissions mode, owner and group
Return length in bytes from stat object
Set data from tarinfo object (part of tarfile module)
True is self is a device file
True if self is dir
True if self is fifo
True if self corresponds to regular file
True is self is socket
True if self is sym
Return fileobj associated with self
True if self and other have same permissions and ownership
Set the value of self.type, self.mode from self.stat
Set file object returned by open()