From: Douglas Bagnall Date: Thu, 30 Jan 2025 08:22:04 +0000 (+1300) Subject: py:get_opts:VersionOptions prints version in --help X-Git-Tag: tevent-0.17.0~853 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f7bc5cb12a687a8851f07788700fb44e134f894;p=thirdparty%2Fsamba.git 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 --- 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\)