[telepathy-ashes/master] Added !version

David Laban david.laban at collabora.co.uk
Thu Oct 15 15:48:03 PDT 2009


Note that this requires a few environment variables to be set.
There doesn't seem to be a portable way to do this, so I leave this
up to launcher scripts.
---
 ashes/tools/commands.py |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/ashes/tools/commands.py b/ashes/tools/commands.py
index af24c98..5607df1 100644
--- a/ashes/tools/commands.py
+++ b/ashes/tools/commands.py
@@ -100,6 +100,37 @@ class CommandExecutor(TextChannelEchoer):
         else:
             return self.get_help()
 
+    def do_version(self, id, timestamp, sender, type, flags, text):
+        """
+        !version
+
+        Prints the version info of all components, as discovered at launch-time
+        and stored in evironment variables.
+        """
+        ret = []
+        cm_version = os.environ.get('CM_VERSION', None)
+        other_versions = os.environ.get('OTHER_VERSIONS', None)
+        git_revision = os.environ.get('GIT_REVISION', None)
+        git_url = os.environ.get('GIT_URL', None)
+
+        ret.append("I am the Telepathy Echo Bot, written by David Laban "
+            "<david.laban at collabora.co.uk>")
+        if cm_version:
+            ret.append("I was launched with %s" % cm_version)
+        else:
+            ret.append("I'm afraid I can't tell you what version of the CM "
+                "I was launched with, because I wasn't given that information.")
+        if git_url and git_revision:
+            ret.append("My source can be found at %s" % git_url)
+            ret.append("git revision: %s" % git_revision)
+
+
+        if other_versions:
+            ret.append("Other telepathy components installed are: %s"
+                % other_versions.replace('\n', ' '))
+
+        return '\n'.join(ret)
+
     def do_delay(self, id, timestamp, sender, type, flags, text):
         """
         !delay timeout message
-- 
1.5.6.5



More information about the telepathy-commits mailing list