- class duplicity.patchdir.IndexedTuple(index, sequence)[source]
Like a tuple, but has .index (used previously by collate_iters)
- class duplicity.patchdir.Multivol_Filelike(tf, tar_iter, tarinfo_list, index)[source]
Emulate a file like object from multivols
Maintains a buffer about the size of a volume. When it is read() to the end, pull in more volumes as desired.
- __init__(tf, tar_iter, tarinfo_list, index)[source]
Initializer. tf is TarFile obj, tarinfo is first tarinfo
- duplicity.patchdir.Patch(base_path, difftar_fileobj)[source]
Patch given base_path and file object containing delta
- duplicity.patchdir.Patch_from_iter(base_path, fileobj_iter, restrict_index=())[source]
Patch given base_path and iterator of delta file objects
- class duplicity.patchdir.PathPatcher(base_path)[source]
Used by DirPatch, process the given basis and diff
- can_fast_process(index, basis_path, diff_ropath)[source]
No need to recurse if diff_ropath isn’t a directory
- class duplicity.patchdir.ROPath_IterWriter(base_path)[source]
Used in Write_ROPaths above
We need to use an ITR because we have to update the permissions/times of directories after we write the files in them.
- can_fast_process(index, ropath)[source]
Can fast process (no recursion) if ropath isn’t a directory
- class duplicity.patchdir.TarFile_FromFileobjs(fileobj_iter)[source]
Like a tarfile.TarFile iterator, but read from multiple fileobjs
Make new tarinfo iterator
fileobj_iter should be an iterator of file objects opened for reading. They will be closed at end of reading.
- duplicity.patchdir.Write_ROPaths(base_path, rop_iter)[source]
Write out ropaths in rop_iter starting at base_path
Returns 1 if something was actually written, 0 otherwise.
Collate iterators by index
Input is a list of n iterators each of which must iterate elements with an index attribute. The elements must come out in increasing order, and the index should be a tuple itself.
The output is an iterator which yields tuples where all elements in the tuple have the same index, and the tuple has n elements in it. If any iterator lacks an element with that index, the tuple will have None in that spot.
Turn file-like difftarobj into iterator of ROPaths
- duplicity.patchdir.filter_path_iter(path_iter, index)[source]
Rewrite path elements of path_iter so they start with index
Discard any that doesn’t start with index, and remove the index prefix from the rest.
Return (index, difftype, multivol) pair from tarinfo object
Combine a list of iterators of ropath patches
The iter_list should be sorted in patch order, and the elements in each iter_list need to be orderd by index. The output will be an iterator of the final ROPaths in index order.
Given an sequence of ROPath deltas, remove blank and unnecessary
The sequence is assumed to be in patch order (later patches apply to earlier ones). A patch is unnecessary if a later one doesn’t require it (for instance, any patches before a “delete” are unnecessary).
- duplicity.patchdir.patch_diff_tarfile(base_path, diff_tarfile, restrict_index=())[source]
Patch given Path object using delta tarfile (as in tarfile.TarFile)
If restrict_index is set, ignore any deltas in diff_tarfile that don’t start with restrict_index.
Apply the patches in patch_seq, return single ropath