From: stevenknight Date: Fri, 5 Apr 2002 02:24:25 +0000 (+0000) Subject: Add --debug=dtree option (Anthony Roach) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=92707647a604303fb21f744953dff41a1cbc2a0a;p=scons.git Add --debug=dtree option (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@319 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 77dedc5c..3ce7f45b 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -320,7 +320,14 @@ to the SCons invocation run by the debugger. .TP .RI --debug=tree Print the dependency tree -after each top-level target is built. +after each top-level target is built. This prints out the complete +dependency tree including implicit dependencies and ignored +dependencies. + +.TP +.RI --debug=dtree +Print the dependency tree +after each top-level target is built. This prints out only derived files. .TP -e, --environment-overrides diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index bd4f2ae8..143fa19e 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -88,7 +88,10 @@ class BuildTask(SCons.Taskmaster.Task): # this method is serialized, but execute isn't: if print_tree and self.top: print - print SCons.Util.render_tree(self.targets[0], get_children) + print SCons.Util.render_tree(self.targets[0], get_all_children) + if print_dtree and self.top: + print + print SCons.Util.render_tree(self.targets[0], get_derived_children) def failed(self): global exit_status @@ -149,13 +152,18 @@ ignore_errors = 0 keep_going_on_error = 0 help_option = None print_tree = 0 +print_dtree = 0 climb_up = 0 target_top = None exit_status = 0 # exit status, assume success by default # utility functions -def get_children(node): return node.all_children(None) +def get_all_children(node): return node.all_children(None) + +def get_derived_children(node): + children = node.all_children(None) + return filter(lambda x: x.builder, children) def _scons_syntax_error(e): """Handle syntax errors. Print out a message and show where the error @@ -391,6 +399,7 @@ def options_init(): def opt_debug(opt, arg): global print_tree + global print_dtree if arg == "pdb": args = [ sys.executable, "pdb.py" ] + \ filter(lambda x: x != "--debug=pdb", sys.argv) @@ -405,6 +414,8 @@ def options_init(): os.execvpe(args[0], args, os.environ) elif arg == "tree": print_tree = 1 + elif arg == "dtree": + print_dtree = 1 else: sys.stderr.write("Warning: %s is not a valid debug type\n" % arg) diff --git a/test/option--debug.py b/test/option--debug.py index 42274c45..ff791f0f 100644 --- a/test/option--debug.py +++ b/test/option--debug.py @@ -90,6 +90,16 @@ test.fail_test(string.find(test.stdout(), tree) == -1) test.run(arguments = "--debug=tree " + foo) test.fail_test(string.find(test.stdout(), tree) == -1) + +tree = """ ++-%s + +-foo%s + +-bar%s +""" % (foo, obj,obj) + +test.run(arguments = "--debug=dtree " + foo) +test.fail_test(string.find(test.stdout(), tree) == -1) + tree = """scons: \".\" is up to date. +-.