summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-09 02:30:48 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-09 11:53:00 +0200
commitececb7326200d6c59fa15f7542421099d3899297 (patch)
treee83b5c50a1c6ed900d6b6e7074c0940f8f0b6ea9 /source4/scripting/python
parent9af8d02b2230f78e4842106b918ff278dadd1d59 (diff)
downloadsamba-ececb7326200d6c59fa15f7542421099d3899297.tar.gz
samba-ececb7326200d6c59fa15f7542421099d3899297.tar.bz2
samba-ececb7326200d6c59fa15f7542421099d3899297.zip
Support --version in python scripts.
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/getopt.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/getopt.py b/source4/scripting/python/samba/getopt.py
index 1fbfd9c713..6ec7defde8 100644
--- a/source4/scripting/python/samba/getopt.py
+++ b/source4/scripting/python/samba/getopt.py
@@ -71,6 +71,14 @@ class VersionOptions(optparse.OptionGroup):
"""Command line option for printing Samba version."""
def __init__(self, parser):
optparse.OptionGroup.__init__(self, parser, "Version Options")
+ self.add_option("--version", action="callback",
+ callback=self._display_version,
+ help="Display version number")
+
+ def _display_version(self, option, opt_str, arg, parser):
+ import samba, sys
+ print samba.version
+ sys.exit(0)
class CredentialsOptions(optparse.OptionGroup):