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

Submitted by Pavel Grunt on Nov. 28, 2016, 2:11 p.m.

Details

Message ID 20161128141118.16018-1-pgrunt@redhat.com
State Accepted
Commit 5f241e655b7b7bce96d15c4062b843a67152a0a9
Headers show
Series "spice-deps: Set python version based on modules availability" ( rev: 2 ) in Spice

Not browsing as part of any series.

Commit Message

Pavel Grunt Nov. 28, 2016, 2:11 p.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.
---
v2: Keep user set (required) version of Python
---
 m4/spice-deps.m4 | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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"],
+              [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 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])

rather than setting PYTHON=python3/PYTHON(python2)

Acked-by: Christophe Fergeau <cfergeau@redhat.com>
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@redhat.com>

Thanks, I will send update for AX_PYTHON_MODULE and this patch

Pavel
On Tue, Nov 29, 2016 at 10:09:43AM +0100, Pavel Grunt wrote:
> 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

The macro documentation is explicitly saying to use python3 for python3,
and python for python2
https://www.gnu.org/software/autoconf-archive/ax_python_module.html
I did not check what the macro does with that 3rd arg though.

Christophe
On Tue, 2016-11-29 at 10:12 +0100, Christophe Fergeau wrote:
> On Tue, Nov 29, 2016 at 10:09:43AM +0100, Pavel Grunt wrote:
> > 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
> 
> The macro documentation is explicitly saying to use python3 for
> python3,
> and python for python2
> https://www.gnu.org/software/autoconf-archive/ax_python_module.html
> I did not check what the macro does with that 3rd arg though.
I know, I looked
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plai
n;f=m4/ax_python_module.m4

It just assigns it to PYTHON variable

> 
> Christophe
On Tue, Nov 29, 2016 at 10:18:46AM +0100, Pavel Grunt wrote:
> On Tue, 2016-11-29 at 10:12 +0100, Christophe Fergeau wrote:
> > On Tue, Nov 29, 2016 at 10:09:43AM +0100, Pavel Grunt wrote:
> > > 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
> > 
> > The macro documentation is explicitly saying to use python3 for
> > python3,
> > and python for python2
> > https://www.gnu.org/software/autoconf-archive/ax_python_module.html
> > I did not check what the macro does with that 3rd arg though.
> I know, I looked
> http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plai
> n;f=m4/ax_python_module.m4
> 
> It just assigns it to PYTHON variable

Hmm ok. Bit worried that we are doing too much magic with all that
autodetection stuff. We'll see how it goes ;)

Christophe
On Tue, 2016-11-29 at 10:34 +0100, Christophe Fergeau wrote:
> On Tue, Nov 29, 2016 at 10:18:46AM +0100, Pavel Grunt wrote:
> > On Tue, 2016-11-29 at 10:12 +0100, Christophe Fergeau wrote:
> > > On Tue, Nov 29, 2016 at 10:09:43AM +0100, Pavel Grunt wrote:
> > > > 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
> > > 
> > > The macro documentation is explicitly saying to use python3 for
> > > python3,
> > > and python for python2
> > > https://www.gnu.org/software/autoconf-archive/ax_python_module.h
> > > tml
> > > I did not check what the macro does with that 3rd arg though.
> > 
> > I know, I looked
> > http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_
> > plai
> > n;f=m4/ax_python_module.m4
> > 
> > It just assigns it to PYTHON variable
> 
> Hmm ok. Bit worried that we are doing too much magic with all that
> autodetection stuff. We'll see how it goes ;)

And I realized why I had to do it with setting PYTHON variable
consider:

1. user sets PYTHON=mypython
2. AX_PYTHON_MODULE([six], [0], [python3]) will check for the six
module in mypython instead of python3
3 check fails -> AX_PYTHON_MODULE([six], [0], [python2]) will check 
for the six module in mypython instead of python2

In other words it is needed to unset PYTHON variable before the
python2 check

So I think v2 is correct - since it first runs the "strict (failing)"
AX_PYTHON_MODULE check in case the PYTHON variable was specified by
the user - overriding/unsetting the variable is avoided

Pavel


> 
> Christophe
On Tue, Nov 29, 2016 at 11:06:04AM +0100, Pavel Grunt wrote:
> On Tue, 2016-11-29 at 10:34 +0100, Christophe Fergeau wrote:
> > On Tue, Nov 29, 2016 at 10:18:46AM +0100, Pavel Grunt wrote:
> > > On Tue, 2016-11-29 at 10:12 +0100, Christophe Fergeau wrote:
> > > > On Tue, Nov 29, 2016 at 10:09:43AM +0100, Pavel Grunt wrote:
> > > > > 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
> > > > 
> > > > The macro documentation is explicitly saying to use python3 for
> > > > python3,
> > > > and python for python2
> > > > https://www.gnu.org/software/autoconf-archive/ax_python_module.h
> > > > tml
> > > > I did not check what the macro does with that 3rd arg though.
> > > 
> > > I know, I looked
> > > http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_
> > > plai
> > > n;f=m4/ax_python_module.m4
> > > 
> > > It just assigns it to PYTHON variable
> > 
> > Hmm ok. Bit worried that we are doing too much magic with all that
> > autodetection stuff. We'll see how it goes ;)
> 
> And I realized why I had to do it with setting PYTHON variable
> consider:
> 
> 1. user sets PYTHON=mypython
> 2. AX_PYTHON_MODULE([six], [0], [python3]) will check for the six
> module in mypython instead of python3
> 3 check fails -> AX_PYTHON_MODULE([six], [0], [python2]) will check 
> for the six module in mypython instead of python2
> 
> In other words it is needed to unset PYTHON variable before the
> python2 check
> 
> So I think v2 is correct - since it first runs the "strict (failing)"
> AX_PYTHON_MODULE check in case the PYTHON variable was specified by
> the user - overriding/unsetting the variable is avoided

Ok, fine with me.

Christophe