duplicity.util module

Miscellaneous utilities.

class duplicity.util.BlackHoleList[source]

Bases: list

append(x)[source]
class duplicity.util.FakeTarFile[source]
close()[source]
debug = 0
duplicity.util.copyfileobj(infp, outfp, byte_count=-1)[source]

Copy byte_count bytes from infp to outfp, or all if byte_count < 0

Returns the number of bytes actually written (may be less than byte_count if find eof. Does not close either fileobj.

duplicity.util.escape(string)[source]

Convert a (bytes) filename to a format suitable for logging (quoted utf8)

duplicity.util.exception_traceback(limit=50)[source]
@return A string representation in typical Python format of the
currently active/raised exception.
duplicity.util.get_tarinfo_name(ti)[source]
duplicity.util.ignore_missing(fn, filename)[source]

Execute fn on filename. Ignore ENOENT errors, otherwise raise exception.

@param fn: callable @param filename: string

duplicity.util.make_tarfile(mode, fp)[source]
duplicity.util.maybe_ignore_errors(fn)[source]

Execute fn. If the global configuration setting ignore_errors is set to True, catch errors and log them but do continue (and return None).

@param fn: A callable. @return Whatever fn returns when called, or None if it failed and ignore_errors is true.

duplicity.util.release_lockfile()[source]
duplicity.util.uexc(e)[source]
duplicity.util.ufn(filename)[source]

Convert a (bytes) filename to unicode for printing

duplicity.util.uindex(index)[source]

Convert an index (a tuple of path parts) to unicode for printing

duplicity.util.which(program)[source]

Return absolute path for program name. Returns None if program not found.