From c2990ce34da55741fe27eb13182a4bb79169287f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 14 Mar 2008 10:34:53 +0100 Subject: [PATCH] support adding pxd/pxi dependencies to Extension sources and force rebuild on dependency updates --- Cython/Distutils/build_ext.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Cython/Distutils/build_ext.py b/Cython/Distutils/build_ext.py index 3b828900..89330f68 100644 --- a/Cython/Distutils/build_ext.py +++ b/Cython/Distutils/build_ext.py @@ -155,6 +155,7 @@ class build_ext(_build_ext.build_ext): else: target_dir = None + newest_dependency = None for source in sources: (base, ext) = os.path.splitext(os.path.basename(source)) if ext == ".pyx": # Cython source file @@ -162,6 +163,10 @@ class build_ext(_build_ext.build_ext): new_sources.append(os.path.join(output_dir, base + target_ext)) pyrex_sources.append(source) pyrex_targets[source] = new_sources[-1] + elif ext == '.pxi' or ext == '.pxd': + if newest_dependency is None \ + or newer(source, newest_dependency): + newest_dependency = source else: new_sources.append(source) @@ -172,7 +177,10 @@ class build_ext(_build_ext.build_ext): for source in pyrex_sources: target = pyrex_targets[source] - if self.force or newer(source, target): + rebuild = self.force or newer(source, target) + if not rebuild and newest_dependency is not None: + rebuild = newer(newest_dependency, target) + if rebuild: log.info("cythoning %s to %s", source, target) self.mkpath(os.path.dirname(target)) options = CompilationOptions(pyrex_default_options, -- 2.26.2