@@ -81,40 +81,45 @@ otherwise, only the first segment is checked.
8181<cvar name =" PRINT_CMD_LINE_FUNC" >
8282<summary >
8383<para >
84- A &Python; function used to print the command lines as they are executed
85- ( unless command printing is disabled by the
84+ The function to print command lines as they are executed.
85+ Called unless command printing is disabled by the
8686<link linkend =" opt-question" ><option >-q</option >/<option >--question</option ></link >
8787or
8888<link linkend =" opt-silent" ><option >-s</option >/<option >--silent</option ></link >
89- options) .
90- The function must accept four arguments:
89+ options.
90+ The function will be called with four arguments:
9191<varname >s</varname >,
9292<varname >target</varname >,
9393<varname >source</varname > and
9494<varname >env</varname >.
9595<varname >s</varname >
96- is a string showing the command being executed,
96+ is the command line string to be executed,
9797<varname >target</varname >,
98- is the target being built (file node, list, or string name(s)),
98+ is the target(s) being built
9999<varname >source</varname >,
100- is the source(s) used (file node, list, or string name(s)),
100+ is the source(s) used
101101and <varname >env</varname >
102102is the environment being used.
103103</para >
104104
105105<para >
106- The function must do the printing itself.
107- The default implementation,
108- used if this variable is not set or is <constant >None</constant >,
109- is to just print the string, as in:
106+ Any or all of the arguments can be used in composing the message.
107+ <varname >source</varname > and
108+ <varname >target</varname > will be lists of nodes,
109+ and need to be suitably converted for printing (see example).
110+ The default,
111+ used if the variable is not set or set to <constant >None</constant >,
112+ is to print only the string <parameter >s</parameter >,
113+ equivalent to:
110114</para >
111115<example_commands >
112116def print_cmd_line(s, target, source, env):
113117 sys.stdout.write(s + "\n")
114118</example_commands >
115119
116120<para >
117- Here is an example of a more interesting function:
121+ This example uses the source and target
122+ parameters to format a custom message:
118123</para >
119124
120125<example_commands >
@@ -145,7 +150,9 @@ scons: done building targets.
145150</screen >
146151
147152<para >
148- Another example could be a function that logs the actual commands to a file.
153+ Another possible use for a print function is to show
154+ a very brief message on the console while logging
155+ the full command line to a file.
149156</para >
150157</summary >
151158</cvar >
0 commit comments