After introducing commit a5ae88ff8a276e86c842ac102145432662bf711a
"ovsdb-doc: generate vswitch.[pic|gv] files only if dot tool is
available" Open vSwitch did not build anymore on hosts that did not
have uuid python module installed (for example, we still support
XenServer that still uses old python 2.4 and hence does not have uuid).

After this commit ./configure will check whether uuid module is present
and, if it isn't, then it will add python/compat to the PYTHONPATH.

Signed-Off-By: Ansis Atteka <aatt...@nicira.com>
Issue: 20476
---
 Makefile.am       |  7 +++++++
 configure.ac      |  1 +
 m4/openvswitch.m4 | 12 ++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 45eb3c5..ab491ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,10 +27,17 @@ endif
 # vSwitch, but it causes trouble if you switch from a version with
 # foo/__init__.py into an (older) version with plain foo.py, since
 # foo/__init__.pyc will cause Python to ignore foo.py.
+if INCLUDE_PYTHON_COMPAT
+run_python = \
+       PYTHONDONTWRITEBYTECODE=yes \
+       
PYTHONPATH=$(top_srcdir)/python:$(top_srcdir)/python/compat:$$PYTHONPATH \
+       $(PYTHON)
+else
 run_python = \
        PYTHONDONTWRITEBYTECODE=yes \
        PYTHONPATH=$(top_srcdir)/python:$$PYTHONPATH \
        $(PYTHON)
+endif
 
 ALL_LOCAL =
 BUILT_SOURCES =
diff --git a/configure.ac b/configure.ac
index d6596f9..b906681 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,7 @@ OVS_CHECK_LOGDIR
 OVS_CHECK_PYTHON
 OVS_CHECK_PYUIC4
 OVS_CHECK_OVSDBMONITOR
+OVS_CHECK_PYTHON_COMPAT
 OVS_CHECK_DOT
 OVS_CHECK_IF_PACKET
 OVS_CHECK_IF_DL
diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index dca6cca..012901f 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -286,6 +286,18 @@ AC_DEFUN([OVS_CHECK_OVSDBMONITOR],
    AC_MSG_RESULT([$BUILD_OVSDBMONITOR])
    AM_CONDITIONAL([BUILD_OVSDBMONITOR], [test $BUILD_OVSDBMONITOR = yes])])
 
+dnl Checks for missing python modules at build time
+AC_DEFUN([OVS_CHECK_PYTHON_COMPAT],
+  [OVS_CHECK_PYTHON_MODULE([uuid])
+   if test $ovs_cv_py_uuid = yes; then
+     INCLUDE_PYTHON_COMPAT=no
+   else
+     INCLUDE_PYTHON_COMPAT=yes
+   fi
+   AC_MSG_CHECKING([whether to add python/compat to PYTHONPATH])
+   AC_MSG_RESULT([$INCLUDE_PYTHON_COMPAT])
+   AM_CONDITIONAL([INCLUDE_PYTHON_COMPAT], [test $INCLUDE_PYTHON_COMPAT = 
yes])])
+
 # OVS_LINK2_IFELSE(SOURCE1, SOURCE2, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
 # -------------------------------------------------------------
 # Based on AC_LINK_IFELSE, but tries to link both SOURCE1 and SOURCE2
-- 
1.8.1.2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to