rbackup package

Submodules

rbackup.config module

rbackup.config.get_files_by_suffix(suffix)

Retrieve all include files from the program configuration directory.

>>> get_files_by_suffix('-include.conf') # doctest: +ELLIPSIS
<generator object ...>
Parameters

suffix (str) – the suffix to search for

Returns

paths pointing to include files

Return type

generator of path-like objects

rbackup.config.load_list_from_option(parser, *, section='', option='')

Using a combination of ConfigParser and JSON, load a list from a configuration file option.

Note

If the specified option has an empty value, then an empty list is returned.

Parameters
  • parser (ConfigParser object) – the parsed config file

  • section (str) – the section of the config file to load

  • option (str) – the option value inside the specified section

Returns

the list parsed by JSON

Return type

list

rbackup.config.merge_exclude_files()

Merge exclude file paths into one file and yield its path for use with rsync.

Returns

path-like object

rbackup.config.merge_files(files)

Parse, filter, and sort through config files to create a single –files-from argument.

>>> merge_files(get_files_by_suffix('-include.conf')) # doctest: +ELLIPSIS
PosixPath('/tmp/...')
Parameters

files (iterable of path-like objects) – files including paths to read from

Returns

path to file that lists include paths

Return type

path-like object

rbackup.config.merge_include_files()

Merge include file paths into one file and yield its path for use with rsync.

Returns

path-like object

rbackup.config.parse_configfile()

Parse the main backup config file and return a configparser.ConfigParser object.

Returns

object used to parse config file

Return type

ConfigParser object

Raises

FileNotFoundError – if path does not exist

rbackup.rsync module

rbackup.rsync.rsync(*args)

Run an rsync command.

Parameters

args (str) – all arguments to pass to rsync

Raises

subprocess.CalledProcessError – if rsync process failed

Module contents