Skip to content

Commit a46b809

Browse files
authored
Merge pull request #4856 from mwichmann/doc/implicit-deps
Tweak IMPLICIT_COMMAND_DEPENDENCIES man entry
2 parents 573b427 + e0c835e commit a46b809

10 files changed

Lines changed: 85 additions & 126 deletions

File tree

CHANGES.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,14 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
4747

4848
From Mats Wichmann:
4949
- Introduce some unit tests for the file locking utility routines
50-
- More clarifications in manpage Builder Methods section.
5150
- Reduce unneeded computation of overrides. The Mkdir builder used an
5251
unknown argument ('explain') on creation, causing it to be considered
5352
an override. Also, if override dict is empty, don't even call the
5453
Override factory function.
5554
- Handle the default (unset) ProgressObject differently for the sole
5655
purpose of avoiding Sphinx 9.0+ blowing up on it (it's been giving
5756
a warning for years, but now it's a fatal error).
58-
- Improve covarage of API doc build by ignoring any setting of
57+
- Improve coverage of API doc build by ignoring any setting of
5958
__all__ in a package and not showing inherited members from optparse.
6059
- Fix --debug=includes for case of multiple source files.
6160
- Unify internal "_null" sentinel usage.
@@ -79,21 +78,23 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
7978
- Adjust race protection for CacheDir - now uses a unique temporary
8079
directory for each writer before doing the move, instead of depending
8180
on a one-time uuid to make a path to the file.
82-
- Clarify VariantDir behavior when switching to not duplicate sources
83-
and tweak wording a bit.
8481
- Test suite: add support for Python 3.15 in the Action unit tests.
85-
- Update documentation of the three file-finding functions in the API
86-
(FindFile, FindInstalledFiles, FindSourceFiles) as well as FindPathDirs.
87-
Also add a test for FindFile to be sure it locates non-existing
88-
derived files as advertised.
82+
- Add a test for FindFile to be sure it locates non-existing derived
83+
files as advertised.
8984
- zip tool now uses zipfile module's "from_file" method to populate
9085
ZipInfo records, rather than doing manually.
91-
- Update documentation for linking-related construction variables.
92-
Add a few more live links.
93-
- Update documentation for CacheDir and related option flags
94-
- Drop old example section from manpage. This has been commented out
95-
since release 4.0, when the content was used to populate the new
96-
SCons Cookbook.
86+
- Reference manual improvements:
87+
* More clarifications in Builder Methods section.
88+
* Clarify VariantDir behavior when switching from duplicate=True (the
89+
default) to duplicate=False, and tweak wording a bit.
90+
* Update documentation of the three file-finding functions (FindFile,
91+
FindInstalledFiles, FindSourceFiles) as well as FindPathDirs.
92+
* Update linking-related construction variables.
93+
* Add a few more live links.
94+
* Clarify CacheDir and related option flags.
95+
* Drop old example section from manpage (not a visible change: has been
96+
commented out since v4.0, when the content moved to the new Cookbook)
97+
* Reword IMPLICIT_COMMAND_DEPENDENCIES construction variable.
9798

9899

99100
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
@@ -133,6 +133,8 @@ DOCUMENTATION
133133
- Drop old example section from manpage. This has been commented out since
134134
release 4.0, when the content was used to populate the new SCons Cookbook.
135135

136+
- Update documentation for IMPLICIT_COMMAND_DEPENDENCIES construction variable.
137+
136138
DEVELOPMENT
137139
-----------
138140

SCons/Action.xml

Lines changed: 45 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -27,109 +27,66 @@ This file is processed by the bin/SConsDoc.py module.
2727
<cvar name="IMPLICIT_COMMAND_DEPENDENCIES">
2828
<summary>
2929
<para>
30-
Controls whether or not &SCons; will
31-
add implicit dependencies for the commands
32-
executed to build targets.
30+
Controls how &SCons; adds implicit dependencies from action strings
31+
(the commands executed to build targets).
32+
These implicit dependencies allow &SCons; to trigger target rebuilds
33+
when the compilers, tools, or scripts that affect build outcomes change
34+
(for example, when a new version of a compiler is installed).
35+
By default, &SCons; adds an implicit dependency on the executable
36+
represented by the first argument of the command line.
37+
This executable is first checked as a path;
38+
if not found, it is searched for in the execution environment's search path
39+
(<literal>env['ENV']['PATH']</literal>).
3340
</para>
3441

3542
<para>
36-
By default, &SCons; will add to each target
37-
an implicit dependency on the command
38-
represented by the first argument of any
39-
command line it executes (which is typically
40-
the command itself). By setting such
41-
a dependency, &SCons; can determine that
42-
a target should be rebuilt if the command changes,
43-
such as when a compiler is upgraded to a new version.
44-
The specific file for the dependency is
45-
found by searching the
46-
<varname>PATH</varname>
47-
variable in the
48-
<varname>ENV</varname> dictionary
49-
in the &consenv; used to execute the command.
50-
The default is the same as
51-
setting the &consvar;
43+
If &cv-IMPLICIT_COMMAND_DEPENDENCIES; is set to a falsy value
44+
(<literal>"none"</literal>, <literal>"false"</literal>,
45+
<literal>"no"</literal>, <literal>"off"</literal>,
46+
<literal>"0"</literal> or integer <literal>0</literal>),
47+
no implicit dependencies from action strings are added.
48+
If set to an integer value greater than <literal>1</literal>,
49+
or to <literal>"all"</literal>,
50+
additional command-line arguments are checked.
51+
A numeric value <emphasis>N</emphasis>
52+
checks the first <emphasis>N</emphasis> arguments,
53+
while <literal>"all"</literal> checks every argument.
54+
A checked argument beyond the first is added as a dependency
55+
if it is an absolute path or it refers to
56+
an existing file in the filesystem;
57+
unlike the first argument, these additional arguments are not searched
58+
using the execution environment's search path.
59+
All other values of &cv-IMPLICIT_COMMAND_DEPENDENCIES;
60+
are treated the same as the default.
61+
The value of
5262
&cv-IMPLICIT_COMMAND_DEPENDENCIES;
53-
to a True-like value (<quote>true</quote>,
54-
<quote>yes</quote>,
55-
or <quote>1</quote> - but not a number
56-
greater than one, as that has a different meaning).
63+
is subject to substitution before it is used,
64+
so it can contain a &consvar; reference.
5765
</para>
5866

5967
<para>
60-
Action strings can be segmented by the
61-
use of an AND operator, <literal>&amp;&amp;</literal>.
62-
In a segmented string, each segment is a separate
63-
<quote>command line</quote>, these are run
64-
sequentially until one fails, or the entire
65-
sequence has been executed. If an
66-
action string is segmented, then the selected
67-
behavior of &cv-IMPLICIT_COMMAND_DEPENDENCIES;
68-
is applied to each segment.
68+
Action strings may be segmented with a logical AND operator
69+
(<literal>&amp;&amp;</literal>),
70+
indicating each segment is executed sequentially,
71+
but only if the previous segment succeeded.
72+
If &cv-IMPLICIT_COMMAND_DEPENDENCIES; is set to
73+
<literal>"all"</literal> or an integer greater than <literal>1</literal>,
74+
each segment is treated as a separate command line
75+
for computing dependencies;
76+
otherwise, only the first segment is checked.
6977
</para>
70-
71-
<para>
72-
If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
73-
is set to a False-like value
74-
(<quote>none</quote>,
75-
<quote>false</quote>,
76-
<quote>no</quote>,
77-
<quote>0</quote>,
78-
etc.),
79-
then the implicit dependency will
80-
not be added to the targets
81-
built with that &consenv;.
82-
</para>
83-
84-
<para>
85-
If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
86-
is set to <quote>2</quote> or higher,
87-
then that number of arguments in the command line
88-
will be scanned for relative or absolute paths.
89-
If any are present, they will be added as
90-
implicit dependencies to the targets built
91-
with that &consenv;.
92-
The first argument in the command line will be
93-
searched for using the <varname>PATH</varname>
94-
variable in the <varname>ENV</varname> dictionary
95-
in the &consenv; used to execute the command.
96-
The other arguments will only be found if they
97-
are absolute paths or valid paths relative
98-
to the working directory.
99-
</para>
100-
101-
<para>
102-
If &cv-IMPLICIT_COMMAND_DEPENDENCIES;
103-
is set to <quote>all</quote>,
104-
then all arguments in the command line will be
105-
scanned for relative or absolute paths.
106-
If any are present, they will be added as
107-
implicit dependencies to the targets built
108-
with that &consenv;.
109-
The first argument in the command line will be
110-
searched for using the <varname>PATH</varname>
111-
variable in the <varname>ENV</varname> dictionary
112-
in the &consenv; used to execute the command.
113-
The other arguments will only be found if they
114-
are absolute paths or valid paths relative
115-
to the working directory.
116-
</para>
117-
118-
<example_commands>
119-
env = Environment(IMPLICIT_COMMAND_DEPENDENCIES=False)
120-
</example_commands>
12178
</summary>
12279
</cvar>
12380

12481
<cvar name="PRINT_CMD_LINE_FUNC">
12582
<summary>
12683
<para>
127-
A Python function used to print the command lines as they are executed
128-
(assuming command printing is not disabled by the
129-
<option>-q</option>
84+
A &Python; function used to print the command lines as they are executed
85+
(unless command printing is disabled by the
86+
<link linkend="opt-question"><option>-q</option>/<option>--question</option></link>
13087
or
131-
<option>-s</option>
132-
options or their equivalents).
88+
<link linkend="opt-silent"><option>-s</option>/<option>--silent</option></link>
89+
options).
13390
The function must accept four arguments:
13491
<varname>s</varname>,
13592
<varname>target</varname>,

SCons/Defaults.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,8 @@ directly into &cv-link-CCFLAGS; or &cv-link-CXXFLAGS;
266266
as the result will be non-portable
267267
and the directories will not be searched by the dependency scanner.
268268
&cv-CPPPATH; should be a list of path strings,
269-
or a single string, not a pathname list joined by
270-
Python's <systemitem>os.pathsep</systemitem>.
269+
or a single string, not a pathname list joined by the
270+
&Python; <systemitem>os.pathsep</systemitem> character.
271271
</para>
272272

273273
<para>
@@ -527,7 +527,7 @@ The list of directories that will be searched for libraries
527527
specified by the &cv-link-LIBS; &consvar;.
528528
&cv-LIBPATH; should be a list of path strings,
529529
or a single string, not a pathname list joined by
530-
Python's <systemitem>os.pathsep</systemitem>.
530+
the &Python; <systemitem>os.pathsep</systemitem> character.
531531
<!-- XXX OLD
532532
The implicit dependency scanner will search these
533533
directories for include files. Don't explicitly put include directory

SCons/Script/Main.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ the strings representing how the option can be called,
3737
while the keyword arguments define attributes of the option.
3838
For the most part these are the same as for the
3939
<function>OptionParser.add_option</function>
40-
method in the standard Python library module
40+
method in the standard &Python; library module
4141
<systemitem>optparse</systemitem>,
4242
but with a few additional capabilities noted below.
4343
See the
@@ -240,7 +240,7 @@ when the build failure occurred.
240240
<para>
241241
<literal>.status</literal>
242242
The numeric exit status
243-
returned by the command or Python function
243+
returned by the command or &Python; function
244244
that failed when trying to build the
245245
specified Node.
246246
</para>
@@ -322,8 +322,8 @@ Its primary intended use is
322322
for functions that will be
323323
executed before SCons exits
324324
by passing them to the
325-
standard Python
326-
<function>atexit.register</function>()
325+
standard &Python;
326+
<function>atexit.register</function>
327327
function.
328328
Example:
329329
</para>
@@ -706,7 +706,7 @@ evaluating Nodes (e.g. files).
706706
</para>
707707

708708
<para>
709-
If the first specified argument is a Python callable
709+
If the first specified argument is a &Python; callable
710710
(a function or an object that has a
711711
<methodname>__call__</methodname> method),
712712
the function will be called

SCons/Script/SConscript.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ env.Default(hello)
9090
</arguments>
9191
<summary>
9292
<para>
93-
Ensure that the Python version is at least
93+
Ensure that the &Python; version is at least
9494
<varname>major</varname>.<varname>minor</varname>.
9595
This function will
96-
print out an error message and exit SCons with a non-zero exit code if the
97-
actual Python version is not late enough.
96+
print out an error message and exit &SCons; with a non-zero exit code if the
97+
actual &Python; version is not late enough.
9898
</para>
9999

100100
<para>

SCons/Tool/msvs.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ This file is processed by the bin/SConsDoc.py module.
6161
Note &SCons; does not know how to construct project files for
6262
other languages (e.g. <filename>.csproj</filename> for C#,
6363
<filename>.vbproj</filename> for Visual Basic or
64-
<filename>.pyproject</filename> for Python).
64+
<filename>.pyproject</filename> for &Python;).
6565
</para>
6666
<para>
6767
For the <filename>.vcxproj</filename> file, the underlying

