[Top][All Lists]

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

[PATCH] AM_PATH_PYTHON: try "python2" et al. first

From: Kerrick Staley
Subject: [PATCH] AM_PATH_PYTHON: try "python2" et al. first
Date: Thu, 13 Dec 2012 02:52:35 -0600

When checking for a suitable Python version, try "python2", "python
2.7", "python2.6", etc. before trying "python".

Usually, when AM_PATH_PYTHON is invoked with an argument of the form
2.X, it means that only a Python 2 interpreter should be used, and not
a Python 3 interpreter. However, the "python" command invokes a Python
3 interpreter on some systems (see [1]), so if we try "python" first,
we may get a Python 3 interpreter when really a Python 2 interpreter is
needed. By changing the precedence so that the "python2(.X)" commands
are tried first, a Python 2 interpreter will always be used if one is
available (and of sufficiently high version).

 m4/python.m4 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/m4/python.m4 b/m4/python.m4
index 5d9d057..6815ff1 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -37,8 +37,8 @@ AC_DEFUN([AM_PATH_PYTHON],
   dnl Find a Python interpreter.  Python versions prior to 2.0 are not
   dnl supported. (2.0 was released on October 16, 2000).
-[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
- python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
+[python2 python2.7 python2.6 python2.5 python2.4 python2.3 python2.1 python2.0 
+ python python3 python3.2 python3.1 python3.0])
   AC_ARG_VAR([PYTHON], [the Python interpreter])

reply via email to

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