]> granicus.if.org Git - yasm/commitdiff
Be much smarter at checking for and running Pyrex. Pyrex is a Python module
authorPeter Johnson <peter@tortall.net>
Tue, 4 Apr 2006 07:51:42 +0000 (07:51 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 4 Apr 2006 07:51:42 +0000 (07:51 -0000)
and the "pyrexc" command is just a wrapper, so instead of looking for
"pyrexc" look for the module instead.

* pyrex.m4: New macro to check Pyrex version.
* m4/Makefile.inc: Add to dist.
* configure.ac: Use macro to check for Pyrex >= 0.9.3.
* python-yasm/Makefile.inc: Run Python directly instead of pyrexc wrapper.

svn path=/trunk/yasm/; revision=1457

configure.ac
m4/Makefile.inc
m4/pyrex.m4 [new file with mode: 0644]
tools/python-yasm/Makefile.inc

index 95d47b9a8c99505e416b49f0018669e9b295ae87..f60118108c200f494bfc48acf609d1dfb5e0e838 100644 (file)
@@ -264,13 +264,11 @@ else
     if test -z "$PYTHON" ; then
         AC_MSG_WARN([Python not found])
     else
-        AC_CHECK_PROGS(PYREX, pyrexc)
-
-        if test -z "$PYREX" ; then
-            have_pyrex=no
-        else
-            have_pyrex=yes
-        fi
+        AC_MSG_CHECKING([for Pyrex >= 0.9.3])
+        PYREX_CHECK_VERSION(0.9.3, [AC_MSG_RESULT(yes)
+                                    have_pyrex=yes],
+                                   [AC_MSG_RESULT(no)
+                                    have_pyrex=no])
 
         AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
 
index 3df185a9708d4e09d4e0666b757567d2be8cc200..4dac7a1c010414587e63470d47fafc80b9156c3f 100644 (file)
@@ -27,3 +27,4 @@ EXTRA_DIST += m4/progtest.m4
 EXTRA_DIST += m4/stdint_h.m4
 EXTRA_DIST += m4/uintmax_t.m4
 EXTRA_DIST += m4/pythonhead.m4
+EXTRA_DIST += m4/pyrex.m4
diff --git a/m4/pyrex.m4 b/m4/pyrex.m4
new file mode 100644 (file)
index 0000000..b6e5bd6
--- /dev/null
@@ -0,0 +1,14 @@
+AC_DEFUN([PYREX_CHECK_VERSION],
+ [prog="import sys
+from Pyrex.Compiler.Version import version
+# split strings by '.' and convert to numeric.  Append some zeros
+# because we need at least 4 digits for the hex conversion.
+pyrexver = map(int, version.split('.')) + [[0, 0, 0]]
+pyrexverhex = 0
+for i in xrange(0, 4): pyrexverhex = (pyrexverhex << 8) + pyrexver[[i]]
+minver = map(int, '$1'.split('.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(pyrexverhex < minverhex)"
+  AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])])
+
index 3f0f8f431825c3ea151cfe40d001069dd771aa56..128a68e08e0dbb284208d102e17e720517bfc407 100644 (file)
@@ -14,7 +14,8 @@ EXTRA_DIST += tools/python-yasm/yasm.pyx
 EXTRA_DIST += $(PYBINDING_DEPS)
 
 yasm_python.c: $(srcdir)/tools/python-yasm/yasm.pyx $(PYBINDING_DEPS)
-       $(PYREX) -o $@ `test -f tools/python-yasm/yasm.pyx || echo '$(srcdir)/'`tools/python-yasm/yasm.pyx
+       $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+               -o $@ `test -f tools/python-yasm/yasm.pyx || echo '$(srcdir)/'`tools/python-yasm/yasm.pyx
 
 CLEANFILES += yasm_python.c