Skip to content

Commit ef3fecf

Browse files
authored
Merge branch 'master' into maint/action-typing
2 parents 1783bd8 + 5d37479 commit ef3fecf

File tree

7 files changed

+115
-94
lines changed

7 files changed

+115
-94
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,21 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
6565
Python to 3.6, and it was not until Python 3.7 where `threading` became
6666
default supported. In practice, we expect most real world Python 3.6 deployments
6767
will have `threading` support enabled, so this will not be an issue.
68+
- CacheDir writes no longer happen within the taskmaster critical section,
69+
and therefore can run in parallel with both other CacheDir writes and the
70+
taskmaster DAG walk.
6871

6972
From Mats Wichmann:
7073
- Add support for Python 3.13 (as of alpha 2). So far only affects
7174
expected bytecodes in ActionTests.py.
75+
- sconsign cleanup - remove some dead code, minor manpage tweaks.
7276
- Be more cautious about encodings fetching command output on Windows.
7377
Problem occurs in piped-spawn scenario, used by Configure tests.
7478
Fixes #3529.
7579
- Clarify/fix documentation of Scanners in User Guide and Manpage.
7680
Fixes #4468.
7781
- Fix bad typing in Action.py: process() and strfunction().
82+
- Add Pseudo() to global functions, had been omitted. Fixes #4474.
7883

7984

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

RELEASE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ FIXES
5252
build of the project file fails.
5353
- On Windows platform, when collecting command output (Configure checks),
5454
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.
5557

5658
IMPROVEMENTS
5759
------------
@@ -63,6 +65,8 @@ IMPROVEMENTS
6365
the new scheduler is now used for -j1 builds as well.
6466
NOTE: This should significantly improve SCons performance for larger parallel builds
6567
(Larger -j values)
68+
- CacheDir writes no longer happen within the taskmaster critical section, and therefore
69+
can run in parallel with both other CacheDir writes and the taskmaster DAG walk.
6670

6771

6872
PACKAGING

SCons/Script/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ def Variables(files=None, args=ARGUMENTS):
343343
'Local',
344344
'ParseDepends',
345345
'Precious',
346+
'Pseudo',
346347
'PyPackageDir',
347348
'Repository',
348349
'Requires',

