Skip to content

Commit 103866d

Browse files
authored
Merge pull request SCons#4531 from mwichmann/doc/api-package-ordering
API Docs build adjustment.
2 parents c33bb1a + 53fccd8 commit 103866d

File tree

11 files changed

+127
-98
lines changed

11 files changed

+127
-98
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
6363
old Python 2-only code block in a test.
6464
- scons-time tests now supply a "filter" argument to tarfile.extract
6565
to quiet a warning which was added in Python 3.13 beta 1.
66+
- Restructured API docs build (Sphinx) so main module contents appear
67+
on a given page *before* the submodule docs, not after. Also
68+
tweaked the Util package doc build so it's structured more like the
69+
other packages (a missed part of the transition when it was split).
6670

6771

6872
RELEASE 4.7.0 - Sun, 17 Mar 2024 17:22:20 -0700

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ DOCUMENTATION
6969
- Updated Value Node docs.
7070
- Update manpage for Tools, and for the TOOL variable.
7171
- Update manpage and user guide for Variables usage.
72+
- Restructured API Docs build so main package contents are listed
73+
before contents of package submodules.
7274

7375

7476

SCons/Debug.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
"""Code for debugging SCons internal things.
2525
26-
Shouldn't be needed by most users. Quick shortcuts:
26+
Shouldn't be needed by most users. Quick shortcuts::
2727
28-
from SCons.Debug import caller_trace
29-
caller_trace()
28+
from SCons.Debug import caller_trace
29+
caller_trace()
3030
"""
3131

3232
import atexit

SCons/PathList.py

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
"""Handle lists of directory paths.
2525
26-
These are the path lists that get set as CPPPATH, LIBPATH,
26+
These are the path lists that get set as ``CPPPATH``, ``LIBPATH``,
2727
etc.) with as much caching of data and efficiency as we can, while
2828
still keeping the evaluation delayed so that we Do the Right Thing
2929
(almost) regardless of how the variable is specified.
@@ -47,10 +47,10 @@ def node_conv(obj):
4747
"""
4848
This is the "string conversion" routine that we have our substitutions
4949
use to return Nodes, not strings. This relies on the fact that an
50-
EntryProxy object has a get() method that returns the underlying
51-
Node that it wraps, which is a bit of architectural dependence
52-
that we might need to break or modify in the future in response to
53-
additional requirements.
50+
:class:`~SCons.Node.FS.EntryProxy` object has a ``get()`` method that
51+
returns the underlying Node that it wraps, which is a bit of
52+
architectural dependence that we might need to break or modify in the
53+
future in response to additional requirements.
5454
"""
5555
try:
5656
get = obj.get
@@ -64,34 +64,35 @@ def node_conv(obj):
6464
return result
6565

6666
class _PathList:
67-
"""An actual PathList object."""
67+
"""An actual PathList object.
6868
69-
def __init__(self, pathlist, split=True) -> None:
70-
"""
71-
Initializes a PathList object, canonicalizing the input and
72-
pre-processing it for quicker substitution later.
69+
Initializes a :class:`PathList` object, canonicalizing the input and
70+
pre-processing it for quicker substitution later.
7371
74-
The stored representation of the PathList is a list of tuples
75-
containing (type, value), where the "type" is one of the TYPE_*
76-
variables defined above. We distinguish between:
72+
The stored representation of the :class:`PathList` is a list of tuples
73+
containing (type, value), where the "type" is one of the ``TYPE_*``
74+
variables defined above. We distinguish between:
7775
78-
strings that contain no '$' and therefore need no
79-
delayed-evaluation string substitution (we expect that there
80-
will be many of these and that we therefore get a pretty
81-
big win from avoiding string substitution)
76+
* Strings that contain no ``$`` and therefore need no
77+
delayed-evaluation string substitution (we expect that there
78+
will be many of these and that we therefore get a pretty
79+
big win from avoiding string substitution)
8280
83-
strings that contain '$' and therefore need substitution
84-
(the hard case is things like '${TARGET.dir}/include',
85-
which require re-evaluation for every target + source)
81+
* Strings that contain ``$`` and therefore need substitution
82+
(the hard case is things like ``${TARGET.dir}/include``,
83+
which require re-evaluation for every target + source)
8684
87-
other objects (which may be something like an EntryProxy
88-
that needs a method called to return a Node)
85+
* Other objects (which may be something like an
86+
:class:`~SCons.Node.FS.EntryProxy`
87+
that needs a method called to return a Node)
8988
90-
Pre-identifying the type of each element in the PathList up-front
91-
and storing the type in the list of tuples is intended to reduce
92-
the amount of calculation when we actually do the substitution
93-
over and over for each target.
94-
"""
89+
Pre-identifying the type of each element in the :class:`PathList`
90+
up-front and storing the type in the list of tuples is intended to
91+
reduce the amount of calculation when we actually do the substitution
92+
over and over for each target.
93+
"""
94+
95+
def __init__(self, pathlist, split=True) -> None:
9596
if SCons.Util.is_String(pathlist):
9697
if split:
9798
pathlist = pathlist.split(os.pathsep)
@@ -152,34 +153,33 @@ class PathListCache:
152153
use the same Memoizer pattern that we use elsewhere to count cache
153154
hits and misses, which is very valuable.
154155
155-
Lookup keys in the cache are computed by the _PathList_key() method.
156+
Lookup keys in the cache are computed by the :meth:`_PathList_key` method.
156157
Cache lookup should be quick, so we don't spend cycles canonicalizing
157-
all forms of the same lookup key. For example, 'x:y' and ['x',
158-
'y'] logically represent the same list, but we don't bother to
158+
all forms of the same lookup key. For example, ``x:y`` and ``['x', 'y']``
159+
logically represent the same list, but we don't bother to
159160
split string representations and treat those two equivalently.
160161
(Note, however, that we do, treat lists and tuples the same.)
161162
162163
The main type of duplication we're trying to catch will come from
163164
looking up the same path list from two different clones of the
164-
same construction environment. That is, given
165+
same construction environment. That is, given::
165166
166167
env2 = env1.Clone()
167168
168-
both env1 and env2 will have the same CPPPATH value, and we can
169-
cheaply avoid re-parsing both values of CPPPATH by using the
169+
both ``env1`` and ``env2`` will have the same ``CPPPATH`` value, and we can
170+
cheaply avoid re-parsing both values of ``CPPPATH`` by using the
170171
common value from this cache.
171172
"""
172173
def __init__(self) -> None:
173174
self._memo = {}
174175