SCons/Tool/python.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ This file is processed by the bin/SConsDoc.py module.
2727
<tool name="python">
2828
<summary>
2929
<para>
30-
Loads the Python source scanner into the invoking environment.
30+
Loads the &Python; source scanner into the invoking environment.
3131
When loaded, the scanner will attempt to find implicit
32-
dependencies for any Python source files in the list of sources
32+
dependencies for any &Python; source files in the list of sources
3333
provided to an Action that uses this environment.
3434
</para>
3535
<para><emphasis>Available since &scons; 4.0.</emphasis>.</para>

SCons/Tool/textfile.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ value of the
5656
the line separator is not emitted after the last string.
5757
Nested lists of source strings
5858
are flattened.
59-
Source strings need not literally be Python strings:
60-
they can be Nodes or Python objects that convert cleanly
59+
Source strings need not literally be &Python; strings:
60+
they can be Nodes or &Python; objects that convert cleanly
6161
to &f-link-Value; nodes.
6262
</para>
6363

@@ -149,7 +149,7 @@ are automatically added to the target if they are not already present.
149149

150150
<para>
151151
If a construction variable named &cv-link-SUBST_DICT; is present,
152-
it may be either a Python dictionary or a sequence of
152+
it may be either a &Python; dictionary or a sequence of
153153
(<replaceable>key</replaceable>, <replaceable>value</replaceable>) tuples.
154154
If it is a dictionary it is converted into a list of tuples
155155
with unspecified order,
@@ -161,7 +161,7 @@ it is unpredictable whether the expansion will occur.
161161
<para>
162162
Any occurrences of a key in the source
163163
are replaced by the corresponding value,
164-
which may be a Python callable function or a string.
164+
which may be a &Python; callable function or a string.
165165
If the value is a callable, it is called with no arguments to get a string.
166166
Strings are <emphasis>subst</emphasis>-expanded
167167
and the result replaces the key.

SCons/Tool/zip.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The zip compression and file packaging utility.
8686
<summary>
8787
<para>
8888
The command line used to call the zip utility,
89-
or the internal Python function used to create a
89+
or the internal &Python; function used to create a
9090
zip archive.
9191
</para>
9292
</summary>
@@ -98,7 +98,7 @@ zip archive.
9898
The string displayed when archiving files
9999
using the zip utility.
100100
If this is not set, then &cv-link-ZIPCOM;
101-
(the command line or internal Python function) is displayed.
101+
(the command line or internal &Python; function) is displayed.
102102
</para>
103103

104104
<example_commands>
@@ -112,10 +112,9 @@ env = Environment(ZIPCOMSTR = "Zipping $TARGET")
112112
<para>
113113
The
114114
<varname>compression</varname>
115-
flag
116-
from the Python
117-
<filename>zipfile</filename>
118-
module used by the internal Python function
115+
flag from the &Python;
116+
<systemitem>zipfile</systemitem>
117+
module used by the internal &Python; function
119118
to control whether the zip archive
120119
is compressed or not.
121120
The default value is

0 commit comments

Comments
 (0)