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 21:30:25 +0000 (13: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 d63eb4d59f5a7cc52d7d2829eada84be93b9de20..7ea31186c8e146a84a8137da8017d5d3c3a231b1 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
 PYFILES = $(ovs_pyfiles) python/ovs/dirs.py $(ovstest_pyfiles)
@@ -56,3 +57,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