From 54ae4c338aefb588100b5482c2e527a27e7c3086 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 2 Jan 2002 16:12:26 +0000 Subject: [PATCH] Fix for PR automake/278: * m4/python.m4 (AM_PYTHON_CHECK_VERSION): Use `sys.hexversion' to cope with versions such as '2.2c1'. Also, use `int' instead of the obsoleted `string.atoi'. Reported by Enrico Scholz. --- ChangeLog | 8 ++++++++ THANKS | 1 + m4/python.m4 | 16 ++++++++++------ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd9681ad..b6a4812c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-01-02 Alexandre Duret-Lutz + Fix for PR automake/278: + * m4/python.m4 (AM_PYTHON_CHECK_VERSION): Use `sys.hexversion' to cope + with versions such as '2.2c1'. Also, use `int' instead of the + obsoleted `string.atoi'. + Reported by Enrico Scholz. + +2001-01-02 Alexandre Duret-Lutz + Fix for PR automake/280: * automake.in (read_am_file): Warn about trailing backslashes in comments. diff --git a/THANKS b/THANKS index 35fb635b..4d999a0b 100644 --- a/THANKS +++ b/THANKS @@ -41,6 +41,7 @@ Dmitry Mikhin dmitrym@acres.com.au Doug Evans devans@cygnus.com Eleftherios Gkioulekas lf@amath.washington.edu Elrond Elrond@Wunder-Nett.org +Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de Erez Zadok ezk@cs.columbia.edu Eric Magnien emagnien@club-internet.fr Erick Branderhorst branderh@iaehv.nl diff --git a/m4/python.m4 b/m4/python.m4 index e7ad53b1..1e7a950d 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -142,12 +142,16 @@ AC_DEFUN([AM_PATH_PYTHON], # --------------------------------------------------------------------------- # Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. # Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalant (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# hexversion has been introduced in Python 1.5.2; it's probably not +# worth to support older versions (1.5.1 was released on October 31, 1998). AC_DEFUN([AM_PYTHON_CHECK_VERSION], [prog="import sys, string -pyver = string.split(sys.version)[[0]] # first word is version string -# split strings by '.' and convert to numeric -minver = map(string.atoi, string.split('$2', '.')) -pyver = map(string.atoi, string.split(pyver, '.')) -# we can now do comparisons on the two lists: -sys.exit(pyver < minver)" +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +minver = map(int, string.split('$2', '.')) + [[0, 0, 0]] +minverhex = 0 +for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) -- 2.43.5