]> arthur.barton.de Git - bup.git/blob - lib/cmd/features-cmd.py
join-cmd: copy to bup.cmd.join
[bup.git] / lib / cmd / features-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
5 arg_i=1
6 for arg in "$@"; do
7     export "BUP_ARGV_${arg_i}"="$arg"
8     shift
9     arg_i=$((arg_i + 1))
10 done
11 # Here to end of preamble replaced during install
12 bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
13 exec "$bup_python" "$0"
14 """
15 # end of bup preamble
16
17 from __future__ import absolute_import, print_function
18
19 # Intentionally replace the dirname "$0" that python prepends
20 import os, sys
21 sys.path[0] = os.path.dirname(os.path.realpath(__file__)) + '/..'
22
23 import platform
24
25 from bup import _helpers, compat, metadata, options, version
26 from bup.io import byte_stream
27
28 out = None
29
30 def show_support(out, bool_opt, what):
31     out.write(b'    %s: %s\n' % (what, b'yes' if bool_opt else b'no'))
32
33 optspec = """
34 bup features
35 """
36 o = options.Options(optspec)
37 opt, flags, extra = o.parse(compat.argv[1:])
38
39 sys.stdout.flush()
40 out = byte_stream(sys.stdout)
41
42 out.write(b'bup %s\n' % version.version)
43 out.write(b'Source %s %s\n' % (version.commit, version.date))
44
45 have_readline = getattr(_helpers, 'readline', None)
46 have_libacl = getattr(_helpers, 'read_acl', None)
47 have_xattr = metadata.xattr
48
49 out.write(b'    Python: %s\n' % platform.python_version().encode('ascii'))
50 show_support(out, have_readline, b'Command line editing (e.g. bup ftp)')
51 show_support(out, have_libacl, b'Saving and restoring POSIX ACLs')
52 show_support(out, have_xattr, b'Saving and restoring extended attributes (xattrs)')