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

Pavel Grunt pgrunt at redhat.com
Tue Nov 29 09:09:43 UTC 2016


On Tue, 2016-11-29 at 09:52 +0100, Christophe Fergeau wrote:
> On Mon, Nov 28, 2016 at 03:11:18PM +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.
> > ---
> > v2: Keep user set (required) version of Python
> > ---
> >  m4/spice-deps.m4 | 20 +++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> > 
> > diff --git a/m4/spice-deps.m4 b/m4/spice-deps.m4
> > index 3b22422..3f9af43 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"],
> 
> Sorry, just noticed that you can do
> AX_PYTHON_MODULE([six], [0], [python3]) (which is the default)
> or
> AX_PYTHON_MODULE([six], [0], [python])

I think some distros (Arch Linux ?) ship python as python3, looking at
AX_PYTHON_MODULE I would explicitly set python2 instead of python

> 
> rather than setting PYTHON=python3/PYTHON(python2)
> 
indeed

> Acked-by: Christophe Fergeau <cfergeau at redhat.com>

Thanks, I will send update for AX_PYTHON_MODULE and this patch

Pavel



More information about the Spice-devel mailing list