SCons/Taskmaster/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ def execute(self):
244244
SCons.Warnings.warn(SCons.Warnings.CacheCleanupErrorWarning,
245245
"Failed copying all target files from cache, Error while attempting to remove file %s retrieved from cache: %s" % (t.get_internal_path(), e))
246246
self.targets[0].build()
247+
for t in self.targets:
248+
t.push_to_cache()
247249
else:
248250
for t in cached_targets:
249251
t.cached = 1
@@ -299,8 +301,6 @@ def executed_with_callbacks(self) -> None:
299301
for side_effect in t.side_effects:
300302
side_effect.set_state(NODE_NO_STATE)
301303
t.set_state(NODE_EXECUTED)
302-
if not t.cached:
303-
t.push_to_cache()
304304
t.built()
305305
t.visited()
306306
if (not print_prepare and

SCons/Utilities/sconsign.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,6 @@ def my_whichdb(filename):
5151
return whichdb(filename)
5252

5353

54-
def my_import(mname):
55-
"""Import database module.
56-
57-
This was used if the module was *not* SCons.dblite, to allow
58-
for programmatic importing. It is no longer used, in favor of
59-
importlib.import_module, and will be removed eventually.
60-
"""
61-
import imp
62-
63-
if '.' in mname:
64-
i = mname.rfind('.')
65-
parent = my_import(mname[:i])
66-
fp, pathname, description = imp.find_module(mname[i+1:], parent.__path__)
67-
else:
68-
fp, pathname, description = imp.find_module(mname)
69-
return imp.load_module(mname, fp, pathname, description)
70-
71-
7254
class Flagger:
7355
default_value = 1
7456

@@ -449,8 +431,6 @@ def main() -> None:
449431

450432
dbm = SCons.dblite
451433
# Ensure that we don't ignore corrupt DB files,
452-
# this was handled by calling my_import('SCons.dblite')
453-
# again in earlier versions...
454434
SCons.dblite.IGNORE_CORRUPT_DBFILES = False
455435
except ImportError:
456436
sys.stderr.write("sconsign: illegal file format `%s'\n" % a)
@@ -492,8 +472,6 @@ def main() -> None:
492472

493473
dbm = SCons.dblite
494474
# Ensure that we don't ignore corrupt DB files,
495-
# this was handled by calling my_import('SCons.dblite')
496-
# again in earlier versions...
497475
SCons.dblite.IGNORE_CORRUPT_DBFILES = False
498476
Do_SConsignDB(Map_Module.get(dbm_name, dbm_name), dbm)(a)
499477
else:

doc/man/sconsign.xml

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
4-
__COPYRIGHT__
5-
6-
Permission is hereby granted, free of charge, to any person obtaining
7-
a copy of this software and associated documentation files (the
8-
"Software"), to deal in the Software without restriction, including
9-
without limitation the rights to use, copy, modify, merge, publish,
10-
distribute, sublicense, and/or sell copies of the Software, and to
11-
permit persons to whom the Software is furnished to do so, subject to
12-
the following conditions:
13-
14-
The above copyright notice and this permission notice shall be included
15-
in all copies or substantial portions of the Software.
16-
17-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
18-
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
19-
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
242

3+
<!--
4+
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
5+
SPDX-License-Identifier: MIT
256
-->
267

8+
<!DOCTYPE reference [
9+
<!ENTITY % version SYSTEM "../version.xml">
10+
%version;
11+
<!ENTITY % scons SYSTEM '../scons.mod'>
12+
%scons;
13+
]>
14+
2715
<refentry id='sconsign1'
2816
xmlns="http://www.scons.org/dbxsd/v1.0"
2917
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -48,12 +36,16 @@
4836
</refsynopsisdiv>
4937

5038

51-
<refsect1 id='description'><title>DESCRIPTION</title>
39+
<refsect1 id='description'>
40+
<title>DESCRIPTION</title>
5241
<para>
5342
Displays the contents of one or more
54-
<firstterm>sconsign files</firstterm>,
55-
the signature database files
56-
used by the <application>SCons</application> build tool.
43+
<firstterm>sconsign</firstterm> files,
44+
the signature/dependency database
45+
used by the &SCons; build tool.
46+
The database contains all Nodes that are known to the build,
47+
either by declaration in the build configuration,
48+
produced as side effects, or detected by inspection.
5749
</para>
5850

5951
<para>By default,
@@ -64,26 +56,40 @@ Without options,
6456
individual dependency entries are printed in the following format:</para>
6557

6658
<screen>
67-
depfile: signature timestamp length
68-
implicit_dependency_1: content_signature timestamp length
69-
implicit_dependency_2: content_signature timestamp length
59+
depfile: content-signature timestamp length
60+
implicit-dependency-1: content-signature timestamp length
61+
implicit-dependency-2: content-signature timestamp length
7062
...
71-
action_signature [action string]
63+
build-signature [action-string]
7264
</screen>
7365

74-
<para><emphasis role="bold">None</emphasis>
66+
<para>
67+
<emphasis role="bold">content-signature</emphasis>
68+
is the hash of the file's contents (<firstterm>csig</firstterm>)
69+
and <emphasis role="bold">build-signature</emphasis>
70+
is the hash of the command line or other build action
71+
used to build a target (<firstterm>bactsig</firstterm>).
72+
If provided,
73+
<emphasis role="bold">action-string</emphasis>
74+
is the unexpanded string action or the function called.
75+
<emphasis role="bold">None</emphasis>
7576
is printed in place of any missing timestamp,
76-
<firstterm>content signature</firstterm>
77-
(<emphasis role="bold">csig</emphasis>)
78-
or
79-
<firstterm>build action signature</firstterm>
80-
values for any entry
81-
or any of its dependencies.
77+
<emphasis role="bold">csig</emphasis>,
78+
or <emphasis role="bold">bactsig</emphasis>
79+
values for any entry or any of its dependencies.
8280
If the entry has no implicit dependencies,
8381
or no build action,
84-
those lines are omitted.</para>
82+
the corresponding lines are omitted.
83+
</para>
8584

86-
<para>By default,
85+
<para>
86+
An indicator line is printed for each directory,
87+
as directories do not have signatures in the database
88+
and so would not otherwise be shown.
89+
</para>
90+
91+
<para>
92+
By default,
8793
<command>sconsign</command>
8894
assumes that any
8995
<replaceable>file</replaceable>
@@ -92,14 +98,13 @@ arguments that end with a
9298
suffix contains
9399
signature entries for
94100
more than one directory
95-
(that is,
96-
was specified by the
101+
(that is, was specified by the
97102
<function>SConsignFile</function>
98-
function).
103+
&SCons; function).
99104
Any
100105
<replaceable>file</replaceable>
101106
argument that has no suffix
102-
is assumed to be an old-style
107+
is assumed to be an old-style (deprecated)
103108
sconsign file containing the signature entries
104109
for a single directory.
105110
If neither of those is true,
@@ -299,7 +304,8 @@ for all entries or the specified entries.</para>
299304
<refsect1 id='see_also'>
300305
<title>SEE ALSO</title>
301306
<para>
302-
<command>scons</command>,
307+
The &SCons; reference (manpage) at
308+
<ulink url="https://scons.org/doc/production/HTML/scons-man.html"/>,
303309
the SCons User Guide at
304310
<ulink url="https://scons.org/doc/production/HTML/scons-user.html"/>,
305311
the SCons source code

test/Pseudo.py

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python
22
#
3-
# __COPYRIGHT__
3+
# MIT License
4+
#
5+
# Copyright The SCons Foundation
46
#
57
# Permission is hereby granted, free of charge, to any person obtaining
68
# a copy of this software and associated documentation files (the
@@ -20,41 +22,66 @@
2022
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2123
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2224
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23-
#
2425

25-
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26+
"""
27+
Test the Pseudo method
28+
"""
2629

2730
import TestSCons
2831

2932
test = TestSCons.TestSCons()
3033

31-
# Firstly, build a pseudo target and make sure we get no warnings it
32-
# doesn't exist under any circumstances
33-
test.write('SConstruct', """
34+
test.write('SConstruct', """\
3435
env = Environment()
35-
env.Pseudo(env.Command('foo.out', [], '@echo boo'))
36-
""")
37-
38-
test.run(arguments='-Q', stdout = 'boo\n')
36+
foo = env.Command('foo.out', [], '@echo boo')
37+
bar = env.Command('bar.out', [], Touch('$TARGET'))
38+
env.Pseudo(foo, bar)
3939
40-
test.run(arguments='-Q --warning=target-not-built', stdout = "boo\n")
41-
42-
# Now do the same thing again but create the target and check we get an
43-
# error if it exists after the build
44-
test.write('SConstruct', """
45-
env = Environment()
46-
env.Pseudo(env.Command('foo.out', [], Touch('$TARGET')))
40+
gfoo = Command('foo.glb', [], '@echo boo')
41+
gbar = Command('bar.glb', [], Touch('$TARGET'))
42+
Pseudo(gfoo, gbar)
4743
""")
4844

49-
test.run(arguments='-Q', stdout = 'Touch("foo.out")\n', stderr = None,
50-
status = 2)
51-
test.must_contain_all_lines(test.stderr(),
52-
'scons: *** Pseudo target foo.out must not exist')
53-
test.run(arguments='-Q --warning=target-not-built',
54-
stdout = 'Touch("foo.out")\n',
55-
stderr = None, status = 2)
56-
test.must_contain_all_lines(test.stderr(),
57-
'scons: *** Pseudo target foo.out must not exist')
45+
# foo.out build does not create file, should generate no errors
46+
test.run(arguments='-Q foo.out', stdout='boo\n')
47+
# missing target warning triggers if requested
48+
test.run(arguments='-Q foo.out --warning=target-not-built', stdout="boo\n")
49+
# bar.out build creates file, error if it exists after the build
50+
test.run(arguments='-Q bar.out', stdout='Touch("bar.out")\n', stderr=None, status=2)
51+
test.must_contain_all_lines(
52+
test.stderr(),
53+
'scons: *** Pseudo target bar.out must not exist',
54+
)
55+
# warning must not appear since target created
56+
test.run(
57+
arguments='-Q bar.out --warning=target-not-built',
58+
stdout='Touch("bar.out")\n',
59+
stderr=None,
60+
status=2,
61+
)
62+
test.must_contain_all_lines(
63+
test.stderr(),
64+
'scons: *** Pseudo target bar.out must not exist',
65+
)
66+
67+
# repeat the process for the global function form (was missing initially)
68+
test.run(arguments='-Q foo.glb', stdout='boo\n')
69+
test.run(arguments='-Q foo.glb --warning=target-not-built', stdout="boo\n")
70+
test.run(arguments='-Q bar.glb', stdout='Touch("bar.glb")\n', stderr=None, status=2)
71+
test.must_contain_all_lines(
72+
test.stderr(),
73+
'scons: *** Pseudo target bar.glb must not exist',
74+
)
75+
test.run(
76+
arguments='-Q bar.glb --warning=target-not-built',
77+
stdout='Touch("bar.glb")\n',
78+
stderr=None,
79+
status=2,
80+
)
81+
test.must_contain_all_lines(
82+
test.stderr(),
83+
'scons: *** Pseudo target bar.glb must not exist',
84+
)
5885

5986
test.pass_test()
6087

0 commit comments

Comments
 (0)