From: Stefan Behnel Date: Wed, 17 Oct 2007 17:55:51 +0000 (+0200) Subject: greg: Add --force support to distutils extension X-Git-Tag: 0.9.6.14~29^2~119^2~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6478e87d106cfaeff051e2f8d3eb6d0baeffba9a;p=cython.git greg: Add --force support to distutils extension --- diff --git a/Cython/Distutils/build_ext.py b/Cython/Distutils/build_ext.py index 60585e91..4d36e6e9 100644 --- a/Cython/Distutils/build_ext.py +++ b/Cython/Distutils/build_ext.py @@ -12,7 +12,7 @@ from types import * from distutils.core import Command from distutils.errors import * from distutils.sysconfig import customize_compiler, get_python_version -from distutils.dep_util import newer_group +from distutils.dep_util import newer, newer_group from distutils import log from distutils.dir_util import mkpath try: @@ -171,13 +171,7 @@ class build_ext(_build_ext.build_ext): for source in pyrex_sources: target = pyrex_targets[source] - source_time = os.stat(source).st_mtime - try: - target_time = os.stat(target).st_mtime - newer = source_time > target_time - except EnvironmentError: - newer = 1 - if newer: + if self.force or newer(source, target): log.info("cythoning %s to %s", source, target) self.mkpath(os.path.dirname(target)) options = CompilationOptions(pyrex_default_options,