3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 from __future__ import absolute_import, print_function
9 from os.path import relpath
12 from bup import options, drecurse
13 from bup.compat import argv_bytes
14 from bup.helpers import log, parse_excludes, parse_rx_excludes, saved_errors
15 from bup.io import byte_stream
21 x,xdev,one-file-system don't cross filesystem boundaries
22 exclude= a path to exclude from the backup (can be used more than once)
23 exclude-from= a file that contains exclude paths (can be used more than once)
24 exclude-rx= skip paths matching the unanchored regex (may be repeated)
25 exclude-rx-from= skip --exclude-rx patterns in file (may be repeated)
26 q,quiet don't actually print filenames
27 profile run under the python profiler
29 o = options.Options(optspec)
30 (opt, flags, extra) = o.parse(sys.argv[1:])
33 o.fatal("exactly one filename expected")
35 drecurse_top = argv_bytes(extra[0])
36 excluded_paths = parse_excludes(flags, o.fatal)
37 if not drecurse_top.startswith(b'/'):
38 excluded_paths = [relpath(x) for x in excluded_paths]
39 exclude_rxs = parse_rx_excludes(flags, o.fatal)
40 it = drecurse.recursive_dirlist([drecurse_top], opt.xdev,
41 excluded_paths=excluded_paths,
42 exclude_rxs=exclude_rxs)
48 cProfile.run('do_it()')
55 out = byte_stream(sys.stdout)
57 out.write(name + b'\n')
60 log('WARNING: %d errors encountered.\n' % len(saved_errors))