Skip to content

Commit a3c76a2

Browse files
authored
Merge branch 'master' into complex-type-hint-framework
2 parents 531cbfd + 759ed8c commit a3c76a2

38 files changed

+1202
-879
lines changed

CHANGES.txt

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,44 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
5757
- Fix of the --debug=sconscript option to return exist statements when using return
5858
statement with stop flag enabled
5959

60+
From Prabhu S. Khalsa:
61+
- Fix typo in user documentation (issue #4458)
62+
63+
From Andrew Morrow:
64+
- The NewParallel scheduler is now the default, the `tm_v2` flag is removed,
65+
and the old scheduler is opt-in under `--experimental=legacy_sched`. Additionally,
66+
the new scheduler is now used for -j1 builds as well.
67+
- A python interpreter with support for the `threading` package is now required,
68+
and this is enforced on startup. SCons currently sets its minimum supported
69+
Python to 3.6, and it was not until Python 3.7 where `threading` became
70+
default supported. In practice, we expect most real world Python 3.6 deployments
71+
will have `threading` support enabled, so this will not be an issue.
72+
- CacheDir writes no longer happen within the taskmaster critical section,
73+
and therefore can run in parallel with both other CacheDir writes and the
74+
taskmaster DAG walk.
75+
- The NewParallel scheduler now only adds threads as new work requiring execution
76+
is discovered, up to the limit set by -j. This should reduce resource utilization
77+
when the achievable parallelism in the DAG is less than the -j limit.
78+
6079
From Mats Wichmann:
6180
- Add support for Python 3.13 (as of alpha 2). So far only affects
6281
expected bytecodes in ActionTests.py.
82+
- sconsign cleanup - remove some dead code, minor manpage tweaks.
83+
- Be more cautious about encodings fetching command output on Windows.
84+
Problem occurs in piped-spawn scenario, used by Configure tests.
85+
Fixes #3529.
86+
- Clarify/fix documentation of Scanners in User Guide and Manpage.
87+
Fixes #4468.
88+
- Fix bad typing in Action.py: process() and strfunction().
89+
- Add Pseudo() to global functions, had been omitted. Fixes #4474.
90+
- Improve handling of file data that SCons itself processes - try
91+
harder to decode non-UTF-8 text. SCons.Util.to_Text now exists
92+
to convert a byte stream, such as "raw" file data. Fixes #3569, #4462.
93+
The Pseudo manpage entry was updated to provide more clarity.
94+
- The internal routine which implements the PyPackageDir function
95+
would fail with an exception if called with a module which is
96+
not found. It will now return None. Updated manpage entry and
97+
docstring..
6398

6499

65100
RELEASE 4.6.0 - Sun, 19 Nov 2023 17:22:20 -0700
@@ -7951,4 +7986,3 @@ A brief overview of important functionality available in release 0.01:
79517986
- Linux packages available in RPM and Debian format.
79527987

79537988
- Windows installer available.
7954-

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,13 @@ You may specifically list one or more tests to be run::
297297

298298
$ python runtest.py SCons/BuilderTests.py
299299

300-
$ python runtest.py test/option-j.py test/Program.py
300+
$ python runtest.py test/option/option-j.py test/Program.py
301301

302302
You also use the ``-f`` option to execute just the tests listed in a specified
303303
text file::
304304

305305
$ cat testlist.txt
306-
test/option-j.py
306+
test/option/option-j.py
307307
test/Program.py
308308
$ python runtest.py -f testlist.txt
309309

RELEASE.txt

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY
3333
that the generated function argument list matches the function's
3434
prototype when including a header file. Fixes GH Issue #4320
3535
- Now supports pre-release Python 3.13
36+
- Support for Python versions without support for the `threading` package has been removed
3637

3738
FIXES
3839
-----
@@ -49,12 +50,32 @@ FIXES
4950
- MSVS: Fix the msvs project generation test scripts so that "false positive" tests
5051
results are not possible when the initial build is successful and the command-line
5152
build of the project file fails.
53+
- On Windows platform, when collecting command output (Configure checks),
54+
make sure decoding of bytes doesn't fail.
55+
- Documentation indicated that both Pseudo() and env.Pseudo() were usable,
56+
but Pseudo() did not work; is now enabled.
57+
- Improve handling of file data that SCons itself processes - as in
58+
scanners - try harder to decode non-UTF-8 text.
59+
- PyPackageDir no longer fails if passed a module name which cannot be found,
60+
now returns None.
61+
5262

5363
IMPROVEMENTS
5464
------------
5565

5666
- Use of NotImplemented instead of NotImplementedError for special methods
5767
of _ListVariable class
68+
- The NewParallel scheduler is now the default, the `tm_v2` flag is removed,
69+
and the old scheduler is opt-in under `--experimental=legacy_sched`. Additionally,
70+
the new scheduler is now used for -j1 builds as well.
71+
NOTE: This should significantly improve SCons performance for larger parallel builds
72+
(Larger -j values)
73+
- CacheDir writes no longer happen within the taskmaster critical section, and therefore
74+
can run in parallel with both other CacheDir writes and the taskmaster DAG walk.
75+
- The NewParallel scheduler now only adds threads as new work requiring execution
76+
is discovered, up to the limit set by -j. This should reduce resource utilization
77+
when the achievable parallelism in the DAG is less than the -j limit.
78+
5879

5980
PACKAGING
6081
---------
@@ -64,9 +85,10 @@ PACKAGING
6485
DOCUMENTATION
6586
-------------
6687

67-
- List any significant changes to the documentation (not individual
68-
typo fixes, even if they're mentioned in src/CHANGES.txt to give
69-
the contributor credit)
88+
- Fixed the Scanner examples in the User Guide to be runnable and added
89+
some more explantion. Clarified discussion of the scanner function in
90+
the Scanner Objects section of the manpage.
91+
- The manpage entry for Pseudo was clarified.
7092

7193
DEVELOPMENT
7294
-----------

SCons/Action.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
from abc import ABC, abstractmethod
110110
from collections import OrderedDict
111111
from subprocess import DEVNULL, PIPE
112-
from typing import Optional
112+
from typing import List, Optional, Tuple
113113

114114
import SCons.Debug
115115
import SCons.Errors
@@ -118,7 +118,7 @@
118118

119119
# we use these a lot, so try to optimize them
120120
from SCons.Debug import logInstanceCreation
121-
from SCons.Subst import SUBST_SIG, SUBST_RAW
121+
from SCons.Subst import SUBST_CMD, SUBST_RAW, SUBST_SIG
122122
from SCons.Util import is_String, is_List
123123
from SCons.Util.sctyping import ExecutorType
124124

@@ -129,13 +129,10 @@ class _null:
129129
execute_actions = True
130130
print_actions_presub = False
131131

132-
# Use pickle protocol 1 when pickling functions for signature
133-
# otherwise python3 and python2 will yield different pickles
134-
# for the same object.
135-
# This is due to default being 1 for python 2.7, and 3 for 3.x
136-
# TODO: We can roll this forward to 2 (if it has value), but not
137-
# before a deprecation cycle as the sconsigns will change
138-
ACTION_SIGNATURE_PICKLE_PROTOCOL = 1
132+
# Use pickle protocol 4 when pickling functions for signature.
133+
# This is the common format since Python 3.4
134+
# TODO: use is commented out as not stable since 2017: e0bc3a04d5. Drop?
135+
# ACTION_SIGNATURE_PICKLE_PROTOCOL = 4
139136

140137

141138
def rfile(n):
@@ -450,7 +447,7 @@ def _do_create_action(act, kw):
450447
return act
451448

452449
if is_String(act):
453-
var=SCons.Util.get_environment_var(act)
450+
var = SCons.Util.get_environment_var(act)
454451
if var:
455452
# This looks like a string that is purely an Environment
456453
# variable reference, like "$FOO" or "${FOO}". We do
@@ -1012,18 +1009,19 @@ def __str__(self) -> str:
10121009
return ' '.join(map(str, self.cmd_list))
10131010
return str(self.cmd_list)
10141011

1015-
def process(self, target, source, env, executor: Optional[ExecutorType] = None, overrides: bool=False):
1012+
1013+
def process(self, target, source, env, executor=None, overrides: Optional[dict] = None) -> Tuple[List, bool, bool]:
10161014
if executor:
1017-
result = env.subst_list(self.cmd_list, 0, executor=executor, overrides=overrides)
1015+
result = env.subst_list(self.cmd_list, SUBST_CMD, executor=executor, overrides=overrides)
10181016
else:
1019-
result = env.subst_list(self.cmd_list, 0, target, source, overrides=overrides)
1020-
silent = None
1021-
ignore = None
1017+
result = env.subst_list(self.cmd_list, SUBST_CMD, target, source, overrides=overrides)
1018+
silent = False
1019+
ignore = False
10221020
while True:
10231021
try: c = result[0][0][0]
10241022
except IndexError: c = None
1025-
if c == '@': silent = 1
1026-
elif c == '-': ignore = 1
1023+
if c == '@': silent = True
1024+
elif c == '-': ignore = True
10271025
else: break
10281026
result[0][0] = result[0][0][1:]
10291027
try:
@@ -1033,7 +1031,7 @@ def process(self, target, source, env, executor: Optional[ExecutorType] = None,
10331031
pass
10341032
return result, ignore, silent
10351033

1036-
def strfunction(self, target, source, env, executor: Optional[ExecutorType] = None, overrides: bool=False):
1034+
def strfunction(self, target, source, env, executor: Optional[ExecutorType] = None, overrides: Optional[dict] = None) -> str:
10371035
if self.cmdstr is None:
10381036
return None
10391037
if self.cmdstr is not _null:

SCons/Environment.py

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

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

23502351
def Pseudo(self, *targets):
2352+
"""Mark *targets* as pseudo: must not exist."""
23512353
tlist = []
23522354
for t in targets:
23532355
tlist.extend(self.arg2nodes(t, self.fs.Entry))
@@ -2356,13 +2358,17 @@ def Pseudo(self, *targets):
23562358
return tlist
23572359

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

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

SCons/Environment.xml

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,20 +2880,41 @@ and &f-link-env-Prepend;.
28802880
</arguments>
28812881
<summary>
28822882
<para>
2883-
This returns a Directory Node similar to Dir.
2884-
The python module / package is looked up and if located
2885-
the directory is returned for the location.
2886-
<parameter>modulename</parameter>
2887-
Is a named python package / module to
2888-
lookup the directory for it's location.
2889-
</para>
2890-
<para>
2891-
If
2892-
<parameter>modulename</parameter>
2893-
is a list, SCons returns a list of Dir nodes.
2883+
Finds the location of <parameter>modulename</parameter>,
2884+
which can be a string or a sequence of strings,
2885+
each representing the name of a &Python; module.
28942886
Construction variables are expanded in
28952887
<parameter>modulename</parameter>.
2888+
Returns a Directory Node (see &f-link-Dir;),
2889+
or a list of Directory Nodes if
2890+
<parameter>modulename</parameter> is a sequence.
2891+
<literal>None</literal> is returned for any module not found.
2892+
</para>
2893+
2894+
<para>
2895+
When a Tool module which is installed as a
2896+
&Python; module is used, you need
2897+
to specify a <parameter>toolpath</parameter> argument to
2898+
&f-link-Tool;,
2899+
&f-link-Environment;
2900+
or &f-link-Clone;,
2901+
as tools outside the standard project locations
2902+
(<filename>site_scons/site_tools</filename>)
2903+
will not be found otherwise.
2904+
Using &f-PyPackageDir; allows this path to be
2905+
discovered at runtime instead of hardcoding the path.
28962906
</para>
2907+
2908+
<para>
2909+
Example:
2910+
</para>
2911+
2912+
<example_commands>
2913+
env = Environment(
2914+
tools=["default", "ExampleTool"],
2915+
toolpath=[PyPackageDir("example_tool")]
2916+
)
2917+
</example_commands>
28972918
</summary>
28982919
</scons_function>
28992920

@@ -2988,6 +3009,10 @@ but the target file(s) do not actually
29883009
depend on the prerequisites
29893010
and will not be rebuilt simply because
29903011
the prerequisite file(s) change.
3012+
<parameter>target</parameter> and
3013+
<parameter>prerequisite</parameter> may each
3014+
be a string or Node, or a list of strings or Nodes.
3015+
Returns a list of the affected target nodes.
29913016
</para>
29923017

29933018
<para>

0 commit comments

Comments
 (0)