automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug#7944: Should AM_PATH_PYTHON call AC_ARG_VAR?


From: Stefano Lattarini
Subject: Re: bug#7944: Should AM_PATH_PYTHON call AC_ARG_VAR?
Date: Tue, 15 Feb 2011 10:17:24 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Tuesday 15 February 2011, Ralf Wildenhues wrote:
> 
> Sorry, I'm probably just making myself not clear.  Here's a patch that I
> would squash in on top of your patch, and that I think addresses all
> issues that I mention in my review.  It basically reverses the doc part
> of your patch and then applies the diff I posted earlier.
>
Ah, ok.  Things are clear now.

> Thanks for your patience,
> Ralf
> 
> diff --git a/doc/automake.texi b/doc/automake.texi
> index fd9d33e..091d7a2 100644
> --- a/doc/automake.texi
> +++ b/doc/automake.texi
> @@ -7632,24 +7632,19 @@ Python
>  installed (see the definitions of @code{pythondir} and
>  @code{pkgpythondir} below).
>  
> address@hidden AM_PATH_PYTHON (@ovar{version}, @ovar{action-if-found}, 
> @ovar{action-if-not-found})
> address@hidden AM_PATH_PYTHON (@ovar{version}, @ovar{action-if-found}, @
> +  @ovar{action-if-not-found})
>  
> -Search for a Python interpreter on the system.  The user can force the
> -choice with the configuration variable @env{PYTHON}.
> +Search for a Python interpreter on the system.  This macro takes three
> +optional arguments.  The first argument, if present, is the minimum
> +version of Python required for this package: @code{AM_PATH_PYTHON}
> +will skip any Python interpreter that is older than @var{version}.
> +If an interpreter is found and satisfies @var{version}, then
> address@hidden is run.  Otherwise, @var{action-if-not-found} is
> +run.
>  
> -This macro takes three optional arguments.
> -
> -The first argument, if present, is the minimum version of Python required
> -for this package; @code{AM_PATH_PYTHON} will skip any Python interpreter
> -that is older than @var{version}.  Note that, if @env{PYTHON} was specified
> -by the user, the version check will still take place, but no other Python
> -interpreter will be tried if that fails.
> -
> -If an interpreter is found and satisfies @var{version} (which, in case
> address@hidden is empty or unspecified, means @emph{any} interpreter), then
> address@hidden is run.  Otherwise, @var{action-if-not-found} is run.
> -If @var{action-if-not-found} is not specified, as in the following example
> -, the default is to abort @command{configure}.
> +If @var{action-if-not-found} is not specified, as in the following
> +example, the default is to abort @command{configure}.
>  
>  @example
>  AM_PATH_PYTHON([2.2])
> @@ -7664,6 +7659,9 @@ Python
>  AM_PATH_PYTHON([2.5],, [:])
>  @end example
>  
> +If the @env{PYTHON} variable is set when @code{AM_PATH_PYTHON} is
> +called, then that will be the only Python interpreter that is tried.
> +
>  @code{AM_PATH_PYTHON} creates the following output variables based on
>  the Python installation found during configuration.
>  @end defmac
> @@ -7679,8 +7677,8 @@ Python
>  as follows.
>  
>  @example
> -  AM_PATH_PYTHON(,, [:])
> -  AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
> +AM_PATH_PYTHON(,, [:])
> +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
>  @end example
>  
>  @item PYTHON_VERSION
> 

For reference, I've attached the patch I've finally pushed (to maint).

Regards,
  Stefano
From 5bf7af6e1e5fa63bc192ed972ef8c83dd6faec2b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Mon, 31 Jan 2011 21:24:02 +0100
Subject: [PATCH] python: report the 'PYTHON' influential environment variable

* m4/python.m4 (AM_PATH_PYTHON): Call AC_ARG_VAR on PYTHON.
* doc/automake.texi (Python): Update and extend.
* tests/help-python.test: New test.
* tests/Makefile.am (TESTS): Update.
* THANKS (Jack Kelly): Update e-mail address.

