summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-07-18 16:37:27 (GMT)
committerJoseph Brill <48932340+jcbrill@users.noreply.github.com>2022-07-18 16:37:27 (GMT)
commitda2f846558168674f045f86c1d2fe45acce62276 (patch)
tree805dde1569c2cba19ba04247462be3489a0b1b9b
parente99127b30bbbba727deb804feacb38b65c71874f (diff)
parentc9100308647861f69b567f86b997f4862789e627 (diff)
downloadSCons-da2f846558168674f045f86c1d2fe45acce62276.zip
SCons-da2f846558168674f045f86c1d2fe45acce62276.tar.gz
SCons-da2f846558168674f045f86c1d2fe45acce62276.tar.bz2
Merge branch 'master' into jbrill-msvc-batchargs
-rwxr-xr-xCHANGES.txt3
-rw-r--r--SCons/cpp.py3
-rw-r--r--SCons/cppTests.py8
-rw-r--r--requirements.txt2
-rw-r--r--test/Errors/Exception.py9
-rw-r--r--test/Errors/InternalError.py9
-rw-r--r--test/GetBuildFailures/serial.py9
-rw-r--r--test/exceptions.py49
-rw-r--r--test/option/debug-stacktrace.py52
-rw-r--r--testing/framework/TestCommonTests.py2
10 files changed, 60 insertions, 86 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index baf9e68..ae4a4a9 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -256,6 +256,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Added MSVC_USE_SCRIPT_ARGS variable to pass arguments to MSVC_USE_SCRIPT.
- Added Configure.CheckMember() checker to check if struct/class has the specified member.
+ From Ivan Kravets, PlatformIO:
+ - Conditional C/C++ Preprocessor: Strip shell's backslashes from the computed include (-DFOO_H=\"foo.h\")
+
RELEASE 4.3.0 - Tue, 16 Nov 2021 18:12:46 -0700
From Jacob Cassagnol:
diff --git a/SCons/cpp.py b/SCons/cpp.py
index 353aa70..144f498 100644
--- a/SCons/cpp.py
+++ b/SCons/cpp.py
@@ -591,6 +591,9 @@ class PreProcessor:
while not s[0] in '<"':
try:
s = self.cpp_namespace[s]
+ # strip backslashes from the computed include (-DFOO_H=\"foo.h\")
+ for c in '<">':
+ s = s.replace(f"\\{c}", c)
except KeyError:
m = function_name.search(s)
diff --git a/SCons/cppTests.py b/SCons/cppTests.py
index f20c302..f781e81 100644
--- a/SCons/cppTests.py
+++ b/SCons/cppTests.py
@@ -55,6 +55,8 @@ substitution_input = """
#include XXX_FILE5
#include XXX_FILE6
+
+#include SHELL_ESCAPED_H
"""
@@ -441,7 +443,8 @@ if_no_space_input = """
class cppTestCase(unittest.TestCase):
def setUp(self):
self.cpp = self.cpp_class(current = ".",
- cpppath = ['/usr/include'])
+ cpppath = ['/usr/include'],
+ dict={"SHELL_ESCAPED_H": '\\"file-shell-computed-yes\\"'})
def test_basic(self):
"""Test basic #include scanning"""
@@ -531,6 +534,7 @@ class cppAllTestCase(cppTestCase):
def setUp(self):
self.cpp = self.cpp_class(current = ".",
cpppath = ['/usr/include'],
+ dict={"SHELL_ESCAPED_H": '\\"file-shell-computed-yes\\"'},
all=1)
class PreProcessorTestCase(cppAllTestCase):
@@ -546,6 +550,7 @@ class PreProcessorTestCase(cppAllTestCase):
('include', '<', 'file4-yes'),
('include', '"', 'file5-yes'),
('include', '<', 'file6-yes'),
+ ('include', '"', 'file-shell-computed-yes'),
]
ifdef_expect = [
@@ -647,6 +652,7 @@ class DumbPreProcessorTestCase(cppAllTestCase):
('include', '<', 'file4-yes'),
('include', '"', 'file5-yes'),
('include', '<', 'file6-yes'),
+ ('include', '"', 'file-shell-computed-yes'),
]
ifdef_expect = [
diff --git a/requirements.txt b/requirements.txt
index e05c610..133b5bd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@ sphinx_rtd_theme
rst2pdf
# for now keep pinning "known working" lxml,
# it's been a troublesome component in the past.
-lxml==4.7.1
+lxml==4.9.1
rst2pdf
ninja
diff --git a/test/Errors/Exception.py b/test/Errors/Exception.py
index c08a09e..cdd6a3c 100644
--- a/test/Errors/Exception.py
+++ b/test/Errors/Exception.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
@@ -53,7 +52,7 @@ test.write('exit.in', 'exit\n')
# so make sure the proper variations are supported in the following
# regexp.
expect = r"""scons: \*\*\* \[exit.out\] Exception : exit
-Traceback \((most recent call|innermost) last\):
+Traceback \(most recent call last\):
( File ".+", line \d+, in \S+
[^\n]+
)*( File ".+", line \d+, in \S+
diff --git a/test/Errors/InternalError.py b/test/Errors/InternalError.py
index a709597..d37178e 100644
--- a/test/Errors/InternalError.py
+++ b/test/Errors/InternalError.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Verify the exit status and error output if an SConstruct file
@@ -41,7 +40,7 @@ raise InternalError('error inside')
""")
test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n",
- stderr = r"""Traceback \((most recent call|innermost) last\):
+ stderr = r"""Traceback \(most recent call last\):
File ".+", line \d+, in .+
File ".+", line \d+, in .+
File ".+", line \d+, in .+
diff --git a/test/GetBuildFailures/serial.py b/test/GetBuildFailures/serial.py
index 4aecc12..ab8fbb5 100644
--- a/test/GetBuildFailures/serial.py
+++ b/test/GetBuildFailures/serial.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,7 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
"""
Verify that the GetBuildFailures() function returns a list of
@@ -28,8 +29,6 @@ BuildError exceptions. Also verify printing the BuildError
attributes we expect to be most commonly used.
"""
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
import TestSCons
import re
@@ -196,7 +195,7 @@ scons: *** [f12] f12: My SConsEnvironmentError
scons: *** [f13] f13: My SConsEnvironmentError
scons: *** [f14] InternalError : My InternalError
""") + \
-r"""Traceback \((most recent call|innermost) last\):
+r"""Traceback \(most recent call last\):
( File ".+", line \d+, in \S+
[^\n]+
)*( File ".+", line \d+, in \S+
diff --git a/test/exceptions.py b/test/exceptions.py
index 79d869c..842959a 100644
--- a/test/exceptions.py
+++ b/test/exceptions.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import re
@@ -37,17 +36,18 @@ SConstruct_path = test.workpath('SConstruct')
test.write(SConstruct_path, """\
def func(source = None, target = None, env = None):
raise Exception("func exception")
-B = Builder(action = func)
-env = Environment(BUILDERS = { 'B' : B })
-env.B(target = 'foo.out', source = 'foo.in')
+B = Builder(action=func)
+env = Environment(BUILDERS={'B': B})
+env.B(target='foo.out', source='foo.in')
""")
test.write('foo.in', "foo.in\n")
expected_stderr = r"""scons: \*\*\* \[foo.out\] Exception : func exception
-Traceback \((most recent call|innermost) last\):
+Traceback \(most recent call last\):
( File ".+", line \d+, in \S+
[^\n]+
+ [^\n]+
)*( File ".+", line \d+, in \S+
)*( File ".+", line \d+, in \S+
[^\n]+
@@ -56,10 +56,8 @@ Traceback \((most recent call|innermost) last\):
Exception: func exception
""" % re.escape(SConstruct_path)
-test.run(arguments = "foo.out", stderr = expected_stderr, status = 2)
-
-test.run(arguments = "-j2 foo.out", stderr = expected_stderr, status = 2)
-
+test.run(arguments="foo.out", stderr=expected_stderr, status=2)
+test.run(arguments="-j2 foo.out", stderr=expected_stderr, status=2)
# Verify that exceptions caused by exit values of builder actions are
# correctly signalled, for both Serial and Parallel jobs.
@@ -70,29 +68,28 @@ sys.exit(1)
""")
test.write(SConstruct_path, """
-Fail = Builder(action = r'%(_python_)s myfail.py $TARGETS $SOURCE')
-env = Environment(BUILDERS = { 'Fail' : Fail })
-env.Fail(target = 'out.f1', source = 'in.f1')
+Fail = Builder(action=r'%(_python_)s myfail.py $TARGETS $SOURCE')
+env = Environment(BUILDERS={'Fail': Fail})
+env.Fail(target='out.f1', source='in.f1')
""" % locals())
test.write('in.f1', "in.f1\n")
expected_stderr = "scons: \\*\\*\\* \\[out.f1\\] Error 1\n"
-test.run(arguments = '.', status = 2, stderr = expected_stderr)
-test.run(arguments = '-j2 .', status = 2, stderr = expected_stderr)
-
+test.run(arguments='.', status=2, stderr=expected_stderr)
+test.run(arguments='-j2 .', status=2, stderr=expected_stderr)
# Verify that all exceptions from simultaneous tasks are reported,
# even if the exception is raised during the Task.prepare()
# [Node.prepare()]
test.write(SConstruct_path, """
-Fail = Builder(action = r'%(_python_)s myfail.py $TARGETS $SOURCE')
-env = Environment(BUILDERS = { 'Fail' : Fail })
-env.Fail(target = 'out.f1', source = 'in.f1')
-env.Fail(target = 'out.f2', source = 'in.f2')
-env.Fail(target = 'out.f3', source = 'in.f3')
+Fail = Builder(action=r'%(_python_)s myfail.py $TARGETS $SOURCE')
+env = Environment(BUILDERS={'Fail': Fail})
+env.Fail(target='out.f1', source='in.f1')
+env.Fail(target='out.f2', source='in.f2')
+env.Fail(target='out.f3', source='in.f3')
""" % locals())
# in.f2 is not created to cause a Task.prepare exception
@@ -100,7 +97,7 @@ test.write('in.f1', 'in.f1\n')
test.write('in.f3', 'in.f3\n')
# In Serial task mode, get the first exception and stop
-test.run(arguments = '.', status = 2, stderr = expected_stderr)
+test.run(arguments='.', status=2, stderr=expected_stderr)
# In Parallel task mode, we will get all three exceptions.
@@ -117,11 +114,9 @@ expected_stderr_list = [
# walk of '.' and are already considered up-to-date when we kick off the
# "simultaneous" builds of the output (target) files.
-test.run(arguments = '-j7 -k .', status = 2, stderr = None)
-
+test.run(arguments='-j7 -k .', status=2, stderr=None)
test.must_contain_all_lines(test.stderr(), expected_stderr_list)
-
test.pass_test()
# Local Variables:
diff --git a/test/option/debug-stacktrace.py b/test/option/debug-stacktrace.py
index 490fecf..f0f92c1 100644
--- a/test/option/debug-stacktrace.py
+++ b/test/option/debug-stacktrace.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
#
-# __COPYRIGHT__
+# MIT License
+#
+# Copyright The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -20,9 +22,6 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Test the --debug=stacktrace option.
@@ -34,37 +33,27 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """\
DefaultEnvironment(tools=[])
+
def kfile_scan(node, env, target):
raise Exception("kfile_scan error")
-kscan = Scanner(name = 'kfile',
- function = kfile_scan,
- skeys = ['.k'])
-
+kscan = Scanner(name='kfile', function=kfile_scan, skeys=['.k'])
env = Environment(tools=[])
env.Append(SCANNERS = [kscan])
env.Command('foo', 'foo.k', Copy('$TARGET', '$SOURCE'))
""")
-
test.write('foo.k', "foo.k\n")
test.run(status = 2, stderr = "scons: *** [foo] Exception : kfile_scan error\n")
-
-test.run(arguments = "--debug=stacktrace",
- status = 2,
- stderr = None)
-
+test.run(arguments="--debug=stacktrace", status=2, stderr=None)
lines = [
"scons: *** [foo] Exception : kfile_scan error",
"scons: internal stack trace:",
'raise Exception("kfile_scan error")',
]
-
test.must_contain_all_lines(test.stderr(), lines)
-
-
# Test that --debug=stacktrace works for UserError exceptions,
# which are handled by different code than other exceptions.
@@ -73,25 +62,14 @@ import SCons.Errors
raise SCons.Errors.UserError("explicit UserError!")
""")
-test.run(arguments = '--debug=stacktrace',
- status = 2,
- stderr = None)
-
+test.run(arguments='--debug=stacktrace', status=2, stderr=None)
user_error_lines = [
'UserError: explicit UserError!',
'scons: *** explicit UserError!',
]
-
-# The "(most recent call last)" message is used by more recent Python
-# versions than the "(innermost last)" message, so that's the one
-# we report if neither matches.
-traceback_lines = [
- "Traceback (most recent call last)",
- "Traceback (innermost last)",
-]
-
+traceback_lines = ["Traceback (most recent call last)",]
test.must_contain_all_lines(test.stderr(), user_error_lines)
-test.must_contain_any_line(test.stderr(), traceback_lines)
+test.must_contain_all_lines(test.stderr(), traceback_lines)
# Test that full path names to SConscript files show up in stack traces.
@@ -99,18 +77,10 @@ test.write('SConstruct', """\
1/0
""")
-test.run(arguments = '--debug=stacktrace',
- status = 2,
- stderr = None)
-
-lines = [
- ' File "%s", line 1:' % test.workpath('SConstruct'),
-]
-
+test.run(arguments='--debug=stacktrace', status=2, stderr=None)
+lines = [' File "%s", line 1:' % test.workpath('SConstruct'),]
test.must_contain_all_lines(test.stderr(), lines)
-
-
test.pass_test()
# Local Variables:
diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py
index c8ea130..1f8db42 100644
--- a/testing/framework/TestCommonTests.py
+++ b/testing/framework/TestCommonTests.py
@@ -1943,7 +1943,7 @@ class run_TestCase(TestCommonTestCase):
expect_stderr = lstrip("""\
Exception trying to execute: \\[%s, '[^']*pass'\\]
- Traceback \\((innermost|most recent call) last\\):
+ Traceback \\(most recent call last\\):
File "<stdin>", line \\d+, in (\\?|<module>)
File "[^"]+TestCommon.py", line \\d+, in run
TestCmd.run\\(self, \\*\\*kw\\)