aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2011-06-25 15:09:03 -0700
committerPeter Johnson <peter@tortall.net>2011-06-25 15:09:03 -0700
commitac59d2353b540ed48bb7f503bd1396f59fe257e4 (patch)
tree5ac63ae4c9b5a1f238458d1419afc16b6c4dc916
parent2f6162a0ae7691246677cd63e1e06dfe7264ce2b (diff)
downloadyasm-ac59d2353b540ed48bb7f503bd1396f59fe257e4.tar.gz
Fix cython.m4 for beta versions of Cython.
[#204 state:resolved]
-rw-r--r--m4/cython.m413
1 files changed, 9 insertions, 4 deletions
diff --git a/m4/cython.m4 b/m4/cython.m4
index 352df3d6..ba6b3cab 100644
--- a/m4/cython.m4
+++ b/m4/cython.m4
@@ -4,14 +4,19 @@ dnl CYTHON_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
AC_DEFUN([CYTHON_CHECK_VERSION],
[prog="import sys
from Cython.Compiler.Version import version
+def get_int(arg):
+ try:
+ return int(arg)
+ except ValueError:
+ return 0
# split strings by '.' and convert to numeric. Append some zeros
# because we need at least 4 digits for the hex conversion.
-ver = map(int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]]
+ver = map(get_int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]]
verhex = 0
-for i in xrange(0, 4): verhex = (verhex << 8) + ver[[i]]
-minver = map(int, '$1'.split('.')) + [[0, 0, 0]]
+for i in range(0, 4): verhex = (verhex << 8) + ver[[i]]
+minver = map(get_int, '$1'.split('.')) + [[0, 0, 0]]
minverhex = 0
-for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+for i in range(0, 4): minverhex = (minverhex << 8) + minver[[i]]
sys.exit(verhex < minverhex)"
AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])])