From 4a0762006a187a6b75a186de30cdb3eb73b4f356 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 6 Oct 2004 04:04:12 +0000 Subject: [PATCH] Better --debug=explain info when build actions change. (Kevin Quick) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1114 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 2 ++ src/engine/SCons/Node/__init__.py | 11 ++++++++--- test/explain.py | 7 ++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index cf8a4e9d..0167581d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -186,6 +186,8 @@ RELEASE 0.97 - XXX - Add a deprecated warning for use of the old "scanner" keyword argument to Builder creation. + - Improve the --debug=explain message when the build action changes. + From Christoph Wiedemann: - Add an Environment.SetDefault() method that only sets values if diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 6e7379ce..a4e12667 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -899,13 +899,18 @@ class Node: if len(lines) == 0: newact, newactsig = self.binfo.bact, self.binfo.bactsig + def fmt_with_title(title, strlines): + lines = string.split(strlines, '\n') + sep = '\n' + ' '*(15 + len(title)) + return ' '*15 + title + string.join(lines, sep) + '\n' if old.bactsig != newactsig: if old.bact == newact: - lines.append("the contents of the build action changed\n") + lines.append("the contents of the build action changed\n" + + fmt_with_title('action: ', newact)) else: lines.append("the build action changed:\n" + - "%sold: %s\n" % (' '*15, old.bact) + - "%snew: %s\n" % (' '*15, newact)) + fmt_with_title('old: ', old.bact) + + fmt_with_title('new: ', newact)) if len(lines) == 0: return "rebuilding `%s' for unknown reasons" % self diff --git a/test/explain.py b/test/explain.py index be966c0c..eed95c4b 100644 --- a/test/explain.py +++ b/test/explain.py @@ -455,7 +455,9 @@ if mode: tgt = str(target[0]) src = str(source[0]) shutil.copy(src, tgt) - MyCopy = Builder(action = DifferentCopy) + def AltCopyStage2(target, source, env): + pass + MyCopy = Builder(action = [DifferentCopy, AltCopyStage2]) def ChangingCopy(target, source, env): tgt = str(target[0]) @@ -491,8 +493,11 @@ test.run(chdir = 'work5', scons: rebuilding `f1.out' because the build action changed: old: Copy("f1.out", "f1.in") new: DifferentCopy(["f1.out"], ["f1.in"]) + AltCopyStage2(["f1.out"], ["f1.in"]) DifferentCopy(["f1.out"], ["f1.in"]) +AltCopyStage2(["f1.out"], ["f1.in"]) scons: rebuilding `f2.out' because the contents of the build action changed + action: ChangingCopy(["f2.out"], ["f2.in"]) ChangingCopy(["f2.out"], ["f2.in"]) """)) -- 2.26.2