Better --debug=explain info when build actions change. (Kevin Quick)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 6 Oct 2004 04:04:12 +0000 (04:04 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 6 Oct 2004 04:04:12 +0000 (04:04 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1114 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/__init__.py
test/explain.py

index cf8a4e9d4f1a919b4b41446c52ca18e6b2469612..0167581dd3b5cabaa308623e69716b1a4d1f1283 100644 (file)
@@ -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
index 6e7379ce3f903c982b54a52fc813e6644a68e647..a4e126679303878858fbbe7ec8a7cf14e3023d9c 100644 (file)
@@ -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
index be966c0cec8faafb8177f25e72962222a7c510a9..eed95c4bbf26a976600710dd0b975fdb6a9ec001 100644 (file)
@@ -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"])
 """))