From: Alexey Borzenkov Date: Wed, 22 Dec 2010 07:40:06 +0000 (+0300) Subject: Fix .pyxdep files in pyximport and tests X-Git-Tag: 0.14.1rc0~13^2~1^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b43f68280919e98767bd4d163cb1eaf88c4c857e;p=cython.git Fix .pyxdep files in pyximport and tests --- diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py index 8a2795b2..ac509a46 100644 --- a/pyximport/pyximport.py +++ b/pyximport/pyximport.py @@ -112,6 +112,7 @@ def handle_special_build(modname, pyxfilename): return ext, setup_args def handle_dependencies(pyxfilename): + testing = '_test_files' in globals() dependfile = os.path.splitext(pyxfilename)[0] + PYXDEP_EXT # by default let distutils decide whether to rebuild on its own @@ -132,7 +133,8 @@ def handle_dependencies(pyxfilename): files.extend(glob.glob(fullpath)) # only for unit testing to see we did the right thing - _test_files[:] = [] #$pycheck_no + if testing: + _test_files[:] = [] #$pycheck_no # if any file that the pyxfile depends upon is newer than # the pyx file, 'touch' the pyx file so that distutils will @@ -143,7 +145,8 @@ def handle_dependencies(pyxfilename): print("Rebuilding because of ", file) filetime = os.path.getmtime(file) os.utime(pyxfilename, (filetime, filetime)) - _test_files.append(file) + if testing: + _test_files.append(file) def build_module(name, pyxfilename, pyxbuild_dir=None): assert os.path.exists(pyxfilename), ( diff --git a/pyximport/test/test_pyximport.py b/pyximport/test/test_pyximport.py index bcf2ce61..e45d5ff7 100644 --- a/pyximport/test/test_pyximport.py +++ b/pyximport/test/test_pyximport.py @@ -1,4 +1,4 @@ -import pyximport; pyximport.install() +import pyximport; pyximport.install(reload_support=True) import os, sys import time, shutil import tempfile @@ -21,6 +21,7 @@ def on_remove_file_error(func, path, excinfo): print "You may want to delete this yourself when you get a chance." def test(): + pyximport._test_files = [] tempdir = make_tempdir() sys.path.append(tempdir) filename = os.path.join(tempdir, "dummy.pyx")