From af6d93b2102fe9ee044f32bfdf74df5e6287f8b7 Mon Sep 17 00:00:00 2001 From: Dag Sverre Seljebotn Date: Fri, 30 Jan 2009 23:09:15 +0100 Subject: [PATCH] Build refnanny.pyx automatically in runtests.py --- Cython/Runtime/build.sh | 10 ---------- runtests.py | 24 +++++++++++++++--------- 2 files changed, 15 insertions(+), 19 deletions(-) delete mode 100755 Cython/Runtime/build.sh diff --git a/Cython/Runtime/build.sh b/Cython/Runtime/build.sh deleted file mode 100755 index 952199a7..00000000 --- a/Cython/Runtime/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -# Temporary hacky script, should be replaced -# with distutils-based solution. - -#PYTHONINC=/local/include/python2.5 -PYTHONINC=/usr/include/python2.5 - -python ../../cython.py refnanny.pyx -gcc -shared -pthread -fPIC -fwrapv -g -Wall \ - -fno-strict-aliasing -I$PYTHONINC \ - -o refnanny.so -I. refnanny.c diff --git a/runtests.py b/runtests.py index b42658d6..0dc20d5f 100644 --- a/runtests.py +++ b/runtests.py @@ -531,14 +531,6 @@ if __name__ == '__main__': from Cython.Compiler import Errors Errors.LEVEL = 0 # show all warnings - if options.with_refnanny: - import ctypes - ctypes.PyDLL("Cython/Runtime/refnanny.so", mode=ctypes.RTLD_GLOBAL) - sys.path.append("Cython/Runtime") - import refnanny - del sys.path[-1] - CFLAGS.append("-DCYTHON_REFNANNY") - # RUN ALL TESTS! ROOTDIR = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'tests') WORKDIR = os.path.join(os.getcwd(), 'BUILD') @@ -546,7 +538,9 @@ if __name__ == '__main__': UNITTEST_ROOT = os.path.join(os.getcwd(), UNITTEST_MODULE) if WITH_CYTHON: if os.path.exists(WORKDIR): - shutil.rmtree(WORKDIR, ignore_errors=True) + for path in os.listdir(WORKDIR): + if path in ("support",): continue + shutil.rmtree(os.path.join(WORKDIR, path), ignore_errors=True) if not os.path.exists(WORKDIR): os.makedirs(WORKDIR) @@ -558,6 +552,18 @@ if __name__ == '__main__': sys.stderr.write("Python %s\n" % sys.version) sys.stderr.write("\n") + if options.with_refnanny: + from pyximport.pyxbuild import pyx_to_dll + import ctypes + libpath = pyx_to_dll(os.path.join("Cython", "Runtime", "refnanny.pyx"), + build_in_temp=True, + pyxbuild_dir=os.path.join(WORKDIR, "support")) + ctypes.PyDLL(libpath, mode=ctypes.RTLD_GLOBAL) + sys.path.append(os.path.split(libpath)[0]) + import refnanny + del sys.path[-1] + CFLAGS.append("-DCYTHON_REFNANNY") + test_bugs = False if options.tickets: for ticket_number in options.tickets: -- 2.26.2