]> git.ipfire.org Git - oddments/collecty.git/commitdiff
Add version information
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Jun 2015 11:37:31 +0000 (11:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 6 Jun 2015 11:37:31 +0000 (11:37 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
.gitignore
Makefile.am
configure.ac
src/collecty/__version__.py.in [new file with mode: 0644]
src/collecty/bus.py
src/collecty/client.py
src/collecty/constants.py

index 6e3c11c1dc3c1c1de6f1469be690e9f79b948152..4413936d85f2b4204e4c5c192543b288d7ea3c32 100644 (file)
@@ -4,6 +4,7 @@
 /man/*.[0-9]
 /man/*.html
 /missing
+/src/collecty/__version__.py
 /src/systemd/collecty.service
 /tmp
 *.py[co]
index 80c19462d788f4c817a88b9d91669f8a30fc66b0..fe00da70d244df941f55b00b03d210f703098ba8 100644 (file)
@@ -72,6 +72,7 @@ dist_bin_SCRIPTS = \
 
 collecty_PYTHON = \
        src/collecty/__init__.py \
+       src/collecty/__version__.py \
        src/collecty/bus.py \
        src/collecty/client.py \
        src/collecty/constants.py \
index 46fc55bd2fd6592c3fafadf65c13af8a54c5f224..c0e8011e997af18aedcf996283bd3a21e540122f 100644 (file)
@@ -146,6 +146,7 @@ AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
 AC_CONFIG_FILES([
        Makefile
        po/Makefile.in
+       src/collecty/__version__.py
 ])
 
 AC_OUTPUT
diff --git a/src/collecty/__version__.py.in b/src/collecty/__version__.py.in
new file mode 100644 (file)
index 0000000..3851b24
--- /dev/null
@@ -0,0 +1,2 @@
+# this file is autogenerated by the buildsystem
+COLLECTY_VERSION = "@PACKAGE_VERSION@"
index d67332f082742f3d2a58b31b5b67c403a944171f..463f4224cac8af0d8e54c55f7ff2b038e98c3147 100644 (file)
@@ -93,3 +93,7 @@ class GraphGenerator(dbus.service.Object):
                        Returns a list of all available templates
                """
                return [t.name for t in self.collecty.templates]
+
+       @dbus.service.method(BUS_DOMAIN, in_signature="", out_signature="s")
+       def Version(self):
+               return COLLECTY_VERSION
index 39c5fe879cc924fc435ca59ca832b4c527ef93c1..05c076030d9d6e229c0782275e3d9e74ce5849d5 100644 (file)
@@ -21,6 +21,7 @@
 
 import argparse
 import dbus
+import platform
 import sys
 
 from .constants import *
@@ -76,6 +77,15 @@ class CollectyClient(object):
                with open(ns.filename, "wb") as f:
                        f.write(graph)
 
+       def version_cli(self, args):
+               daemon_version = self.proxy.Version()
+
+               print(_("collecty %s running on Python %s") % \
+                       (COLLECTY_VERSION, platform.python_version()))
+
+               if not COLLECTY_VERSION == daemon_version:
+                       print(_("daemon %s") % daemon_version)
+
        def parse_cli(self, args):
                parser = argparse.ArgumentParser(prog="collecty-client")
                subparsers = parser.add_subparsers(help="sub-command help")
@@ -105,6 +115,10 @@ class CollectyClient(object):
                        help=_("Lists all graph templates"))
                parser_list_templates.set_defaults(func=self.list_templates_cli)
 
+               # version
+               parser_version = subparsers.add_parser("version", help=_("Show version"))
+               parser_version.set_defaults(func=self.version_cli)
+
                return parser.parse_args(args)
 
        def run_cli(self, args=None):
index 34d5406bf69566d0e1a0b19008f49175abab7b85..9bca6d7b6a13d2ef52a2f4a742b5ed9e53461a06 100644 (file)
@@ -21,6 +21,8 @@
 
 from .i18n import _
 
+from .__version__ import *
+
 DATABASE_DIR = "/var/lib/collecty"
 
 BUS_DOMAIN = "org.ipfire.collecty1"