]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
py:get_opts:VersionOptions prints version in --help
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 30 Jan 2025 08:22:04 +0000 (21:22 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Sat, 8 Feb 2025 02:33:38 +0000 (02:33 +0000)
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 <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Jennifer Sutton <jennifersutton@catalyst.net.nz>
python/samba/getopt.py
selftest/knownfail.d/samba-tool--version [deleted file]

index 2620138c3de0e7ed6e7565a56225fb8731799690..b810e5ac797bd2112235d6a11e44a68a96252065 100644 (file)
@@ -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 (file)
index f02938d..0000000
+++ /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\)