From fcb228f18cd5c1286e79ff3d0e7b6a299df76fc6 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 1 Jan 2010 20:55:07 +0000 Subject: [PATCH] Use Cython instead of Pyrex. svn path=/trunk/yasm/; revision=2256 --- configure.ac | 16 ++++++++-------- m4/cython.m4 | 17 +++++++++++++++++ m4/pyrex.m4 | 17 ----------------- tools/python-yasm/Makefile.inc | 4 ++-- tools/python-yasm/setup.py | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 m4/cython.m4 delete mode 100644 m4/pyrex.m4 diff --git a/configure.ac b/configure.ac index 40d99510..7883dc47 100644 --- a/configure.ac +++ b/configure.ac @@ -280,31 +280,31 @@ else fi # Detect if we can build Python bindings -# (needs Python, Python headers, and Pyrex) +# (needs Python, Python headers, and Cython) if test x$enable_python_bindings = xno; then have_python_bindings=no else AC_MSG_NOTICE([Checking to see if we can build Python bindings]) have_python_bindings=no if test x$have_python = xyes; then - AC_MSG_CHECKING([for Pyrex >= 0.9.5.1]) - PYREX_CHECK_VERSION(0.9.5.1, [AC_MSG_RESULT(yes) - have_pyrex=yes], + AC_MSG_CHECKING([for Cython >= 0.11.3]) + CYTHON_CHECK_VERSION(0.11.3, [AC_MSG_RESULT(yes) + have_cython=yes], [AC_MSG_RESULT(no) - have_pyrex=no]) + have_cython=no]) AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no) - if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then + if test x$have_cython = xyes -a x$have_python_headers = xyes ; then have_python_bindings=yes fi fi if test x$have_python_bindings = xno ; then if test x$enable_python_bindings = xyes ; then - AC_MSG_ERROR([Building Python bindings explicitly requested, but can't build Python bindings because either Pyrex, Python headers or a suitable Python version was not found]) + AC_MSG_ERROR([Building Python bindings explicitly requested, but can't build Python bindings because either Cython, Python headers or a suitable Python version was not found]) else - AC_MSG_WARN([Couldn't find either Pyrex, the Python headers or a suitable version of Python, not building Python bindings]) + AC_MSG_WARN([Couldn't find either Cython, the Python headers or a suitable version of Python, not building Python bindings]) fi fi fi diff --git a/m4/cython.m4 b/m4/cython.m4 new file mode 100644 index 00000000..352df3d6 --- /dev/null +++ b/m4/cython.m4 @@ -0,0 +1,17 @@ +dnl a macro to check for the installed Cython version; note PYTHON needs to +dnl be set before this function is called. +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 +# 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]] +verhex = 0 +for i in xrange(0, 4): verhex = (verhex << 8) + ver[[i]] +minver = map(int, '$1'.split('.')) + [[0, 0, 0]] +minverhex = 0 +for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(verhex < minverhex)" + AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])]) + diff --git a/m4/pyrex.m4 b/m4/pyrex.m4 deleted file mode 100644 index 379c5e3d..00000000 --- a/m4/pyrex.m4 +++ /dev/null @@ -1,17 +0,0 @@ -dnl a macro to check for the installed Pyrex version; note PYTHON needs to -dnl be set before this function is called. -dnl PYREX_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -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.rstrip('abcdefghijklmnopqrstuvwxyz').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])]) - diff --git a/tools/python-yasm/Makefile.inc b/tools/python-yasm/Makefile.inc index ed816cfa..e4559964 100644 --- a/tools/python-yasm/Makefile.inc +++ b/tools/python-yasm/Makefile.inc @@ -40,9 +40,9 @@ yasm.pyx: $(srcdir)/tools/python-yasm/yasm.pyx CLEANFILES += yasm.pyx -# Actually run Pyrex +# Actually run Cython yasm_python.c: yasm.pyx _yasm.pxi $(PYBINDING_DEPS) - $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \ + $(PYTHON) -c "from Cython.Compiler.Main import main; main(command_line=1)" \ -o $@ yasm.pyx CLEANFILES += yasm_python.c diff --git a/tools/python-yasm/setup.py b/tools/python-yasm/setup.py index 0633fd3e..d4ce2f44 100644 --- a/tools/python-yasm/setup.py +++ b/tools/python-yasm/setup.py @@ -26,7 +26,7 @@ from distutils.core import setup from distutils.extension import Extension -from Pyrex.Distutils import build_ext +from Cython.Distutils import build_ext from os.path import basename, join, exists def ReadSetup(filename): -- 2.40.0