175176
def _PathList_key(self, pathlist):
176-
"""
177-
Returns the key for memoization of PathLists.
177+
"""Returns the key for memoization of PathLists.
178178
179179
Note that we want this to be pretty quick, so we don't completely
180180
canonicalize all forms of the same list. For example,
181-
'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically
182-
represent the same list if you're executing from $ROOT, but
181+
``dir1:$ROOT/dir2`` and ``['$ROOT/dir1', 'dir']`` may logically
182+
represent the same list if you're executing from ``$ROOT``, but
183183
we're not going to bother splitting strings into path elements,
184184
or massaging strings into Nodes, to identify that equivalence.
185185
We just want to eliminate obvious redundancy from the normal
@@ -191,9 +191,10 @@ def _PathList_key(self, pathlist):
191191

192192
@SCons.Memoize.CountDictCall(_PathList_key)
193193
def PathList(self, pathlist, split=True):
194-
"""
195-
Returns the cached _PathList object for the specified pathlist,
196-
creating and caching a new object as necessary.
194+
"""Entry point for getting PathLists.
195+
196+
Returns the cached :class:`_PathList` object for the specified
197+
pathlist, creating and caching a new object as necessary.
197198
"""
198199
pathlist = self._PathList_key(pathlist)
199200
try:
@@ -215,7 +216,8 @@ def PathList(self, pathlist, split=True):
215216

216217
PathList = PathListCache().PathList
217218

218-
219+
# TODO: removing the class object here means Sphinx doesn't pick up its
220+
# docstrings: they're fine for reading here, but are not in API Docs.
219221
del PathListCache
220222

221223
# Local Variables:

doc/sphinx/SCons.Node.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
SCons.Node package
22
==================
33

4+
Module contents
5+
---------------
6+
7+
.. automodule:: SCons.Node
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
413
Submodules
514
----------
615

@@ -27,12 +36,3 @@ SCons.Node.Python module
2736
:members:
2837
:undoc-members:
2938
:show-inheritance:
30-
31-
32-
Module contents
33-
---------------
34-
35-
.. automodule:: SCons.Node
36-
:members:
37-
:undoc-members:
38-
:show-inheritance:

doc/sphinx/SCons.Platform.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
SCons.Platform package
22
======================
33

4+
Module contents
5+
---------------
6+
7+
.. automodule:: SCons.Platform
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
413
Submodules
514
----------
615

@@ -91,12 +100,3 @@ SCons.Platform.win32 module
91100
:members:
92101
:undoc-members:
93102
:show-inheritance:
94-
95-
96-
Module contents
97-
---------------
98-
99-
.. automodule:: SCons.Platform
100-
:members:
101-
:undoc-members:
102-
:show-inheritance:

doc/sphinx/SCons.Scanner.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
SCons.Scanner package
22
=====================
33

4+
Module contents
5+
---------------
6+
7+
.. automodule:: SCons.Scanner
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
413
Submodules
514
----------
615

@@ -83,12 +92,3 @@ SCons.Scanner.SWIG module
8392
:members:
8493
:undoc-members:
8594
:show-inheritance:
86-
87-
88-
Module contents
89-
---------------
90-
91-
.. automodule:: SCons.Scanner
92-
:members:
93-
:undoc-members:
94-
:show-inheritance:

doc/sphinx/SCons.Script.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
SCons.Script package
22
====================
33

4+
Module contents
5+
---------------
6+
7+
.. automodule:: SCons.Script
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
413
Submodules
514
----------
615

@@ -35,12 +44,3 @@ SCons.Script.SConscript module
3544
:members:
3645
:undoc-members:
3746
:show-inheritance:
38-
39-
40-
Module contents
41-
---------------
42-
43-
.. automodule:: SCons.Script
44-
:members:
45-
:undoc-members:
46-
:show-inheritance:

doc/sphinx/SCons.Taskmaster.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
SCons.Taskmaster package
22
========================
33

4+
Module contents
5+
---------------
6+
7+
.. automodule:: SCons.Taskmaster
8+
:members:
9+
:undoc-members:
10+
:show-inheritance:
11+
12+
413
Submodules
514
----------
615

@@ -11,11 +20,3 @@ SCons.Taskmaster.Job module
1120
:members:
1221
:undoc-members:
1322
:show-inheritance:
14-
15-
Module contents
16-
---------------
17-
18-
.. automodule:: SCons.Taskmaster
19-
:members:
20-
:undoc-members:
21-
:show-inheritance:

doc/sphinx/SCons.Util.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
11
SCons.Util package
22
==================
33

4-
Submodules
5-
----------
4+
Module contents
5+
---------------
66

77
.. automodule:: SCons.Util
88
:members:
99
:undoc-members:
1010
:show-inheritance:
1111

12+
13+
Submodules
14+
----------
15+
16+
SCons.Util.envs module
17+
----------------------
18+
1219
.. automodule:: SCons.Util.envs
1320
:members:
1421
:undoc-members:
1522
:show-inheritance:
1623

24+
SCons.Util.filelock module
25+
--------------------------
26+
1727
.. automodule:: SCons.Util.filelock
1828
:members:
1929
:undoc-members:
2030
:show-inheritance:
2131

32+
SCons.Util.hashes module
33+
------------------------
34+
2235
.. automodule:: SCons.Util.hashes
2336
:members:
2437
:undoc-members:
2538
:show-inheritance:
2639

40+
SCons.Util.sctypes module
41+
-------------------------
42+
2743
.. automodule:: SCons.Util.sctypes
2844
:members:
2945
:undoc-members:
3046
:show-inheritance:
3147

48+
SCons.Util.stats module
49+
-----------------------
50+
3251
.. automodule:: SCons.Util.stats
3352
:members:
3453
:undoc-members:

0 commit comments

Comments
 (0)