From 4da04257d78f1f2e16925ab12817966f875cc4b3 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 2 Aug 2020 20:10:29 +0200 Subject: [PATCH] features: show version number of the Python interpreter This can be handy for debiugging, especially if the interpreter used (like /usr/bin/python3) is a symlink to the actual Python interpreter (/usr/bin/python3.7) and/or doesn't include the "micro" version at all. Signed-off-by: Alexander Barton Reviewed-by: Rob Browning Tested-by: Rob Browning --- Documentation/bup-features.md | 10 ++++++---- lib/cmd/features-cmd.py | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Documentation/bup-features.md b/Documentation/bup-features.md index 959905e..d458ff3 100644 --- a/Documentation/bup-features.md +++ b/Documentation/bup-features.md @@ -13,16 +13,18 @@ bup features # DESCRIPTION `bup features` reports information about the current bup installation, -for example, whether command line editing is supported by `bup ftp`, -or POSIX ACLs can be saved and restored. +for example, which version of the Python interpreter is used, whether command +line editing is supported by `bup ftp`, or POSIX ACLs can be saved and +restored. # EXAMPLES $ bup features bup 0.31~a7ff2d5b8c12b24b97858aad1251d28c18f8c1e1 source a7ff2d5b8c12b24b97858aad1251d28c18f8c1e1 2020-07-05 14:54:06 -0500 - Command line editing (e.g. bup ftp): yes - Saving and restoring POSIX ACLs: yes + Python: 3.7.3 + Command line editing (e.g. bup ftp): yes + Saving and restoring POSIX ACLs: yes .... # SEE ALSO diff --git a/lib/cmd/features-cmd.py b/lib/cmd/features-cmd.py index c049535..3a5911d 100755 --- a/lib/cmd/features-cmd.py +++ b/lib/cmd/features-cmd.py @@ -15,7 +15,7 @@ exec "$bup_python" "$0" # end of bup preamble from __future__ import absolute_import, print_function -import os.path, sys +import os.path, sys, platform sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..'] @@ -43,6 +43,7 @@ have_readline = getattr(_helpers, 'readline', None) have_libacl = getattr(_helpers, 'read_acl', None) have_xattr = metadata.xattr +out.write(b' Python: %s\n' % platform.python_version().encode('ascii')) show_support(out, have_readline, b'Command line editing (e.g. bup ftp)') show_support(out, have_libacl, b'Saving and restoring POSIX ACLs') show_support(out, have_xattr, b'Saving and restoring extended attributes (xattrs)') -- 2.39.2