summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2008-07-28 09:12:06 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-28 09:12:06 +0000
commit2ae24a748569d3f2451a4362e91b0965d1cee97c (patch)
tree3fdc09eaad323a6c4729373a3ad62ce3864d2545
parent0d3124f83bd18e420c3beb1b354c41b07c478882 (diff)
downloadpygobject-2ae24a748569d3f2451a4362e91b0965d1cee97c.tar.gz
pygobject-2ae24a748569d3f2451a4362e91b0965d1cee97c.tar.xz
pygobject-2ae24a748569d3f2451a4362e91b0965d1cee97c.zip
Use hexversion so it works with alpha/beta releases
svn path=/trunk/; revision=889
-rw-r--r--m4/python.m410
1 files changed, 8 insertions, 2 deletions
diff --git a/m4/python.m4 b/m4/python.m4
index e4d804d..bdc8ee6 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -74,8 +74,14 @@ CPPFLAGS="$save_CPPFLAGS"
# and with python 3.0 support.
AC_DEFUN([JD_PYTHON_CHECK_VERSION],
[prog="import sys
-minver = tuple(map(int, '$2'.split('.')))
-sys.exit(sys.version_info[[:3]] < minver)"
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
+minverhex = 0
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(sys.hexversion < minverhex)"
AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005