Skip to content

Commit ed251e7

Browse files
authored
Merge branch 'master' into ruff
2 parents 1121181 + 9e8161a commit ed251e7

File tree

200 files changed

+1310
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+1310
-812
lines changed

.appveyor.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ image:
88
# linux builds done in Travis CI for now
99
- Visual Studio 2017
1010
- Visual Studio 2019
11-
- Visual Studio 2022
11+
#- Visual Studio 2022 # Temporary disable while failing on 14.40 build tools
1212

1313
cache:
1414
- downloads -> appveyor.yml
@@ -37,38 +37,38 @@ environment:
3737
# Test oldest and newest supported Pythons, and a subset in between.
3838
# Skipping 3.7 and 3.9 at this time
3939
- WINPYTHON: "Python312"
40-
4140
- WINPYTHON: "Python310"
42-
4341
- WINPYTHON: "Python38"
44-
4542
- WINPYTHON: "Python36"
4643

4744
# remove sets of build jobs based on criteria below
4845
# to fine tune the number and platforms tested
4946
matrix:
5047
exclude:
51-
# test python 3.6 on Visual Studio 2017 image
48+
# XXX test python 3.6 on Visual Studio 2017 image
49+
# test python 3.8 on Visual Studio 2017 image
5250
- image: Visual Studio 2017
5351
WINPYTHON: "Python312"
5452
- image: Visual Studio 2017
5553
WINPYTHON: "Python310"
5654
- image: Visual Studio 2017
57-
WINPYTHON: "Python38"
55+
WINPYTHON: "Python36"
5856

59-
# test python 3.8 on Visual Studio 2019 image
57+
# test python 3.10 on Visual Studio 2019 image
6058
- image: Visual Studio 2019
6159
WINPYTHON: "Python312"
6260
- image: Visual Studio 2019
63-
WINPYTHON: "Python310"
61+
WINPYTHON: "Python38"
6462
- image: Visual Studio 2019
6563
WINPYTHON: "Python36"
6664

67-
# test python 3.10 and 3.11 on Visual Studio 2022 image
65+
# test python 3.12 on Visual Studio 2022 image
6866
- image: Visual Studio 2022
69-
WINPYTHON: "Python36"
67+
WINPYTHON: "Python310"
7068
- image: Visual Studio 2022
7169
WINPYTHON: "Python38"
70+
- image: Visual Studio 2022
71+
WINPYTHON: "Python36"
7272

7373
# Remove some binaries we don't want to be found
7474
# Note this is no longer needed, git-windows bin/ is quite minimal now.

CHANGES.txt

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
Change Log
66

7-
NOTE: The 4.0.0 Release of SCons dropped Python 2.7 Support
8-
NOTE: 4.3.0 now requires Python 3.6.0 and above. Python 3.5.x is no longer supported
7+
NOTE: The 4.0.0 release of SCons dropped Python 2.7 support. Use 3.1.2 if
8+
Python 2.7 support is required (but note old SCons releases are unsupported).
9+
NOTE: Since SCons 4.3.0, Python 3.6.0 or above is required.
10+
NOTE: Python 3.6 support is deprecated and will be dropped in a future reease.
11+
python.org no longer supports 3.6 or 3.7, and will drop 3.8 in Oct. 2024.
912

1013
RELEASE VERSION/DATE TO BE FILLED IN LATER
1114