Suggestion by Jack Kelly.
---
 ChangeLog              |   10 ++++++++++
 THANKS                 |    2 +-
 doc/automake.texi      |   10 +++++++---
 m4/python.m4           |    2 ++
 tests/Makefile.am      |    1 +
 tests/Makefile.in      |    1 +
 tests/help-python.test |   37 +++++++++++++++++++++++++++++++++++++
 7 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100755 tests/help-python.test

diff --git a/ChangeLog b/ChangeLog
index 786cadd..fa53707 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-15  Stefano Lattarini  <address@hidden>
+
+       python: report the 'PYTHON' influential environment variable
+       * m4/python.m4 (AM_PATH_PYTHON): Call AC_ARG_VAR on PYTHON.
+       * doc/automake.texi (Python): Update and extend.
+       * tests/help-python.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * THANKS (Jack Kelly): Update e-mail address.
+       Suggestion by Jack Kelly.
+
 2011-02-10  Stefano Lattarini  <address@hidden>
 
        tests defs: clear TESTS_ENVIRONMENT variable
diff --git a/THANKS b/THANKS
index 78da1de..60af1ee 100644
--- a/THANKS
+++ b/THANKS
@@ -134,7 +134,7 @@ Ian Lance Taylor    address@hidden
 Илья Н. Голубев            address@hidden
 Imacat                 address@hidden
 Inoue                  address@hidden
-Jack Kelly             address@hidden
+Jack Kelly             address@hidden
 James Amundson         address@hidden
 James Henstridge       address@hidden
 James R. Van Zandt     address@hidden
diff --git a/doc/automake.texi b/doc/automake.texi
index f5066d4..b6fc4ab 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -7603,7 +7603,8 @@ files in your @file{Makefile.am}, depending on where you 
want your files
 installed (see the definitions of @code{pythondir} and
 @code{pkgpythondir} below).
 
address@hidden AM_PATH_PYTHON (@ovar{version}, @ovar{action-if-found}, 
@ovar{action-if-not-found})
address@hidden AM_PATH_PYTHON (@ovar{version}, @ovar{action-if-found}, @
+  @ovar{action-if-not-found})
 
 Search for a Python interpreter on the system.  This macro takes three
 optional arguments.  The first argument, if present, is the minimum
@@ -7629,6 +7630,9 @@ If Python >= 2.5 was only @emph{optional} to the package,
 AM_PATH_PYTHON([2.5],, [:])
 @end example
 
+If the @env{PYTHON} variable is set when @code{AM_PATH_PYTHON} is
+called, then that will be the only Python interpreter that is tried.
+
 @code{AM_PATH_PYTHON} creates the following output variables based on
 the Python installation found during configuration.
 @end defmac
@@ -7644,8 +7648,8 @@ to setup a conditional in order to disable the relevant 
part of a build
 as follows.
 
 @example
-  AM_PATH_PYTHON(,, [:])
-  AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+AM_PATH_PYTHON(,, [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
 @end example
 
 @item PYTHON_VERSION
diff --git a/m4/python.m4 b/m4/python.m4
index 50e1538..655dcf3 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -40,6 +40,8 @@ AC_DEFUN([AM_PATH_PYTHON],
 [python python2 python3 python3.2 python3.1 python3.0 python2.7 dnl
  python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
 
+  AC_ARG_VAR([PYTHON], [the Python interpreter])
+
   m4_if([$1],[],[
     dnl No version check is needed.
     # Find any Python interpreter.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c9f8467..ed415f2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -374,6 +374,7 @@ help-init.test \
 help-lispdir.test \
 help-maintainer.test \
 help-multilib.test \
+help-python.test \
 help-regex.test \
 help-silent.test \
 help-upc.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 1370461..1363930 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -644,6 +644,7 @@ help-init.test \
 help-lispdir.test \
 help-maintainer.test \
 help-multilib.test \
+help-python.test \
 help-regex.test \
 help-silent.test \
 help-upc.test \
diff --git a/tests/help-python.test b/tests/help-python.test
new file mode 100755
index 0000000..ba20013
--- /dev/null
+++ b/tests/help-python.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that macro `AM_PATH_PYTHON' adds proper text to the
+# configure help screen.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_PATH_PYTHON
+END
+
+$ACLOCAL
+$AUTOCONF
+
+./configure --help >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep '^  *PYTHON  *the Python interpreter$' stdout
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]