Merged revisions 77424 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77424 | tarek.ziade | 2010-01-11 23:50:29 +0100 (Mon, 11 Jan 2010) | 1 line

  Fixed #5372: .o files are now always rebuilt because file age test don't work in some case
........
This commit is contained in:
Tarek Ziadé 2010-01-11 22:54:57 +00:00
parent ea7e6bc0f2
commit 06426fcb70
2 changed files with 9 additions and 81 deletions

View File

@ -338,10 +338,7 @@ class CCompiler:
def _setup_compile(self, outdir, macros, incdirs, sources, depends, def _setup_compile(self, outdir, macros, incdirs, sources, depends,
extra): extra):
"""Process arguments and decide which source files to compile. """Process arguments and decide which source files to compile."""
Merges _fix_compile_args() and _prep_compile().
"""
if outdir is None: if outdir is None:
outdir = self.output_dir outdir = self.output_dir
elif type(outdir) is not StringType: elif type(outdir) is not StringType:
@ -371,41 +368,6 @@ class CCompiler:
output_dir=outdir) output_dir=outdir)
assert len(objects) == len(sources) assert len(objects) == len(sources)
# XXX should redo this code to eliminate skip_source entirely.
# XXX instead create build and issue skip messages inline
if self.force:
skip_source = {} # rebuild everything
for source in sources:
skip_source[source] = 0
elif depends is None:
# If depends is None, figure out which source files we
# have to recompile according to a simplistic check. We
# just compare the source and object file, no deep
# dependency checking involving header files.
skip_source = {} # rebuild everything
for source in sources: # no wait, rebuild nothing
skip_source[source] = 1
n_sources, n_objects = newer_pairwise(sources, objects)
for source in n_sources: # no really, only rebuild what's
skip_source[source] = 0 # out-of-date
else:
# If depends is a list of files, then do a different
# simplistic check. Assume that each object depends on
# its source and all files in the depends list.
skip_source = {}
# L contains all the depends plus a spot at the end for a
# particular source file
L = depends[:] + [None]
for i in range(len(objects)):
source = sources[i]
L[-1] = source
if newer_group(L, objects[i]):
skip_source[source] = 0
else:
skip_source[source] = 1
pp_opts = gen_preprocess_options(macros, incdirs) pp_opts = gen_preprocess_options(macros, incdirs)
build = {} build = {}
@ -414,10 +376,7 @@ class CCompiler:
obj = objects[i] obj = objects[i]
ext = os.path.splitext(src)[1] ext = os.path.splitext(src)[1]
self.mkpath(os.path.dirname(obj)) self.mkpath(os.path.dirname(obj))
if skip_source[src]: build[obj] = (src, ext)
log.debug("skipping %s (%s up-to-date)", src, obj)
else:
build[obj] = src, ext
return macros, objects, extra, pp_opts, build return macros, objects, extra, pp_opts, build
@ -464,7 +423,6 @@ class CCompiler:
# _fix_compile_args () # _fix_compile_args ()
def _prep_compile(self, sources, output_dir, depends=None): def _prep_compile(self, sources, output_dir, depends=None):
"""Decide which souce files must be recompiled. """Decide which souce files must be recompiled.
@ -477,42 +435,9 @@ class CCompiler:
objects = self.object_filenames(sources, output_dir=output_dir) objects = self.object_filenames(sources, output_dir=output_dir)
assert len(objects) == len(sources) assert len(objects) == len(sources)
if self.force: # Return an empty dict for the "which source files can be skipped"
skip_source = {} # rebuild everything # return value to preserve API compatibility.
for source in sources: return objects, {}
skip_source[source] = 0
elif depends is None:
# If depends is None, figure out which source files we
# have to recompile according to a simplistic check. We
# just compare the source and object file, no deep
# dependency checking involving header files.
skip_source = {} # rebuild everything
for source in sources: # no wait, rebuild nothing
skip_source[source] = 1
n_sources, n_objects = newer_pairwise(sources, objects)
for source in n_sources: # no really, only rebuild what's
skip_source[source] = 0 # out-of-date
else:
# If depends is a list of files, then do a different
# simplistic check. Assume that each object depends on
# its source and all files in the depends list.
skip_source = {}
# L contains all the depends plus a spot at the end for a
# particular source file
L = depends[:] + [None]
for i in range(len(objects)):
source = sources[i]
L[-1] = source
if newer_group(L, objects[i]):
skip_source[source] = 0
else:
skip_source[source] = 1
return objects, skip_source
# _prep_compile ()
def _fix_object_args (self, objects, output_dir): def _fix_object_args (self, objects, output_dir):
"""Typecheck and fix up some arguments supplied to various methods. """Typecheck and fix up some arguments supplied to various methods.
@ -680,7 +605,6 @@ class CCompiler:
Raises CompileError on failure. Raises CompileError on failure.
""" """
# A concrete compiler class can either override this method # A concrete compiler class can either override this method
# entirely or implement _compile(). # entirely or implement _compile().

View File

@ -48,6 +48,10 @@ Core and Builtins
Library Library
------- -------
- Issue #5372: Drop the reuse of .o files in Distutils' ccompiler (since
Extension extra options may change the output without changing the .c
file). Initial patch by Collin Winter.
- Issue #7617: Make sure distutils.unixccompiler.UnixCCompiler recognizes - Issue #7617: Make sure distutils.unixccompiler.UnixCCompiler recognizes
gcc when it has a fully qualified configuration prefix. Initial patch gcc when it has a fully qualified configuration prefix. Initial patch
by Arfrever. by Arfrever.