Re: [Scons-dev] Patch for potential new debug option
William, from my experience using varname as a filter to limit the output will not help much in big trees where my cloned env are assigned to vars with the same name. I would find very useful having the env dump limited to the target node specified on the command line: is this already supported by your proposal? Roberto --- Messaggio Originale --- Da: William Blevins wblevins...@gmail.com Data: 08 Agosto 2015 07:22:12 Oggetto:[Scons-dev] Patch for potential new debug option A: SCons developer list scons-dev@scons.org Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +options.debug_envdump = ( envdump in debug_values ) if print_objects: SCons.Debug.track_instances = True if presub in debug_values: @@ -1210,8 +1226,13 @@ failure_message = done building targets (errors occurred during build). else: failure_message = building terminated because of errors. + +if options.debug_envdump: +task_class = EnvDumpTask + if options.question: task_class = QuestionTask + try: if options.clean: task_class = CleanTask diff -r 682b8a7a51fb src/engine/SCons/Script/SConsOptions.py --- a/src/engine/SCons/Script/SConsOptions.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/SConsOptions.pyThu Aug 06 23:44:50 2015 -0400 @@ -673,7 +673,7 @@ tree : '; please use --tree=all instead', } -debug_options = [count, duplicate, explain, findlibs, +debug_options = [count, duplicate, explain, envdump, findlibs, includes, memoizer, memory, objects, pdb, prepare, presub, stacktrace, time] V/R, William ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev
Re: [Scons-dev] Patch for potential new debug option
Hi, would have this been available, I indeed would already have used scons --envdump=CXXFLAGS,CFLAGS,ENV.PATH A.o -- Alexandre Feblot Le 8 août 2015 à 15:04, William Blevins wblevins...@gmail.com a écrit : I guess I should be a bit more explicit about what I am trying to do. Example: A.cpp SConstruct - Program( 'exe', Glob( '*.cpp' ) ) My goal original goal was to be able to print environment objects from the command-line without having to modify code: 1. As written: [Example: scons --debug=envdump A.o would print the build environment object assigned to A.o ]. 2. Afterthought on usability: [Example: scons --envdump=LIBS A.o would print the variable LIBS from the build environment assigned to A.o]. 2.1 Since environment objects are rather large, maybe printing just a single value from the environment object would be more readable and/or desired on a regular basis. The supplied patch works for Case 1, but I am having a hard time getting only the targets on the command-line. Currently, the patch prints the environment for all targets on the command-line, plus all their dependencies (as long as they have build environments) and I am hoping to not print their dependencies. [Example: scons --debug=envdump A.o would print the environment for target A.o but not A.cpp or /usr/bin/g++ because they don't have a build environment.] [Example: scons --debug=envdump exe would print the environment for target exe plus A.o because it's in the target list (as a dependency of exe)] If I can figure out a clean way to get only the targets on the command-line, then that makes the most sense. The real question is do we want Case 1, Case 2,or both capabilities? V/R, William On Sat, Aug 8, 2015 at 3:42 AM, Roberto De Vecchi roberto.devec...@vi-grade.com mailto:roberto.devec...@vi-grade.com wrote: William, from my experience using varname as a filter to limit the output will not help much in big trees where my cloned env are assigned to vars with the same name. I would find very useful having the env dump limited to the target node specified on the command line: is this already supported by your proposal? Roberto --- Messaggio Originale --- Da: William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com Data: 08 Agosto 2015 07:22:12 Oggetto: [Scons-dev] Patch for potential new debug option A:SCons developer list scons-dev@scons.org mailto:scons-dev@scons.org Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +options.debug_envdump = ( envdump in debug_values ) if print_objects: SCons.Debug.track_instances = True if presub in debug_values: @@ -1210,8 +1226,13 @@ failure_message = done building targets (errors occurred during build). else: failure_message = building terminated because of errors. + +if options.debug_envdump: +task_class = EnvDumpTask + if options.question: task_class = QuestionTask + try: if options.clean: task_class = CleanTask diff -r 682b8a7a51fb src/engine/SCons/Script/SConsOptions.py --- a/src/engine/SCons/Script/SConsOptions.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/SConsOptions.pyThu Aug 06 23:44:50 2015 -0400 @@ -673,7 +673,7 @@ tree : '; please use --tree=all instead', } -debug_options = [count, duplicate, explain, findlibs, +debug_options = [count, duplicate, explain, envdump,
Re: [Scons-dev] Patch for potential new debug option
Would a standard shell redirection not be enough? -- Alexandre Feblot Le 8 août 2015 à 17:38, Bill Deegan b...@baddogconsulting.com a écrit : Perhaps an option to direct this output to a file? On Sat, Aug 8, 2015 at 6:31 AM, William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com wrote: On Sat, Aug 8, 2015 at 9:14 AM, Alexandre Feblot alexan...@feblot.fr mailto:alexan...@feblot.fr wrote: Hi, would have this been available, I indeed would already have used scons --envdump=CXXFLAGS,CFLAGS,ENV.PATH A.o When I thought about the feature, I also thought the case 2 was more useful, thank you for your feedback. I can do both if we decided that printing the whole environment object is ever useful, but lean code bases make for maintainable code bases :) -- Alexandre Feblot Le 8 août 2015 à 15:04, William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com a écrit : I guess I should be a bit more explicit about what I am trying to do. Example: A.cpp SConstruct - Program( 'exe', Glob( '*.cpp' ) ) My goal original goal was to be able to print environment objects from the command-line without having to modify code: 1. As written: [Example: scons --debug=envdump A.o would print the build environment object assigned to A.o ]. 2. Afterthought on usability: [Example: scons --envdump=LIBS A.o would print the variable LIBS from the build environment assigned to A.o]. 2.1 Since environment objects are rather large, maybe printing just a single value from the environment object would be more readable and/or desired on a regular basis. The supplied patch works for Case 1, but I am having a hard time getting only the targets on the command-line. Currently, the patch prints the environment for all targets on the command-line, plus all their dependencies (as long as they have build environments) and I am hoping to not print their dependencies. [Example: scons --debug=envdump A.o would print the environment for target A.o but not A.cpp or /usr/bin/g++ because they don't have a build environment.] [Example: scons --debug=envdump exe would print the environment for target exe plus A.o because it's in the target list (as a dependency of exe)] If I can figure out a clean way to get only the targets on the command-line, then that makes the most sense. The real question is do we want Case 1, Case 2,or both capabilities? V/R, William On Sat, Aug 8, 2015 at 3:42 AM, Roberto De Vecchi roberto.devec...@vi-grade.com mailto:roberto.devec...@vi-grade.com wrote: William, from my experience using varname as a filter to limit the output will not help much in big trees where my cloned env are assigned to vars with the same name. I would find very useful having the env dump limited to the target node specified on the command line: is this already supported by your proposal? Roberto --- Messaggio Originale --- Da: William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com Data:08 Agosto 2015 07:22:12 Oggetto: [Scons-dev] Patch for potential new debug option A: SCons developer list scons-dev@scons.org mailto:scons-dev@scons.org Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +options.debug_envdump = ( envdump in debug_values ) if print_objects: SCons.Debug.track_instances = True if presub in debug_values: @@ -1210,8 +1226,13 @@ failure_message = done building targets (errors occurred during build). else:
Re: [Scons-dev] Patch for potential new debug option
Yes, that’s what I meant. I wouldn't feel the need for a specific option when I can just do scons --envdump=xx file.txt -- Alexandre Feblot Le 8 août 2015 à 19:01, William Blevins wblevins...@gmail.com a écrit : On Sat, Aug 8, 2015 at 11:38 AM, Bill Deegan b...@baddogconsulting.com mailto:b...@baddogconsulting.com wrote: Perhaps an option to direct this output to a file? I assume that it can just be piped to a file, but maybe I don't understand your question. On Sat, Aug 8, 2015 at 6:31 AM, William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com wrote: On Sat, Aug 8, 2015 at 9:14 AM, Alexandre Feblot alexan...@feblot.fr mailto:alexan...@feblot.fr wrote: Hi, would have this been available, I indeed would already have used scons --envdump=CXXFLAGS,CFLAGS,ENV.PATH A.o When I thought about the feature, I also thought the case 2 was more useful, thank you for your feedback. I can do both if we decided that printing the whole environment object is ever useful, but lean code bases make for maintainable code bases :) -- Alexandre Feblot Le 8 août 2015 à 15:04, William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com a écrit : I guess I should be a bit more explicit about what I am trying to do. Example: A.cpp SConstruct - Program( 'exe', Glob( '*.cpp' ) ) My goal original goal was to be able to print environment objects from the command-line without having to modify code: 1. As written: [Example: scons --debug=envdump A.o would print the build environment object assigned to A.o ]. 2. Afterthought on usability: [Example: scons --envdump=LIBS A.o would print the variable LIBS from the build environment assigned to A.o]. 2.1 Since environment objects are rather large, maybe printing just a single value from the environment object would be more readable and/or desired on a regular basis. The supplied patch works for Case 1, but I am having a hard time getting only the targets on the command-line. Currently, the patch prints the environment for all targets on the command-line, plus all their dependencies (as long as they have build environments) and I am hoping to not print their dependencies. [Example: scons --debug=envdump A.o would print the environment for target A.o but not A.cpp or /usr/bin/g++ because they don't have a build environment.] [Example: scons --debug=envdump exe would print the environment for target exe plus A.o because it's in the target list (as a dependency of exe)] If I can figure out a clean way to get only the targets on the command-line, then that makes the most sense. The real question is do we want Case 1, Case 2,or both capabilities? V/R, William On Sat, Aug 8, 2015 at 3:42 AM, Roberto De Vecchi roberto.devec...@vi-grade.com mailto:roberto.devec...@vi-grade.com wrote: William, from my experience using varname as a filter to limit the output will not help much in big trees where my cloned env are assigned to vars with the same name. I would find very useful having the env dump limited to the target node specified on the command line: is this already supported by your proposal? Roberto --- Messaggio Originale --- Da: William Blevins wblevins...@gmail.com mailto:wblevins...@gmail.com Data:08 Agosto 2015 07:22:12 Oggetto: [Scons-dev] Patch for potential new debug option A: SCons developer list scons-dev@scons.org mailto:scons-dev@scons.org Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +
Re: [Scons-dev] Patch for potential new debug option
If I run scons --debug=dumpenv, won't it still do a build? So I could get a lot of extra output if I just redirect stdout. Does the output go to stdout or stderr? -Bill On Sat, Aug 8, 2015 at 11:28 AM, William Blevins wblevins...@gmail.com wrote: On Aug 8, 2015 1:47 PM, Jason Kenny dragon...@live.com wrote: My only concern with this feature is that it can dump a lot of data. Given Parts for example I would have lots of environment that would be dumped. such information is generally only useful when you can map a given environment to the correct file ( or part file in my case) or build actions (such as this is the environment for link foo.so or this was the environment for making hello.o). I am mapping a target to its build env and outputting the env data. Just like your example :) Jason From: William Blevins Sent: Saturday, August 8, 2015 12:22 AM To: SCons developer list Subject: [Scons-dev] Patch for potential new debug option Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +options.debug_envdump = ( envdump in debug_values ) if print_objects: SCons.Debug.track_instances = True if presub in debug_values: @@ -1210,8 +1226,13 @@ failure_message = done building targets (errors occurred during build). else: failure_message = building terminated because of errors. + +if options.debug_envdump: +task_class = EnvDumpTask + if options.question: task_class = QuestionTask + try: if options.clean: task_class = CleanTask diff -r 682b8a7a51fb src/engine/SCons/Script/SConsOptions.py --- a/src/engine/SCons/Script/SConsOptions.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/SConsOptions.pyThu Aug 06 23:44:50 2015 -0400 @@ -673,7 +673,7 @@ tree : '; please use --tree=all instead', } -debug_options = [count, duplicate, explain, findlibs, +debug_options = [count, duplicate, explain, envdump, findlibs, includes, memoizer, memory, objects, pdb, prepare, presub, stacktrace, time] V/R, William ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev
Re: [Scons-dev] Patch for potential new debug option
On Sat, Aug 8, 2015 at 5:48 PM, Bill Deegan b...@baddogconsulting.com wrote: If I run scons --debug=dumpenv, won't it still do a build? So I could get a lot of extra output if I just redirect stdout. Does the output go to stdout or stderr? The way the patch is written no. It replaces the BuildTask, but since the build task is unique it sorta depends on the order in which they are specified... so there should probably be a check in that code to make sure only one build task has been selected. -Bill On Sat, Aug 8, 2015 at 11:28 AM, William Blevins wblevins...@gmail.com wrote: On Aug 8, 2015 1:47 PM, Jason Kenny dragon...@live.com wrote: My only concern with this feature is that it can dump a lot of data. Given Parts for example I would have lots of environment that would be dumped. such information is generally only useful when you can map a given environment to the correct file ( or part file in my case) or build actions (such as this is the environment for link foo.so or this was the environment for making hello.o). I am mapping a target to its build env and outputting the env data. Just like your example :) Jason From: William Blevins Sent: Saturday, August 8, 2015 12:22 AM To: SCons developer list Subject: [Scons-dev] Patch for potential new debug option Here is a patch for dumping build environments via the command-line. I couldn't ever figure out a good way to get only explicitly lister targets (non-default commandline targets). It will essentially print the node.get_env().Dump() for all targets with a build_env defined. I could potentially change it from --debug=envdump to something like --envdump=VARIABLE so that it could print a particular variable rather than the whole env. Does this interest anyone or waste of chars? diff -r 682b8a7a51fb src/engine/SCons/Script/Main.py --- a/src/engine/SCons/Script/Main.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/Main.pyThu Aug 06 23:44:50 2015 -0400 @@ -391,6 +391,21 @@ def prepare(self): pass +class EnvDumpTask(SCons.Taskmaster.AlwaysTask): +SCons task for --debug=envdump. Prints env dump for BUILD_TARGETS. +def prepare(self): +pass + +def execute(self): +for target in self.targets: +if target.get_build_env(): +print 'Environment dump for target: ' + str(target) +print target.get_env().Dump() + +def executed(self): +pass + + class QuestionTask(SCons.Taskmaster.AlwaysTask): An SCons task for the -q (question) option. def prepare(self): @@ -657,6 +672,7 @@ if memory in debug_values: memory_stats.enable(sys.stdout) print_objects = (objects in debug_values) +options.debug_envdump = ( envdump in debug_values ) if print_objects: SCons.Debug.track_instances = True if presub in debug_values: @@ -1210,8 +1226,13 @@ failure_message = done building targets (errors occurred during build). else: failure_message = building terminated because of errors. + +if options.debug_envdump: +task_class = EnvDumpTask + if options.question: task_class = QuestionTask + try: if options.clean: task_class = CleanTask diff -r 682b8a7a51fb src/engine/SCons/Script/SConsOptions.py --- a/src/engine/SCons/Script/SConsOptions.pyMon Jun 29 15:37:44 2015 -0400 +++ b/src/engine/SCons/Script/SConsOptions.pyThu Aug 06 23:44:50 2015 -0400 @@ -673,7 +673,7 @@ tree : '; please use --tree=all instead', } -debug_options = [count, duplicate, explain, findlibs, +debug_options = [count, duplicate, explain, envdump, findlibs, includes, memoizer, memory, objects, pdb, prepare, presub, stacktrace, time] V/R, William ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev ___ Scons-dev mailing list Scons-dev@scons.org https://pairlist2.pair.net/mailman/listinfo/scons-dev