From 6f7bc5cb12a687a8851f07788700fb44e134f894 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 30 Jan 2025 21:22:04 +1300 Subject: [PATCH] py:get_opts:VersionOptions prints version in --help Because it might as well. Like this: Version Options: -V, --version Display version number (4.22.2) BUG: https://bugzilla.samba.org/show_bug.cgi?id=15770 Signed-off-by: Douglas Bagnall Reviewed-by: Jennifer Sutton --- python/samba/getopt.py | 4 ++-- selftest/knownfail.d/samba-tool--version | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 selftest/knownfail.d/samba-tool--version diff --git a/python/samba/getopt.py b/python/samba/getopt.py index 2620138c3de..b810e5ac797 100644 --- a/python/samba/getopt.py +++ b/python/samba/getopt.py @@ -32,6 +32,7 @@ from samba.credentials import ( MUST_USE_KERBEROS, ) from samba._glue import get_burnt_commandline +import samba def check_bytes(option, opt, value): @@ -310,10 +311,9 @@ class VersionOptions(OptionGroup): super().__init__(parser, "Version Options") self.add_option("-V", "--version", action="callback", callback=self._display_version, - help="Display version number") + help=f"Display version number ({samba.version})") def _display_version(self, option, opt_str, arg, parser): - import samba print(samba.version) sys.exit(0) diff --git a/selftest/knownfail.d/samba-tool--version b/selftest/knownfail.d/samba-tool--version deleted file mode 100644 index f02938dec8f..00000000000 --- a/selftest/knownfail.d/samba-tool--version +++ /dev/null @@ -1,2 +0,0 @@ -^samba\.tests\.samba_tool\.help\.samba\.tests\.samba_tool\.help\.HelpTestCase\.test_help_version\(none\) -^samba\.tests\.samba_tool\.help\.samba\.tests\.samba_tool\.help\.HelpTestCase\.test_help_version\(fileserver\) -- 2.47.2