Gary Oberbrunner avatar Gary Oberbrunner committed 6664318

New debug option --debug=prepare to watch targets being prepared

Comments (0)

Files changed (8)

 Python debugger.
 
 .TP
+--debug=prepare
+Print a line each time any target (internal or external)
+is prepared for building.
+.B scons
+prints this for each target it considers, even if that
+target is up to date (see also --debug=explain).
+This can help debug problems with targets that aren't being
+built; it shows whether
+.B scons
+is at least considering them or not.
+
+.TP
 --debug=presub
 Print the raw command line used to build each target
 before the construction environment variables are substituted.

doc/user/troubleshoot.in

 
   </section>
 
+  <section>
+
+  <title>Watch &SCons; prepare targets for building: the &debug-prepare; Option</title>
+
+    <para>
+
+    Sometimes SCons doesn't build the target you want
+    and it's difficult to figure out why.  You can use
+    the <literal>--debug=prepare</literal> option
+    to see all the targets &SCons; is considering, whether
+    they are already up-to-date or not. The message is
+    printed before &SCons; decides whether to build the target.
+
+  </section>
+
   <!--
 
   <section>

doc/user/troubleshoot.xml

 
   </section>
 
+  <section>
+
+  <title>Watch &SCons; prepare targets for building: the &debug-prepare; Option</title>
+
+    <para>
+
+    Sometimes SCons doesn't build the target you want
+    and it's difficult to figure out why.  You can use
+    the <literal>--debug=prepare</literal> option
+    to see all the targets &SCons; is considering, whether
+    they are already up-to-date or not. The message is
+    printed before &SCons; decides whether to build the target.
+
+  </section>
+
   <!--
 
   <section>
   From Gary Oberbrunner:
     - Adding None to an Action no longer fails (just returns original action)
 
+  From Gary Oberbrunner:
+    - New --debug=prepare option to show each target as it's being
+      prepared, whether or not anything needs to be done for it.
+
   From David Garcia Garzon:
     - Fix Delete to be able to delete broken symlinks and dir
       symlinks.
     - List modifications to existing features, where the previous behavior
       wouldn't actually be considered a bug
 
-    - Add initial support for VS/VC 2001
+    - Add initial support for VS/VC 2010
 
   FIXES
 
     - TeX command strings now work on Windows when the new dir is
       on a different drive letter.
     - DMD version 2 is supported (using the phobos2 library)
+    - New --debug=prepare option shows each target as it's prepared
+      for building; can help when you don't know why a target isn't
+      being built.
 
     - List improvements that wouldn't be visible to the user in the
       documentation:  performance improvements (describe the circumstances

src/engine/SCons/Script/Main.py

         print_time = 1
     if "tree" in debug_values:
         options.tree_printers.append(TreePrinter())
+    if "prepare" in debug_values:
+        SCons.Taskmaster.print_prepare = 1
 
 def _create_path(plist):
     path = '.'

src/engine/SCons/Script/SConsOptions.py

 
     debug_options = ["count", "explain", "findlibs",
                      "includes", "memoizer", "memory", "objects",
-                     "pdb", "presub", "stacktrace",
+                     "pdb", "prepare", "presub", "stacktrace",
                      "time"] + list(deprecated_debug_options.keys())
 
     def opt_debug(option, opt, value, parser,

src/engine/SCons/Taskmaster.py

 NODE_EXECUTED = SCons.Node.executed
 NODE_FAILED = SCons.Node.failed
 
+print_prepare = 0               # set by option --debug=prepare
 
 # A subsystem for recording stats about how different Nodes are handled by
 # the main Taskmaster loop.  There's no external control here (no need for
         unlink underlying files and make all necessary directories before
         the Action is actually called to build the targets.
         """
+        global print_prepare
         T = self.tm.trace
         if T: T.write(self.trace_message(u'Task.prepare()', self.node))
 
         executor = self.targets[0].get_executor()
         executor.prepare()
         for t in executor.get_action_targets():
+            if print_prepare:
+                print "Preparing target %s..."%t
+                for s in t.side_effects:
+                    print "...with side-effect %s..."%s
             t.prepare()
             for s in t.side_effects:
+                if print_prepare:
+                    print "...Preparing side-effect %s..."%s
                 s.prepare()
 
     def get_target(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.