Skip to content

Commit b3d8b33

Browse files
authored
Merge pull request #4876 from mwichmann/print-cmd-line
Tweak wording for $PRINT_CMD_LINE_FUNC
2 parents e24a1c3 + 65028bc commit b3d8b33

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
146146
* Add info on the type of an option variable to GetOption and SetOption.
147147
* Tighten up the doc for Variables-Add() and add a note on file contents
148148
not being preserved to Variables-Save()
149+
* Tweak the wording for $PRINT_CMD_LINE_FUNC.
149150

150151

151152
RELEASE 4.10.1 - Sun, 16 Nov 2025 10:51:57 -0700

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ DOCUMENTATION
167167
- Tighten up the doc for Variables-Add() and add a note on file contents
168168
not being preserved to Variables-Save()
169169

170+
* Tweak the wording for $PRINT_CMD_LINE_FUNC.
171+
170172
DEVELOPMENT
171173
-----------
172174

SCons/Action.xml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
8787
or
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
101101
and <varname>env</varname>
102102
is 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>
112116
def 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

Comments
 (0)