3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
7 export "BUP_ARGV_${arg_i}"="$arg"
11 # Here to end of preamble replaced during install
12 bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
13 exec "$bup_python" "$0"
17 from __future__ import absolute_import, print_function
19 # Intentionally replace the dirname "$0" that python prepends
21 sys.path[0] = os.path.dirname(os.path.realpath(__file__)) + '/..'
23 from os.path import relpath
25 from bup import compat, options, drecurse
26 from bup.compat import argv_bytes
27 from bup.helpers import log, parse_excludes, parse_rx_excludes, saved_errors
28 from bup.io import byte_stream
34 x,xdev,one-file-system don't cross filesystem boundaries
35 exclude= a path to exclude from the backup (can be used more than once)
36 exclude-from= a file that contains exclude paths (can be used more than once)
37 exclude-rx= skip paths matching the unanchored regex (may be repeated)
38 exclude-rx-from= skip --exclude-rx patterns in file (may be repeated)
39 q,quiet don't actually print filenames
40 profile run under the python profiler
42 o = options.Options(optspec)
43 opt, flags, extra = o.parse(compat.argv[1:])
46 o.fatal("exactly one filename expected")
48 drecurse_top = argv_bytes(extra[0])
49 excluded_paths = parse_excludes(flags, o.fatal)
50 if not drecurse_top.startswith(b'/'):
51 excluded_paths = [relpath(x) for x in excluded_paths]
52 exclude_rxs = parse_rx_excludes(flags, o.fatal)
53 it = drecurse.recursive_dirlist([drecurse_top], opt.xdev,
54 excluded_paths=excluded_paths,
55 exclude_rxs=exclude_rxs)
61 cProfile.run('do_it()')
68 out = byte_stream(sys.stdout)
70 out.write(name + b'\n')
73 log('WARNING: %d errors encountered.\n' % len(saved_errors))