Skip to content

Commit 2b73157

Browse files
authored
Merge pull request SCons#4475 from mwichmann/bug/Pseudo
Add Pseudo() to global functions, had been omitted.
2 parents 14a5f6f + 4d09987 commit 2b73157

File tree

4 files changed

+57
-26
lines changed

4 files changed

+57
-26
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
7777
Fixes #3529.
7878
- Clarify/fix documentation of Scanners in User Guide and Manpage.
7979
Fixes #4468.
80+
- Add Pseudo() to global functions, had been omitted. Fixes #4474.
8081

8182

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

RELEASE.txt

Lines changed: 2 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
------------

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',

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)