pygobject r889 - trunk/m4



Author: johan
Date: Mon Jul 28 09:12:06 2008
New Revision: 889
URL: http://svn.gnome.org/viewvc/pygobject?rev=889&view=rev

Log:
Use hexversion so it works with alpha/beta releases

Modified:
   trunk/m4/python.m4

Modified: trunk/m4/python.m4
==============================================================================
--- trunk/m4/python.m4	(original)
+++ trunk/m4/python.m4	Mon Jul 28 09:12:06 2008
@@ -74,8 +74,14 @@
 # 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



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