[Spice-commits] m4/spice-deps.m4

Pavel Grunt pgrunt at kemper.freedesktop.org
Tue Nov 29 10:44:50 UTC 2016


 m4/spice-deps.m4 |   20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 5f241e655b7b7bce96d15c4062b843a67152a0a9
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Mon Nov 28 15:11:18 2016 +0100

    spice-deps: Set python version based on modules availability
    
    Building spice or spice-gtk from git requires python modules pyparsing
    and six. Search for them in the both Python versions and set
    the Python version accordingly.
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 5e9ad17..68e3091 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -155,15 +155,29 @@ AC_DEFUN([SPICE_CHECK_GLIB2], [
 # tarballs so they are disabled by default.
 #---------------------------
 AC_DEFUN([SPICE_CHECK_PYTHON_MODULES], [
-    AM_PATH_PYTHON
     AC_ARG_ENABLE([python-checks],
         AS_HELP_STRING([--enable-python-checks=@<:@yes/no@:>@],
                        [Enable checks for Python modules needed to build from git @<:@default=no@:>@]),
                        [],
                        [enable_python_checks="no"])
     if test "x$enable_python_checks" != "xno"; then
-        AX_PYTHON_MODULE([six], [1])
-        AX_PYTHON_MODULE([pyparsing], [1])
+        AS_IF([test -n "$PYTHON"], # already set required PYTHON version
+              [AM_PATH_PYTHON
+               AX_PYTHON_MODULE([six], [1])
+               AX_PYTHON_MODULE([pyparsing], [1])],
+              [PYTHON=python3
+               AX_PYTHON_MODULE([six])
+               AX_PYTHON_MODULE([pyparsing])
+               test "$HAVE_PYMOD_SIX" = "yes" && test "$HAVE_PYMOD_PYPARSING" = "yes"],
+              [AM_PATH_PYTHON([3])],
+              [PYTHON=python2
+               AX_PYTHON_MODULE([six])
+               AX_PYTHON_MODULE([pyparsing])
+               test "$HAVE_PYMOD_SIX" = "yes" && test "$HAVE_PYMOD_PYPARSING" = "yes"],
+              [AM_PATH_PYTHON([2])],
+              [AC_MSG_ERROR([Python modules six and pyparsing are required])])
+    else
+        AM_PATH_PYTHON
     fi
 ])
 


More information about the Spice-commits mailing list