]> arthur.barton.de Git - bup.git/blob - lib/bup/cmd/features.py
8d4c4f38820fdba31787c7b032b037bbff5ea972
[bup.git] / lib / bup / cmd / features.py
1
2 from __future__ import absolute_import, print_function
3 import platform, sys
4
5 from bup import _helpers, metadata, options, version
6 from bup.io import byte_stream
7
8 out = None
9
10 def show_support(out, bool_opt, what):
11     out.write(b'    %s: %s\n' % (what, b'yes' if bool_opt else b'no'))
12
13 optspec = """
14 bup features
15 """
16
17 def main(argv):
18     o = options.Options(optspec)
19     opt, flags, extra = o.parse_bytes(argv[1:])
20
21     sys.stdout.flush()
22     out = byte_stream(sys.stdout)
23
24     out.write(b'bup %s\n' % version.version)
25     out.write(b'Source %s %s\n' % (version.commit, version.date))
26
27     have_readline = getattr(_helpers, 'readline', None)
28     have_libacl = getattr(_helpers, 'read_acl', None)
29     have_xattr = metadata.xattr
30
31     out.write(b'    Python: %s\n' % platform.python_version().encode('ascii'))
32     show_support(out, have_readline, b'Command line editing (e.g. bup ftp)')
33     show_support(out, have_libacl, b'Saving and restoring POSIX ACLs')
34     show_support(out, have_xattr, b'Saving and restoring extended attributes (xattrs)')