python: New method to retrieve OVS version at runtime.
authorEthan Jackson <ethan@nicira.com>
Thu, 1 Mar 2012 01:20:03 +0000 (17:20 -0800)
committerEthan Jackson <ethan@nicira.com>
Fri, 2 Mar 2012 22:30:02 +0000 (14:30 -0800)
Version information is typically fairly useful when debugging Open
vSwitch.  This patch adds a new version.py module which python code
can use to report its version to callers.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
python/automake.mk
python/ovs/.gitignore [new file with mode: 0644]

index 089ef36..83c4c3e 100644 (file)
@@ -28,6 +28,7 @@ ovs_pyfiles = \
        python/ovs/socket_util.py \
        python/ovs/stream.py \
        python/ovs/timeval.py \
+       python/ovs/version.py \
        python/ovs/vlog.py \
        python/ovs/util.py
 EXTRA_DIST += $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
@@ -54,3 +55,10 @@ install-data-local: ovs-install-data-local
 UNINSTALL_LOCAL += ovs-uninstall-local
 ovs-uninstall-local:
        rm -f $(DESTDIR)$(pkgdatadir)/python/ovs/dirs.py
+
+ALL_LOCAL += $(srcdir)/python/ovs/version.py
+$(srcdir)/python/ovs/version.py: config.status
+       $(ro_shell) > $@.tmp
+       echo 'VERSION = "$(VERSION)"' >> $@.tmp
+       echo 'BUILDNR = "$(BUILDNR)"' >> $@.tmp
+       mv $@.tmp $@
diff --git a/python/ovs/.gitignore b/python/ovs/.gitignore
new file mode 100644 (file)
index 0000000..9852786
--- /dev/null
@@ -0,0 +1 @@
+version.py