[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PR/278.patch
From: |
Alexandre Duret-Lutz |
Subject: |
PR/278.patch |
Date: |
24 Dec 2001 15:30:43 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
Index: ChangeLog
--- ChangeLog
+++ ChangeLog
@@ -1,1 +1,9 @@
+2001-12-24 Alexandre Duret-Lutz <address@hidden>
+
+ 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.
+
Index: THANKS
--- THANKS
+++ THANKS
@@ -40,6 +40,7 @@
Doug Evans address@hidden
Eleftherios Gkioulekas address@hidden
Elrond address@hidden
+Enrico Scholz address@hidden
Erez Zadok address@hidden
Eric Magnien address@hidden
Erick Branderhorst address@hidden
Index: m4/python.m4
--- m4/python.m4
+++ m4/python.m4
@@ -145,12 +145,16 @@
# ---------------------------------------------------------------------------
# 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])])
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- PR/278.patch,
Alexandre Duret-Lutz <=