Skip to content

Commit f55307b

Browse files
committed
doc: update Pseudo description and more
The Pseudo manpage entry is updated to be more descriptive. Since they were near neighbors in Environment.py, it and the three functions Precious, Repository and Requires received minor docstring changes there; Precious and Requires also got a minor tweak to the manpage entry (mainly to clarify allowable argument types and list return value). Signed-off-by: Mats Wichmann <[email protected]>
1 parent 7e120e8 commit f55307b

File tree

6 files changed

+41
-22
lines changed

6 files changed

+41
-22
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
8080
Fixes #4468.
8181
- Fix bad typing in Action.py: process() and strfunction().
8282
- Add Pseudo() to global functions, had been omitted. Fixes #4474.
83+
The Pseudo manpage entry was updated to provide more clarity.
8384

8485

8586
RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700

RELEASE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ DOCUMENTATION
8080
- Fixed the Scanner examples in the User Guide to be runnable and added
8181
some more explantion. Clarified discussion of the scanner function in
8282
the Scanner Objects section of the manpage.
83+
- The manpage entry for Pseudo was clarified.
8384

8485
DEVELOPMENT
8586
-----------

SCons/Environment.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,7 @@ def Local(self, *targets):
23392339
return ret
23402340

23412341
def Precious(self, *targets):
2342+
"""Mark *targets* as precious: do not delete before building."""
23422343
tlist = []
23432344
for t in targets:
23442345
tlist.extend(self.arg2nodes(t, self.fs.Entry))
@@ -2347,6 +2348,7 @@ def Precious(self, *targets):
23472348
return tlist
23482349

23492350
def Pseudo(self, *targets):
2351+
"""Mark *targets* as pseudo: must not exist."""
23502352
tlist = []
23512353
for t in targets:
23522354
tlist.extend(self.arg2nodes(t, self.fs.Entry))
@@ -2355,13 +2357,17 @@ def Pseudo(self, *targets):
23552357
return tlist
23562358

23572359
def Repository(self, *dirs, **kw) -> None:
2360+
"""Specify Repository directories to search."""
23582361
dirs = self.arg2nodes(list(dirs), self.fs.Dir)
23592362
self.fs.Repository(*dirs, **kw)
23602363

23612364
def Requires(self, target, prerequisite):
2362-
"""Specify that 'prerequisite' must be built before 'target',
2363-
(but 'target' does not actually depend on 'prerequisite'
2364-
and need not be rebuilt if it changes)."""
2365+
"""Specify that *prerequisite* must be built before *target*.
2366+
2367+
Creates an order-only relationship, not a full dependency.
2368+
*prerequisite* must exist before *target* can be built, but
2369+
a change to *prerequisite* does not trigger a rebuild of *target*.
2370+
"""
23652371
tlist = self.arg2nodes(target, self.fs.Entry)
23662372
plist = self.arg2nodes(prerequisite, self.fs.Entry)
23672373
for t in tlist:

SCons/Environment.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,6 +2988,10 @@ but the target file(s) do not actually
29882988
depend on the prerequisites
29892989
and will not be rebuilt simply because
29902990
the prerequisite file(s) change.
2991+
<parameter>target</parameter> and
2992+
<parameter>prerequisite</parameter> may each
2993+
be a string or Node, or a list of strings or Nodes.
2994+
Returns a list of the affected target nodes.
29912995
</para>
29922996

29932997
<para>

SCons/Node/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ def set_precious(self, precious: int = 1) -> None:
12301230
self.precious = precious
12311231

12321232
def set_pseudo(self, pseudo: bool = True) -> None:
1233-
"""Set the Node's precious value."""
1233+
"""Set the Node's pseudo value."""
12341234
self.pseudo = pseudo
12351235

12361236
def set_noclean(self, noclean: int = 1) -> None:
@@ -1250,7 +1250,7 @@ def set_always_build(self, always_build: int = 1) -> None:
12501250
self.always_build = always_build
12511251

12521252
def exists(self) -> bool:
1253-
"""Does this node exists?"""
1253+
"""Reports whether node exists."""
12541254
return _exists_map[self._func_exists](self)
12551255

12561256
def rexists(self):

SCons/Script/Main.xml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -725,13 +725,12 @@ Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5)
725725
</arguments>
726726
<summary>
727727
<para>
728-
Marks each given
729-
<varname>target</varname>
730-
as precious so it is not deleted before it is rebuilt. Normally
731-
&scons;
732-
deletes a target before building it.
733-
Multiple targets can be passed in to a single call to
734-
&f-Precious;.
728+
Marks <varname>target</varname> as precious so it is not
729+
deleted before it is rebuilt.
730+
Normally &SCons; deletes a target before building it.
731+
Multiple targets can be passed in a single call,
732+
and may be strings and/or nodes.
733+
Returns a list of the affected target nodes.
735734
</para>
736735
</summary>
737736
</scons_function>
@@ -742,16 +741,24 @@ Multiple targets can be passed in to a single call to
742741
</arguments>
743742
<summary>
744743
<para>
745-
This indicates that each given
746-
<varname>target</varname>
747-
should not be created by the build rule, and if the target is created,
748-
an error will be generated. This is similar to the gnu make .PHONY
749-
target. However, in the vast majority of cases, an
750-
&f-Alias;
751-
is more appropriate.
752-
753-
Multiple targets can be passed in to a single call to
754-
&f-Pseudo;.
744+
Marks <parameter>target</parameter> as a pseudo target,
745+
not representing the production of any physical target file.
746+
If any pseudo <parameter>target</parameter> does exist,
747+
&SCons; will abort the build with an error.
748+
Multiple targets can be passed in a single call,
749+
and may be strings and/or Nodes.
750+
Returns a list of the affected target nodes.
751+
</para>
752+
753+
<para>
754+
&f-Pseudo; may be useful in conjuction with a builder
755+
call (such as &f-link-Command;) which does not create a physical target,
756+
and the behavior if the target accidentally existed would be incorrect.
757+
This is similar in concept to the GNU <application>make</application>
758+
<literal>.PHONY</literal> target.
759+
&SCons; also provides a powerful target alias capability
760+
(see &f-link-Alias;) which may provide more flexibility
761+
in many situations when defining target names that are not directly built.
755762
</para>
756763
</summary>
757764
</scons_function>

0 commit comments

Comments
 (0)