Commits

Gary Oberbrunner  committed 6664318

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

  • Participants
  • Parent commits 8a771d3

Comments (0)

Files changed (8)

File doc/man/scons.1

 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.

File 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>

File 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>

File src/CHANGES.txt

   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.

File src/RELEASE.txt

     - 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

File 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 = '.'

File 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,

File 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):