[Spice-devel,spice-common] spice-deps: Set python version based on modules availability

Submitted by Pavel Grunt on Nov. 28, 2016, 10:48 a.m.

Details

Message ID 20161128104851.31915-1-pgrunt@redhat.com
State New
Headers show
Series "spice-deps: Set python version based on modules availability" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Pavel Grunt Nov. 28, 2016, 10:48 a.m.
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.
---
intention behind this patch is to fix failing gitlab ci
---
 m4/spice-deps.m4 | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
index 3b22422..243e614 100644
--- a/m4/spice-deps.m4
+++ b/m4/spice-deps.m4
@@ -155,15 +155,25 @@  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([PYTHON=python3
+               AX_PYTHON_MODULE([six])
+               AX_PYTHON_MODULE([pypfarsing])
+               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
 ])
 

Comments

On Mon, Nov 28, 2016 at 11:48:51AM +0100, Pavel Grunt wrote:
> 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.
> ---
> intention behind this patch is to fix failing gitlab ci
> ---
>  m4/spice-deps.m4 | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
> index 3b22422..243e614 100644
> --- a/m4/spice-deps.m4
> +++ b/m4/spice-deps.m4
> @@ -155,15 +155,25 @@ 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([PYTHON=python3
> +               AX_PYTHON_MODULE([six])
> +               AX_PYTHON_MODULE([pypfarsing])
> +               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])])

I think this could break if the user explicitly sets PYTHON=mypython2.6
in order to use some very specific python binary.

Christophe