@@ -77,6 +80,40 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
7780
- Framework for scons-time tests adjusted so a path with a long username
7881
Windows has squashed doesn't get re-expanded. Fixes a problem seen
7982
on GitHub Windows runner which uses a name "runneradmin".
83+
- SCons.Environment.is_valid_construction_var() now returns a boolean to
84+
match the convention that functions beginning with "is" have yes/no
85+
answers (previously returned either None or an re.match object).
86+
Now matches the annotation and docstring (which were prematurely
87+
updated in 4.6). All SCons usage except unit test was already fully
88+
consistent with a bool.
89+
- When a variable is added to a Variables object, it can now be flagged
90+
as "don't perform substitution" by setting the argument subst.
91+
This allows variables to contain characters which would otherwise
92+
cause expansion. Fixes #4241.
93+
- The test runner now recognizes the unittest module's return code of 5,
94+
which means no tests were run. SCons/Script/MainTests.py currently
95+
has no tests, so this particular error code is expected - should not
96+
cause runtest to give up with an "unknown error code".
97+
- Updated the notes about reproducible builds with SCons and the example.
98+
- The Clone() method now respects the variables argument (fixes #3590)
99+
- is_valid_construction_var() (not part of the public API) moved from
100+
SCons.Environment to SCons.Util to avoid the chance of import loops. Variables
101+
and Environment both use the routine and Environment() uses a Variables()
102+
object so better to move to a safer location.
103+
- AddOption and the internal add_local_option which AddOption calls now
104+
recognize a "settable" keyword argument to indicate a project-added
105+
option can also be modified using SetOption. Fixes #3983.
106+
NOTE: If you were using ninja and using SetOption() for ninja options
107+
in your SConscripts prior to loading the ninja tool, you will now
108+
see an error. The fix is to move the SetOption() to after you've loaded
109+
the ninja tool.
110+
- ListVariable now has a separate validator, with the functionality
111+
that was previously part of the converter. The main effect is to
112+
allow a developer to supply a custom validator, which previously
113+
could be inhibited by the converter failing before the validator
114+
is reached.
115+
- Regularized header (copyright, licens) at top of documentation files
116+
using SPDX.
80117

81118

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

README.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,19 @@ notifications and other GitHub events (``#github-update``),
249249
if those are of interest. See the website for more contact information:
250250
https://scons.org/contact.html.
251251

252+
Reproducible Builds
253+
===================
254+
SCons itself is set up to do "reproducible builds"
255+
(see (https://reproducible-builds.org/specs/source-date-epoch/)
256+
if environment variables ``SOURCE_DATE_EPOCH`` is set - that is,
257+
fields in the package which could change each time the package is
258+
constructed are forced to constant values.
259+
260+
To support other projects which wish to do the same, a sample script
261+
is provided which can be placed in a site directory, which imports
262+
``SOURCE_DATE_EPOCH`` and sets it in the execution environment of
263+
every created construction envirionment. There's also an installer
264+
script (POSIX shell only). See packaging/etc/README.txt for more details.
252265

253266
Donations
254267
=========
@@ -258,15 +271,6 @@ software, or hardware) to support continued work on the project. Information
258271
is available at https://www.scons.org/donate.html
259272
or the GitHub Sponsors button on https://github.com/scons/scons.
260273

261-
Reproducible Builds
262-
===================
263-
In order to suppor those users who which to produce reproducible builds
264-
(https://reproducible-builds.org/specs/source-date-epoch/) we're now including
265-
logic to force SCons to propagate SOURCE_DATE_EPOCH from your shell environment for
266-
all SCons builds to support reproducible builds we're now providing an example
267-
site_init.py and a script to install it in your ~/.scons. See packaging/etc/README.txt
268-
for more info
269-
270274
For More Information
271275
====================
272276

RELEASE.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY
4444
of CCFLAGS; the latter variable could cause a compiler warning.
4545
- The implementation of Variables was slightly refactored, there should
4646
not be user-visible changes.
47+
- SCons.Environment.is_valid_construction_var() now returns a boolean to
48+
match the convention that functions beginning with "is" have yes/no
49+
answers (previously returned either None or an re.match object).
50+
Now matches the annotation and docstring (which were prematurely
51+
updated in 4.6). All SCons usage except unit test was already fully
52+
consistent with a bool.
53+
- The Variables object Add method now accepts a subst keyword argument
54+
(defaults to True) which can be set to inhibit substitution prior to
55+
calling the variable's converter and validator.
56+
- AddOption and the internal add_local_option which AddOption calls now
57+
recognize a "settable" keyword argument to indicate a project-added
58+
option can also be modified using SetOption.
59+
NOTE: If you were using ninja and using SetOption() for ninja options
60+
in your SConscripts prior to loading the ninja tool, you will now
61+
see an error. The fix is to move the SetOption() to after you've loaded
62+
the ninja tool.
63+
- ListVariable now has a separate validator, with the functionality
64+
that was previously part of the converter. The main effect is to
65+
allow a developer to supply a custom validator, which previously
66+
could be inhibited by the converter failing before the validator
67+
is reached.
4768

4869
FIXES
4970
-----
@@ -52,6 +73,7 @@ FIXES
5273
- Improved the conversion of a "foreign" exception from an action
5374
into BuildError by making sure our defaults get applied even in
5475
corner cases. Fixes Issue #4530
76+
- The Clone() method now respects the variables argument (fixes #3590)
5577

5678
IMPROVEMENTS
5779
------------
@@ -76,6 +98,8 @@ DOCUMENTATION
7698
- Restructured API Docs build so main package contents are listed
7799
before contents of package submodules.
78100
- Updated manpage description of Command "builder" and function.
101+
- Updated the notes about reproducible builds with SCons and the example.
102+
- Regularized header (copyright, licens) at top of documentation files using SPDX.
79103

80104

81105

@@ -95,7 +119,14 @@ DEVELOPMENT
95119
- Repository linter/formatter changed from flake8/black to ruff, as the
96120
latter grants an insane speed boost without compromising functionality.
97121
Existing settings were migrated 1-to-1 where possible.
98-
122+
- The test runner now recognizes the unittest module's return code of 5,
123+
which means no tests were run. SCons/Script/MainTests.py currently
124+
has no tests, so this particular error code is expected - should not
125+
cause runtest to give up with an "unknown error code".
126+
- is_valid_construction_var() (not part of the public API) moved from
127+
SCons.Environment to SCons.Util to avoid the chance of import loops. Variables
128+
and Environment both use the routine and Environment() uses a Variables()
129+
object so better to move to a safer location.
99130

100131
Thanks to the following contributors listed below for their contributions to this release.
101132
==========================================================================================

SCons/Action.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright The SCons Foundation
3+
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
4+
SPDX-License-Identifier: MIT
5+
SPDX-FileType: DOCUMENTATION
46
57
This file is processed by the bin/SConsDoc.py module.
6-
See its __doc__ string for a discussion of the format.
78
-->
89

910
<!DOCTYPE sconsdoc [

SCons/Defaults.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright The SCons Foundation
3+
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
4+
SPDX-License-Identifier: MIT
5+
SPDX-FileType: DOCUMENTATION
46
57
This file is processed by the bin/SConsDoc.py module.
6-
See its __doc__ string for a discussion of the format.
78
-->
89

910
<!DOCTYPE sconsdoc [

SCons/Environment.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
to_String_for_subst,
7777
uniquer_hashables,
7878
)
79+
from SCons.Util.envs import is_valid_construction_var
7980
from SCons.Util.sctyping import ExecutorType
8081

8182
class _Null:
@@ -510,13 +511,6 @@ def update(self, mapping) -> None:
510511
self.__setitem__(i, v)
511512

512513

513-
_is_valid_var = re.compile(r'[_a-zA-Z]\w*$')
514-
515-
def is_valid_construction_var(varstr) -> bool:
516-
"""Return True if *varstr* is a legitimate construction variable."""
517-
return _is_valid_var.match(varstr)
518-
519-
520514
class SubstitutionEnvironment:
521515
"""Base class for different flavors of construction environments.
522516
@@ -605,7 +599,7 @@ def __setitem__(self, key, value):
605599
# key and we don't need to check. If we do check, using a
606600
# global, pre-compiled regular expression directly is more
607601
# efficient than calling another function or a method.
608-
if key not in self._dict and not _is_valid_var.match(key):
602+
if key not in self._dict and not is_valid_construction_var(key):
609603
raise UserError("Illegal construction variable `%s'" % key)
610604
self._dict[key] = value
611605

@@ -1568,16 +1562,28 @@ def AppendUnique(self, delete_existing: bool=False, **kw) -> None:
15681562
self._dict[key] = dk + val
15691563
self.scanner_map_delete(kw)
15701564

1571-
def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw):
1565+
def Clone(self, tools=[], toolpath=None, variables=None, parse_flags=None, **kw):
15721566
"""Return a copy of a construction Environment.
15731567
1574-
The copy is like a Python "deep copy"--that is, independent
1575-
copies are made recursively of each objects--except that
1576-
a reference is copied when an object is not deep-copyable
1577-
(like a function). There are no references to any mutable
1578-
objects in the original Environment.
1579-
"""
1568+
The copy is like a Python "deep copy": independent copies are made
1569+
recursively of each object, except that a reference is copied when
1570+
an object is not deep-copyable (like a function). There are no
1571+
references to any mutable objects in the original environment.
15801572
1573+
Unrecognized keyword arguments are taken as construction variable
1574+
assignments.
1575+
1576+
Arguments:
1577+
tools: list of tools to initialize.
1578+
toolpath: list of paths to search for tools.
1579+
variables: a :class:`~SCons.Variables.Variables` object to
1580+
use to populate construction variables from command-line
1581+
variables.
1582+
parse_flags: option strings to parse into construction variables.
1583+
1584+
.. versionadded:: 4.8.0
1585+
The optional *variables* parameter was added.
1586+
"""
15811587
builders = self._dict.get('BUILDERS', {})
15821588

15831589
clone = copy.copy(self)
@@ -1603,6 +1609,8 @@ def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw):
16031609
for key, value in kw.items():
16041610
new[key] = SCons.Subst.scons_subst_once(value, self, key)
16051611
clone.Replace(**new)
1612+
if variables:
1613+
variables.Update(clone)
16061614

16071615
apply_tools(clone, tools, toolpath)
16081616

SCons/Environment.xml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright The SCons Foundation
3+
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
4+
SPDX-License-Identifier: MIT
5+
SPDX-FileType: DOCUMENTATION
46
57
This file is processed by the bin/SConsDoc.py module.
6-
See its __doc__ string for a discussion of the format.
78
-->
89

910
<!DOCTYPE sconsdoc [
@@ -1079,11 +1080,12 @@ Clean(docdir, os.path.join(docdir, projectname))
10791080
</arguments>
10801081
<summary>
10811082
<para>
1082-
Returns a separate copy of a construction environment.
1083-
If there are any keyword arguments specified,
1084-
they are added to the returned copy,
1083+
Returns an independent copy of a &consenv;.
1084+
If there are any unrecognized keyword arguments specified,
1085+
they are added as &consvars; in the copy,
10851086
overwriting any existing values
1086-
for the keywords.
1087+
for those keywords.
1088+
See the manpage section "Construction Environments" for more details.
10871089
</para>
10881090

10891091
<para>
@@ -1096,8 +1098,9 @@ env3 = env.Clone(CCFLAGS='-g')
10961098
</example_commands>
10971099

10981100
<para>
1099-
Additionally, a list of tools and a toolpath may be specified, as in
1100-
the &f-link-Environment; constructor:
1101+
A list of <parameter>tools</parameter>
1102+
and a <parameter>toolpath</parameter> may be specified,
1103+
as in the &f-link-Environment; constructor:
11011104
</para>
11021105

11031106
<example_commands>
@@ -1110,7 +1113,7 @@ env4 = env.Clone(tools=['msvc', MyTool])
11101113
<para>
11111114
The
11121115
<parameter>parse_flags</parameter>
1113-
keyword argument is also recognized to allow merging command-line
1116+
keyword argument is also recognized, to allow merging command-line
11141117
style arguments into the appropriate construction
11151118
variables (see &f-link-env-MergeFlags;).
11161119
</para>
@@ -1119,6 +1122,17 @@ variables (see &f-link-env-MergeFlags;).
11191122
# create an environment for compiling programs that use wxWidgets
11201123
wx_env = env.Clone(parse_flags='!wx-config --cflags --cxxflags')
11211124
</example_commands>
1125+
1126+
<para>
1127+
The <parameter>variables</parameter>
1128+
keyword argument is also recognized, to allow (re)initializing
1129+
&consvars; from a <literal>Variables</literal> object.
1130+
</para>
1131+
1132+
<para>
1133+
<emphasis>Changed in version 4.8.0:</emphasis>
1134+
the <parameter>variables</parameter> parameter was added.
1135+
</para>
11221136
</summary>
11231137
</scons_function>
11241138

@@ -1760,7 +1774,7 @@ will print:
17601774
</arguments>
17611775
<summary>
17621776
<para>
1763-
Return a new construction environment
1777+
Return a new &consenv;
17641778
initialized with the specified
17651779
<parameter>key</parameter>=<replaceable>value</replaceable>
17661780
pairs.
@@ -1770,7 +1784,8 @@ The keyword arguments
17701784
<parameter>toolpath</parameter>,
17711785
<parameter>tools</parameter>
17721786
and <parameter>variables</parameter>
1773-
are also specially recognized.
1787+
are specially recognized and do not lead to
1788+
&consvar; creation.
17741789
See the manpage section "Construction Environments" for more details.
17751790
</para>
17761791
</summary>

0 commit comments

Comments
 (0)