Commit b43f6828 authored by Alexey Borzenkov's avatar Alexey Borzenkov

Fix .pyxdep files in pyximport and tests

parent e3c9a786
...@@ -112,6 +112,7 @@ def handle_special_build(modname, pyxfilename): ...@@ -112,6 +112,7 @@ def handle_special_build(modname, pyxfilename):
return ext, setup_args return ext, setup_args
def handle_dependencies(pyxfilename): def handle_dependencies(pyxfilename):
testing = '_test_files' in globals()
dependfile = os.path.splitext(pyxfilename)[0] + PYXDEP_EXT dependfile = os.path.splitext(pyxfilename)[0] + PYXDEP_EXT
# by default let distutils decide whether to rebuild on its own # by default let distutils decide whether to rebuild on its own
...@@ -132,7 +133,8 @@ def handle_dependencies(pyxfilename): ...@@ -132,7 +133,8 @@ def handle_dependencies(pyxfilename):
files.extend(glob.glob(fullpath)) files.extend(glob.glob(fullpath))
# only for unit testing to see we did the right thing # 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 # if any file that the pyxfile depends upon is newer than
# the pyx file, 'touch' the pyx file so that distutils will # the pyx file, 'touch' the pyx file so that distutils will
...@@ -143,7 +145,8 @@ def handle_dependencies(pyxfilename): ...@@ -143,7 +145,8 @@ def handle_dependencies(pyxfilename):
print("Rebuilding because of ", file) print("Rebuilding because of ", file)
filetime = os.path.getmtime(file) filetime = os.path.getmtime(file)
os.utime(pyxfilename, (filetime, filetime)) os.utime(pyxfilename, (filetime, filetime))
_test_files.append(file) if testing:
_test_files.append(file)
def build_module(name, pyxfilename, pyxbuild_dir=None): def build_module(name, pyxfilename, pyxbuild_dir=None):
assert os.path.exists(pyxfilename), ( assert os.path.exists(pyxfilename), (
......
import pyximport; pyximport.install() import pyximport; pyximport.install(reload_support=True)
import os, sys import os, sys
import time, shutil import time, shutil
import tempfile import tempfile
...@@ -21,6 +21,7 @@ def on_remove_file_error(func, path, excinfo): ...@@ -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." print "You may want to delete this yourself when you get a chance."
def test(): def test():
pyximport._test_files = []
tempdir = make_tempdir() tempdir = make_tempdir()
sys.path.append(tempdir) sys.path.append(tempdir)
filename = os.path.join(tempdir, "dummy.pyx") filename = os.path.join(tempdir, "dummy.pyx")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment