From 961ddffc1f598e37c1cf1e1316d6a79ae7d99fcc Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 11 Feb 2023 09:40:40 -0700 Subject: Tweak pseudo-builder in user guide [skip appveyor] Minor fiddling - example format, headers, wordings tweaks Signed-off-by: Mats Wichmann --- doc/user/add-method.xml | 73 ++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index 7b5200e..86297de 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -1,4 +1,10 @@ + + %scons; @@ -18,43 +24,17 @@ xmlns="http://www.scons.org/dbxsd/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd"> -Extending &SCons;: Pseudo-Builders and the AddMethod function - - +Extending &SCons;: Pseudo-Builders and the AddMethod function - The &AddMethod; function is used to add a method - to an environment. It's typically used to add a "pseudo-builder," - a function that looks like a &Builder; but - wraps up calls to multiple other &Builder;s + The &f-link-AddMethod; function is used to add a method + to an environment. It is typically used to add a "pseudo-builder," + a function that looks like a Builder but + wraps up calls to multiple other Builder's or otherwise processes its arguments - before calling one or more &Builder;s. + before calling one or more Builders. In the following example, we want to install the program into the standard /usr/bin directory hierarchy, @@ -69,10 +49,11 @@ def install_in_bin_dirs(env, source): """Install source in both bin dirs""" i1 = env.Install("$BIN", source) i2 = env.Install("$LOCALBIN", source) - return [i1[0], i2[0]] # Return a list, like a normal builder + return [i1[0], i2[0]] # Return a list, like a normal builder + env = Environment(BIN='__ROOT__/usr/bin', LOCALBIN='#install/bin') env.AddMethod(install_in_bin_dirs, "InstallInBinDirs") -env.InstallInBinDirs(Program('hello.c')) # installs hello in both bin dirs +env.InstallInBinDirs(Program('hello.c')) # installs hello in both bin dirs int main() { printf("Hello, world!\n"); } @@ -89,31 +70,35 @@ int main() { printf("Hello, world!\n"); } - As mentioned, a pseudo-builder also provides more flexibility - in parsing arguments than you can get with a &Builder;. + A pseudo-builder is useful because it provides more flexibility + in parsing arguments than you can get with a standard Builder method. The next example shows a pseudo-builder with a named argument that modifies the filename, and a separate argument for the resource file (rather than having the builder figure it out by file extension). This example also demonstrates using the global &AddMethod; function to add a method to the global Environment class, - so it will be used in all subsequently created environments. + so it will be available in all subsequently created environments. -def BuildTestProg(env, testfile, resourcefile, testdir="tests"): - """Build the test program; - prepends "test_" to src and target, - and puts target into testdir.""" - srcfile = "test_%s.c" % testfile - target = "%s/test_%s" % (testdir, testfile) - if env['PLATFORM'] == 'win32': +def BuildTestProg(env, testfile, resourcefile="", testdir="tests"): + """Build the test program. + + Prepends "test_" to src and target and puts the target into testdir. + If the build is running on Windows, also make use of a resource file, + if supplied. + """ + srcfile = f"test_{testfile}.c" + target = f"{testdir}/test_{testfile}" + if env['PLATFORM'] == 'win32' and resourcefile: resfile = env.RES(resourcefile) p = env.Program(target, [srcfile, resfile]) else: p = env.Program(target, srcfile) return p + AddMethod(Environment, BuildTestProg) env = Environment() -- cgit v0.12 From cdd4bb3ec9f665c13473792ee0f5f34f1261c76d Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 21 Feb 2023 08:59:41 -0700 Subject: Restore markup of Builder in PR 4299 [skip appveyor] The add-method chapter now has entity references to &Builder; back. The markup for &Builder; is changed from to , as used it's a concept, and there is no actual class named Builder anyway. Signed-off-by: Mats Wichmann --- doc/scons.mod | 4 ++-- doc/user/add-method.xml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/scons.mod b/doc/scons.mod index ea1decc..ebe0e6f 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -100,7 +100,7 @@ CommandAction"> FunctionAction"> ListAction"> -Builder"> +Builder"> BuilderBase"> CompositeBuilder"> MultiStepBuilder"> @@ -110,7 +110,7 @@ Parallel"> Node"> Node.FS"> -Scanner"> +Scanner"> Sig"> Signature"> Taskmaster"> diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index 86297de..d25ba9a 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -31,10 +31,10 @@ Copyright The SCons Foundation The &f-link-AddMethod; function is used to add a method to an environment. It is typically used to add a "pseudo-builder," - a function that looks like a Builder but - wraps up calls to multiple other Builder's + a function that looks like a &Builder; but + wraps up calls to multiple other &Builder;'s or otherwise processes its arguments - before calling one or more Builders. + before calling one or more &Builder;s. In the following example, we want to install the program into the standard /usr/bin directory hierarchy, @@ -71,7 +71,7 @@ int main() { printf("Hello, world!\n"); } A pseudo-builder is useful because it provides more flexibility - in parsing arguments than you can get with a standard Builder method. + in parsing arguments than you can get with a standard &Builder;. The next example shows a pseudo-builder with a named argument that modifies the filename, and a separate argument for the resource file (rather than having the builder figure it out -- cgit v0.12 From 959e35788a8a6aa418c97cb55221c70b9cc15fe5 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 22 Feb 2023 09:43:58 -0700 Subject: User Guide fixups [skip appveyor] For add-method chapter, plus the following scanners chapter, normalize usage a little: the first mention in any given section uses the marked-up form &Builder; and &Scanner;, which contain index references, subsequent ones do not. Only references to Scanner as a concept are capitalized, things like "scanner function" were left alone. Signed-off-by: Mats Wichmann --- doc/user/add-method.xml | 4 ++-- doc/user/scanners.xml | 62 ++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index d25ba9a..7c59bf2 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -32,9 +32,9 @@ Copyright The SCons Foundation The &f-link-AddMethod; function is used to add a method to an environment. It is typically used to add a "pseudo-builder," a function that looks like a &Builder; but - wraps up calls to multiple other &Builder;'s + wraps up calls to multiple other Builders or otherwise processes its arguments - before calling one or more &Builder;s. + before calling one or more Builders. In the following example, we want to install the program into the standard /usr/bin directory hierarchy, diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index b9a5084..1e22342 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -146,15 +146,16 @@ over the file scanning rather than being called for each input line: - &SCons; has built-in scanners that know how to look in + &SCons; has routines that know how to look in C/C++, Fortran, D, IDL, LaTeX, Python and SWIG source files for information about - other files that targets built from those files depend on--for example, - in the case of files that use the C preprocessor, + other files that targets built from those files depend on - + for example, in the case of files that use the C preprocessor, the .h files that are specified using #include lines in the source. + Such a routine is called a &Scanner;. You can use the same mechanisms that &SCons; uses to create - its built-in scanners to write scanners of your own for file types + its built-in Scanners to write Scanners of your own for file types that &SCons; does not know how to scan "out of the box." @@ -164,7 +165,7 @@ over the file scanning rather than being called for each input line: - Suppose, for example, that we want to create a simple scanner + Suppose, for example, that we want to create a simple &Scanner; for .foo files. A .foo file contains some text that will be processed, @@ -183,7 +184,7 @@ include filename.foo Scanning a file will be handled by a Python function that you must supply. Here is a function that will use the Python - re module + re module to scan for the include lines in our example: @@ -203,7 +204,7 @@ def kfile_scan(node, env, path, arg): It is important to note that you have to return a list of File nodes from the scanner function, simple strings for the file names won't do. As in the examples we are showing here, - you can use the &File; + you can use the &f-link-File; function of your current &consenv; in order to create nodes on the fly from a sequence of file names with relative paths. @@ -225,7 +226,7 @@ def kfile_scan(node, env, path, arg): - node + node @@ -233,8 +234,8 @@ def kfile_scan(node, env, path, arg): An &SCons; node object representing the file being scanned. The path name to the file can be used by converting the node to a string - using the str() function, - or an internal &SCons; get_text_contents() + using the str function, + or an internal &SCons; get_text_contents object method can be used to fetch the contents. @@ -242,7 +243,7 @@ def kfile_scan(node, env, path, arg): - env + env @@ -256,13 +257,13 @@ def kfile_scan(node, env, path, arg): - path + path A list of directories that form the search path for included files - for this scanner. + for this Scanner. This is how &SCons; handles the &cv-link-CPPPATH; and &cv-link-LIBPATH; variables. @@ -271,7 +272,7 @@ def kfile_scan(node, env, path, arg): - arg + arg @@ -288,10 +289,10 @@ def kfile_scan(node, env, path, arg): - A Scanner object is created using the &f-link-Scanner; function, + A scanner object is created using the &f-link-Scanner; function, which typically takes an skeys argument - to associate a file suffix with this scanner. - The Scanner object must then be associated with the + to associate a file suffix with this Scanner. + The scanner object must then be associated with the &cv-link-SCANNERS; &consvar; in the current &consenv;, typically by using the &f-link-Append; method: @@ -320,7 +321,6 @@ def kfile_scan(node, env, path): return env.File(includes) kscan = Scanner(function=kfile_scan, skeys=['.k']) - env = Environment(ENV={'PATH': '__ROOT__/usr/local/bin'}) env.Append(SCANNERS=kscan) @@ -364,21 +364,21 @@ cat
- Adding a search path to a scanner: &FindPathDirs; + Adding a search path to a Scanner: &FindPathDirs; If the build tool in question will use a path variable to search - for included files or other dependencies, then the Scanner will + for included files or other dependencies, then the &Scanner; will need to take that path variable into account as well - &cv-link-CPPPATH; and &cv-link-LIBPATH; are used this way, for example. The path to search is passed to your - scanner as the path argument. Path variables + Scanner as the path argument. Path variables may be lists of nodes, semicolon-separated strings, or even contain &consvars; which need to be expanded. &SCons; provides the &f-link-FindPathDirs; function which returns a callable to expand a given path (given as a SCons &consvar; - name) to a list of paths at the time the scanner is called. + name) to a list of paths at the time the Scanner is called. Deferring evaluation until that point allows, for instance, the path to contain &cv-link-TARGET; references which differ for each file scanned. @@ -390,7 +390,7 @@ cat Using &FindPathDirs; is quite easy. Continuing the above example, using KPATH as the &consvar; with the search path (analogous to &cv-link-CPPPATH;), we just modify the call to - the &Scanner; factory function to include a path keyword arg: + the &f-link-Scanner; factory function to include a path keyword arg: @@ -404,7 +404,7 @@ kscan = Scanner(function=kfile_scan, skeys=['.k'], path_function=FindPathDirs('K &FindPathDirs; returns a callable object that, when called, will essentially expand the elements in env['KPATH'] - and tell the scanner to search in those dirs. It will also properly + and tell the Scanner to search in those dirs. It will also properly add related repository and variant dirs to the search list. As a side note, the returned method stores the path in an efficient way so lookups are fast even when variable substitutions may be needed. @@ -418,9 +418,9 @@ kscan = Scanner(function=kfile_scan, skeys=['.k'], path_function=FindPathDirs('K - One approach for introducing scanners into the build is in - conjunction with a Builder. There are two relvant optional - parameters we can use when creating a builder: + One approach for introducing a &Scanner; into the build is in + conjunction with a &Builder;. There are two relvant optional + parameters we can use when creating a Builder: source_scanner and target_scanner. source_scanner is used for scanning @@ -459,16 +459,16 @@ env.Foo('file') An emitter function can modify the list of sources or targets - passed to the action function when the builder is triggered. + passed to the action function when the Builder is triggered. A scanner function will not affect the list of sources or targets - seen by the builder during the build action. The scanner function - will however affect if the builder should rebuild (if any of - the files sourced by the scanner have changed for example). + seen by the Builder during the build action. The scanner function + will however affect if the Builder should rebuild (if any of + the files sourced by the Scanner have changed for example).
-- cgit v0.12 From 7923bb984986831f6696ae966e3297cce7e96316 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 23 Feb 2023 10:15:26 -0700 Subject: UGuide; tweak Scanner intro again [skip appveyor] Put back the previous wording, now with glossary entry that also defines the plural form Scanners (there is still no actual glossary) Signed-off-by: Mats Wichmann --- doc/scons.mod | 13 ++++++++++--- doc/user/builders-writing.xml | 3 ++- doc/user/scanners.xml | 3 +-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/scons.mod b/doc/scons.mod index ebe0e6f..2d3f5a4 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -92,15 +92,23 @@ zip"> + +Action"> +Builder"> +Builders"> +Scanner"> +Scanners"> + + -Action"> ActionBase"> BuildInfo"> CommandAction"> FunctionAction"> ListAction"> -Builder"> BuilderBase"> CompositeBuilder"> MultiStepBuilder"> @@ -110,7 +118,6 @@ Parallel"> Node"> Node.FS"> -Scanner"> Sig"> Signature"> Taskmaster"> diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index a53e70e..97ca36f 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -222,13 +222,14 @@ hello.c To be able to use both our own defined &Builder; objects and the default &Builder; objects in the same &consenv;, you can either add to the &cv-link-BUILDERS; variable - using the &Append; function: + using the &f-link-Append; function:
import os + env = Environment() env.AppendENVPath('PATH', os.getcwd()) bld = Builder(action='foobuild < $SOURCE > $TARGET') diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index 1e22342..9a0a1d3 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -146,14 +146,13 @@ over the file scanning rather than being called for each input line: - &SCons; has routines that know how to look in + &SCons; has built-in &Scanners; that know how to look in C/C++, Fortran, D, IDL, LaTeX, Python and SWIG source files for information about other files that targets built from those files depend on - for example, in the case of files that use the C preprocessor, the .h files that are specified using #include lines in the source. - Such a routine is called a &Scanner;. You can use the same mechanisms that &SCons; uses to create its built-in Scanners to write Scanners of your own for file types that &SCons; does not know how to scan "out of the box." -- cgit v0.12 From aed512b9626a44e19b0368f241ca504cffa01a22 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 11 Nov 2021 15:12:01 -0700 Subject: Use pathlib in runtest In the past, there have been some mismatches between how tests are specified and how they are found. testlist files, excludelist files and command-line specifications should be agnostic to operating system conventions. For example, typing "runtest.py foo/bar" on windows will produce paths like foo/bar\test.py, which is hard to match and painful to read, it should obviously match discovered foo\bar\test.py. Test information should be output using the native path separator for consistency. Using pathlib lets these be normalized - stored in a common format and output in the expected format. Adding this normalization of course broke some tests, which either intentionally or through omission expected some portion of a path to be UNIX-style. Specifically these five: test\runtest\baseline\fail.py test\runtest\baseline\no_result.py test\runtest\simple\fail.py test\runtest\simple\no_result.py test\runtest\simple\pass.py test\runtest\testargv.py This was fixed and a general cleanup/reformat performed on the runtest tests. Signed-off-by: Mats Wichmann --- CHANGES.txt | 2 + runtest.py | 126 ++++++++++++++++++------------------- test/runtest/SCons.py | 17 +++-- test/runtest/baseline/combined.py | 29 ++++----- test/runtest/baseline/fail.py | 27 ++++---- test/runtest/baseline/no_result.py | 38 ++++++----- test/runtest/baseline/pass.py | 17 +++-- test/runtest/faillog.py | 17 +++-- test/runtest/no_faillog.py | 26 ++++---- test/runtest/print_time.py | 28 ++++----- test/runtest/python.py | 25 ++++---- test/runtest/retry.py | 22 ++++--- test/runtest/simple/combined.py | 28 ++++----- test/runtest/simple/fail.py | 25 ++++---- test/runtest/simple/no_result.py | 31 +++++---- test/runtest/simple/pass.py | 18 +++--- test/runtest/testargv.py | 42 ++++++------- test/runtest/testlistfile.py | 24 +++---- test/runtest/xml/output.py | 32 ++++------ 19 files changed, 281 insertions(+), 293 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index d4ad973..5ad76b8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -23,6 +23,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER calls dunder method __call__. Invoke instance directly." - Python 3.9 dropped the alias base64.decodestring, deprecated since 3.1. Only used in msvs.py. Use base64.decodebytes instead. + - SCons test runner now uses pathlib to normalize and compare paths + to test files. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/runtest.py b/runtest.py index a2ece7e..46cdc7b 100755 --- a/runtest.py +++ b/runtest.py @@ -14,22 +14,17 @@ This script adds SCons/ and testing/ directories to PYTHONPATH, performs test discovery and processes tests according to options. """ -# TODO: normalize requested and testlist/exclude paths for easier comparison. -# e.g.: "runtest foo/bar" on windows will produce paths like foo/bar\test.py -# this is hard to match with excludelists, and makes those both os.sep-specific -# and command-line-typing specific. - import argparse -import glob +import itertools import os -import stat import subprocess import sys import tempfile import threading import time from abc import ABC, abstractmethod -from pathlib import Path +from io import StringIO +from pathlib import Path, PurePath, PureWindowsPath from queue import Queue cwd = os.getcwd() @@ -39,7 +34,7 @@ scons = None catch_output = False suppress_output = False -script = os.path.basename(sys.argv[0]) +script = PurePath(sys.argv[0]).name usagestr = """\ %(script)s [OPTIONS] [TEST ...] """ % locals() @@ -388,11 +383,13 @@ else: class RuntestBase(ABC): """ Base class for tests """ - def __init__(self, path, num, spe=None): - self.path = path - self.num = num + _ids = itertools.count(1) # to geenerate test # automatically + + def __init__(self, path, spe=None): + self.path = str(path) + self.testno = next(self._ids) self.stdout = self.stderr = self.status = None - self.abspath = os.path.abspath(path) + self.abspath = path.absolute() self.command_args = [] self.command_str = "" self.test_time = self.total_time = 0 @@ -404,7 +401,7 @@ class RuntestBase(ABC): break @abstractmethod - def execute(self): + def execute(self, env): pass @@ -547,7 +544,7 @@ if sys.platform == 'win32': # Windows doesn't support "shebang" lines directly (the Python launcher # and Windows Store version do, but you have to get them launched first) # so to directly launch a script we depend on an assoc for .py to work. - # Some systems may have none, and in some cases IDE programs take over + # Some systems may have none, and in some cases IDE programs take over # the assoc. Detect this so the small number of tests affected can skip. try: python_assoc = get_template_command('.py') @@ -564,7 +561,7 @@ if '_JAVA_OPTIONS' in os.environ: # ---[ test discovery ]------------------------------------ -# This section figures which tests to run. +# This section figures out which tests to run. # # The initial testlist is made by reading from the testlistfile, # if supplied, or by looking at the test arguments, if supplied, @@ -587,10 +584,15 @@ if '_JAVA_OPTIONS' in os.environ: # Test exclusions, if specified, are then applied. -def scanlist(testlist): +def scanlist(testfile): """ Process a testlist file """ - tests = [t.strip() for t in testlist if not t.startswith('#')] - return [t for t in tests if t] + data = StringIO(testfile.read_text()) + tests = [t.strip() for t in data.readlines() if not t.startswith('#')] + # in order to allow scanned lists to work whether they use forward or + # backward slashes, first create the object as a PureWindowsPath which + # accepts either, then use that to make a Path object to use for + # comparisons like "file in scanned_list". + return [Path(PureWindowsPath(t)) for t in tests if t] def find_unit_tests(directory): @@ -602,7 +604,8 @@ def find_unit_tests(directory): continue for fname in filenames: if fname.endswith("Tests.py"): - result.append(os.path.join(dirpath, fname)) + result.append(Path(dirpath, fname)) + return sorted(result) @@ -617,79 +620,74 @@ def find_e2e_tests(directory): # Slurp in any tests in exclude lists excludes = [] if ".exclude_tests" in filenames: - p = Path(dirpath).joinpath(".exclude_tests") - # TODO simplify when Py3.5 dropped - if sys.version_info.major == 3 and sys.version_info.minor < 6: - excludefile = p.resolve() - else: - excludefile = p.resolve(strict=True) - with excludefile.open() as f: - excludes = scanlist(f) + excludefile = Path(dirpath, ".exclude_tests").resolve() + excludes = scanlist(excludefile) for fname in filenames: - if fname.endswith(".py") and fname not in excludes: - result.append(os.path.join(dirpath, fname)) + if fname.endswith(".py") and Path(fname) not in excludes: + result.append(Path(dirpath, fname)) return sorted(result) # initial selection: +# if we have a testlist file read that, else hunt for tests. unittests = [] endtests = [] if args.testlistfile: - with args.testlistfile.open() as f: - tests = scanlist(f) + tests = scanlist(args.testlistfile) else: testpaths = [] - if args.all: - testpaths = ['SCons', 'test'] - elif args.testlist: - testpaths = args.testlist - - for tp in testpaths: - # Clean up path so it can match startswith's below - # remove leading ./ or .\ - if tp.startswith('.') and tp[1] in (os.sep, os.altsep): - tp = tp[2:] - - for path in glob.glob(tp): - if os.path.isdir(path): - if path.startswith(('SCons', 'testing')): + if args.all: # -a flag + testpaths = [Path('SCons'), Path('test')] + elif args.testlist: # paths given on cmdline + testpaths = [Path(PureWindowsPath(t)) for t in args.testlist] + + for path in testpaths: + # Clean up path removing leading ./ or .\ + name = str(path) + if name.startswith('.') and name[1] in (os.sep, os.altsep): + path = path.with_name(tn[2:]) + + if path.exists(): + if path.is_dir(): + if path.parts[0] == "SCons" or path.parts[0] == "testing": unittests.extend(find_unit_tests(path)) - elif path.startswith('test'): + elif path.parts[0] == 'test': endtests.extend(find_e2e_tests(path)) + # else: TODO: what if user pointed to a dir outside scons tree? else: - if path.endswith("Tests.py"): + if path.match("*Tests.py"): unittests.append(path) - elif path.endswith(".py"): + elif path.match("*.py"): endtests.append(path) - tests = sorted(unittests + endtests) + tests = sorted(unittests + endtests) # Remove exclusions: if args.e2e_only: - tests = [t for t in tests if not t.endswith("Tests.py")] + tests = [t for t in tests if not t.match("*Tests.py")] if args.unit_only: - tests = [t for t in tests if t.endswith("Tests.py")] + tests = [t for t in tests if t.match("*Tests.py")] if args.excludelistfile: - with args.excludelistfile.open() as f: - excludetests = scanlist(f) + excludetests = scanlist(args.excludelistfile) tests = [t for t in tests if t not in excludetests] +# did we end up with any tests? if not tests: sys.stderr.write(parser.format_usage() + """ -error: no tests were found. - Tests can be specified on the command line, read from a file with - the -f/--file option, or discovered with -a/--all to run all tests. +error: no tests matching the specification were found. + See "Test selection options" in the help for details on + how to specify and/or exclude tests. """) sys.exit(1) # ---[ test processing ]----------------------------------- -tests = [Test(t, n + 1) for n, t in enumerate(tests)] +tests = [Test(t) for t in tests] if args.list_only: for t in tests: - sys.stdout.write(t.path + "\n") + print(t.path) sys.exit(0) if not args.python: @@ -702,7 +700,7 @@ os.environ["python_executable"] = args.python if args.print_times: def print_time(fmt, tm): - sys.stdout.write(fmt % tm) + print(fmt % tm) else: @@ -739,7 +737,7 @@ def log_result(t, io_lock=None): print(t.stdout) if t.stderr: print(t.stderr) - print_time("Test execution time: %.1f seconds\n", t.test_time) + print_time("Test execution time: %.1f seconds", t.test_time) finally: if io_lock: io_lock.release() @@ -778,8 +776,8 @@ def run_test(t, io_lock=None, run_async=True): if args.printcommand: if args.print_progress: t.headline += "%d/%d (%.2f%s) %s\n" % ( - t.num, total_num_tests, - float(t.num) * 100.0 / float(total_num_tests), + t.testno, total_num_tests, + float(t.testno) * 100.0 / float(total_num_tests), "%", t.command_str, ) @@ -843,7 +841,7 @@ else: # --- all tests are complete by the time we get here --- if tests: tests[0].total_time = time_func() - total_start_time - print_time("Total execution time for all tests: %.1f seconds\n", tests[0].total_time) + print_time("Total execution time for all tests: %.1f seconds", tests[0].total_time) passed = [t for t in tests if t.status == 0] fail = [t for t in tests if t.status == 1] diff --git a/test/runtest/SCons.py b/test/runtest/SCons.py index 20c4c64..fc4c3e0 100644 --- a/test/runtest/SCons.py +++ b/test/runtest/SCons.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 that we find tests under the SCons/ tree only if they end @@ -46,17 +45,17 @@ test.write_passing_test(['SCons', 'passTests.py']) test.write_passing_test(['SCons', 'suite', 'pass.py']) test.write_passing_test(['SCons', 'suite', 'passTests.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(src_passTests_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {src_passTests_py} PASSING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(src_suite_passTests_py)s +{pythonstring}{pythonflags} {src_suite_passTests_py} PASSING TEST STDOUT -""" % locals() +""" expect_stderr = """\ PASSING TEST STDERR PASSING TEST STDERR -""" % locals() +""" test.run(arguments='-k SCons', stdout=expect_stdout, stderr=expect_stderr) diff --git a/test/runtest/baseline/combined.py b/test/runtest/baseline/combined.py index 228d42d..00ce85b 100644 --- a/test/runtest/baseline/combined.py +++ b/test/runtest/baseline/combined.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 a combination of a passing test, failing test, and no-result @@ -42,27 +41,24 @@ test_pass_py = os.path.join('test', 'pass.py') test = TestRuntest.TestRuntest() test.subdir('test') - test.write_failing_test(['test', 'fail.py']) - test.write_no_result_test(['test', 'no_result.py']) - test.write_passing_test(['test', 'pass.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_no_result_py)s +{pythonstring}{pythonflags} {test_no_result_py} NO RESULT TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT Failed the following test: -\t%(test_fail_py)s +\t{test_fail_py} NO RESULT from the following test: -\t%(test_no_result_py)s -""" % locals() +\t{test_no_result_py} +""" expect_stderr = """\ FAILING TEST STDERR @@ -70,10 +66,7 @@ NO RESULT TEST STDERR PASSING TEST STDERR """ -test.run(arguments='-k -b . test', - status=1, - stdout=expect_stdout, - stderr=expect_stderr) +test.run(arguments='-k -b . test', status=1, stdout=expect_stdout, stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/baseline/fail.py b/test/runtest/baseline/fail.py index e2aff4a..2268dce 100644 --- a/test/runtest/baseline/fail.py +++ b/test/runtest/baseline/fail.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,38 +22,39 @@ # 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 how we handle a failing test specified on the command line. """ +import os + import TestRuntest pythonstring = TestRuntest.pythonstring pythonflags = TestRuntest.pythonflags +test_fail_py = os.path.join('test', 'fail.py') test = TestRuntest.TestRuntest() test.subdir('test') - test.write_failing_test(['test', 'fail.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s test/fail.py +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -""" % locals() +""" expect_stderr = """\ FAILING TEST STDERR """ -test.run(arguments='-k -b . test/fail.py', - status=1, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='-k -b . test/fail.py', + status=1, + stdout=expect_stdout, + stderr=expect_stderr, +) test.pass_test() diff --git a/test/runtest/baseline/no_result.py b/test/runtest/baseline/no_result.py index d00f536..ce6f20c 100644 --- a/test/runtest/baseline/no_result.py +++ b/test/runtest/baseline/no_result.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,43 +22,45 @@ # 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 how we handle a no-results test specified on the command line. """ +import os + import TestRuntest pythonstring = TestRuntest.pythonstring pythonflags = TestRuntest.pythonflags +test_no_result_py = os.path.join('test', 'no_result.py') test = TestRuntest.TestRuntest() - test.subdir('test') - test.write_no_result_test(['test', 'no_result.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s test/no_result.py +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_no_result_py} NO RESULT TEST STDOUT -""" % locals() +""" expect_stderr = """\ NO RESULT TEST STDERR """ -test.run(arguments='--no-ignore-skips -k -b . test/no_result.py', - status=2, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='--no-ignore-skips -k -b . test/no_result.py', + status=2, + stdout=expect_stdout, + stderr=expect_stderr, +) -test.run(arguments='-k -b . test/no_result.py', - status=0, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='-k -b . test/no_result.py', + status=0, + stdout=expect_stdout, + stderr=expect_stderr, +) test.pass_test() diff --git a/test/runtest/baseline/pass.py b/test/runtest/baseline/pass.py index 481fc97..c31a6d6 100644 --- a/test/runtest/baseline/pass.py +++ b/test/runtest/baseline/pass.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 how we handle a passing test specified on the command line. @@ -42,18 +41,16 @@ test.subdir('test') test.write_passing_test(['test', 'pass.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT -""" % locals() +""" expect_stderr = """\ PASSING TEST STDERR """ -test.run(arguments='-k -b . test', - stdout=expect_stdout, - stderr=expect_stderr) +test.run(arguments='-k -b . test', stdout=expect_stdout, stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/faillog.py b/test/runtest/faillog.py index e2ca67e..f23b90b 100644 --- a/test/runtest/faillog.py +++ b/test/runtest/faillog.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 a list of tests in failed_tests.log to run with the --retry option @@ -42,15 +41,15 @@ test.subdir('test') test.write_failing_test(test_fail_py) test.write_passing_test(test_pass_py) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT Failed the following test: -\t%(test_fail_py)s -""" % locals() +\t{test_fail_py} +""" expect_stderr = """\ FAILING TEST STDERR diff --git a/test/runtest/no_faillog.py b/test/runtest/no_faillog.py index db17c8e..174ab48 100644 --- a/test/runtest/no_faillog.py +++ b/test/runtest/no_faillog.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 a list of tests in failed_tests.log to run with the --retry option @@ -42,19 +41,22 @@ test.subdir('test') test.write_failing_test(test_fail_py) test.write_passing_test(test_pass_py) -test.write('failed_tests.log', """\ -%(test_fail_py)s -""" % locals()) +test.write( + 'failed_tests.log', + f"""\ +{test_fail_py} +""", +) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT Failed the following test: -\t%(test_fail_py)s -""" % locals() +\t{test_fail_py} +""" expect_stderr = """\ FAILING TEST STDERR diff --git a/test/runtest/print_time.py b/test/runtest/print_time.py index 834d2ae..3d49a97 100644 --- a/test/runtest/print_time.py +++ b/test/runtest/print_time.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 a combination of a passing test, failing test, and no-result @@ -41,30 +40,30 @@ test_fail_py = re.escape(os.path.join('test', 'fail.py')) test_no_result_py = re.escape(os.path.join('test', 'no_result.py')) test_pass_py = re.escape(os.path.join('test', 'pass.py')) -test = TestRuntest.TestRuntest(match = TestCmd.match_re) +test = TestRuntest.TestRuntest(match=TestCmd.match_re) test.subdir('test') test.write_failing_test(['test', 'fail.py']) test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT Test execution time: \\d+.\\d seconds -%(pythonstring)s%(pythonflags)s %(test_no_result_py)s +{pythonstring}{pythonflags} {test_no_result_py} NO RESULT TEST STDOUT Test execution time: \\d+.\\d seconds -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT Test execution time: \\d+.\\d seconds Total execution time for all tests: \\d+.\\d seconds Failed the following test: -\t%(test_fail_py)s +\t{test_fail_py} NO RESULT from the following test: -\t%(test_no_result_py)s -""" % locals() +\t{test_no_result_py} +""" expect_stderr = """\ FAILING TEST STDERR @@ -72,10 +71,7 @@ NO RESULT TEST STDERR PASSING TEST STDERR """ -test.run(arguments='-k -t test', - status=1, - stdout=expect_stdout, - stderr=expect_stderr) +test.run(arguments='-k -t test', status=1, stdout=expect_stdout, stderr=expect_stderr) test.pass_test() diff --git a/test/runtest/python.py b/test/runtest/python.py index abd4f0c..dbb24ca 100644 --- a/test/runtest/python.py +++ b/test/runtest/python.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 that the -P option lets us specify a Python version to use. @@ -46,26 +45,26 @@ head, dir = os.path.split(head) # python version then in use, which could be different pythonflags = TestRuntest.pythonflags -# We have to normalize the python path here, because some installations don't like -# getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop. +# We have to normalize the python path here, because some installations +# don't like getting called with "/bin/../bin/python" as first argument, +# e.g. Fedora 17 Desktop. mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python)) test.subdir('test') - test.write_passing_test(['test', 'pass.py']) -expect_stdout = """\ -%(mypython)s%(pythonflags)s %(test_pass_py)s +expect_stdout = f"""\ +{mypython}{pythonflags} {test_pass_py} PASSING TEST STDOUT -""" % locals() +""" expect_stderr = """\ PASSING TEST STDERR """ -test.run(arguments=['-k','-P', mypython, 'test'], - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments=['-k', '-P', mypython, 'test'], stdout=expect_stdout, stderr=expect_stderr +) test.pass_test() diff --git a/test/runtest/retry.py b/test/runtest/retry.py index 4280152..0c5beb6 100644 --- a/test/runtest/retry.py +++ b/test/runtest/retry.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 a list of tests in failed_tests.log to run with the --retry option @@ -45,14 +44,17 @@ test.write_failing_test(['test', 'fail.py']) test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) -test.write('failed_tests.log', """\ -%(test_fail_py)s -""" % locals()) +test.write( + 'failed_tests.log', + f"""\ +{test_fail_py} +""", +) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -""" % locals() +""" expect_stderr = """\ FAILING TEST STDERR diff --git a/test/runtest/simple/combined.py b/test/runtest/simple/combined.py index a54e57c..e594c50 100644 --- a/test/runtest/simple/combined.py +++ b/test/runtest/simple/combined.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 a combination of a passing test, failing test, and no-result @@ -45,20 +44,20 @@ test.write_failing_test(test_fail_py) test.write_no_result_test(test_no_result_py) test.write_passing_test(test_pass_py) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_fail_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_no_result_py)s +{pythonstring}{pythonflags} {test_no_result_py} NO RESULT TEST STDOUT -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT Failed the following test: -\t%(test_fail_py)s +\t{test_fail_py} NO RESULT from the following test: -\t%(test_no_result_py)s -""" % locals() +\t{test_no_result_py} +""" expect_stderr = """\ FAILING TEST STDERR @@ -66,12 +65,7 @@ NO RESULT TEST STDERR PASSING TEST STDERR """ -test.run( - arguments='-k test', - status=1, - stdout=expect_stdout, - stderr=expect_stderr -) +test.run(arguments='-k test', status=1, stdout=expect_stdout, stderr=expect_stderr) test.must_exist('failed_tests.log') test.must_contain('failed_tests.log', test_fail_py) diff --git a/test/runtest/simple/fail.py b/test/runtest/simple/fail.py index f26f00e..5e1979a 100644 --- a/test/runtest/simple/fail.py +++ b/test/runtest/simple/fail.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,38 +22,35 @@ # 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 how we handle a failing test specified on the command line. """ +import os + import TestRuntest pythonstring = TestRuntest.pythonstring pythonflags = TestRuntest.pythonflags +test_fail_py = os.path.join('test', 'fail.py') test = TestRuntest.TestRuntest() - test.subdir('test') - test.write_failing_test(['test', 'fail.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s test/fail.py +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_fail_py} FAILING TEST STDOUT -""" % locals() +""" expect_stderr = """\ FAILING TEST STDERR """ -test.run(arguments='-k test/fail.py', - status=1, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='-k test/fail.py', status=1, stdout=expect_stdout, stderr=expect_stderr +) test.pass_test() diff --git a/test/runtest/simple/no_result.py b/test/runtest/simple/no_result.py index 33f28e4..beb82b0 100644 --- a/test/runtest/simple/no_result.py +++ b/test/runtest/simple/no_result.py @@ -27,35 +27,40 @@ Test how we handle a no-results test specified on the command line. """ +import os + import TestRuntest pythonstring = TestRuntest.pythonstring pythonflags = TestRuntest.pythonflags +test_no_result_py = os.path.join('test', 'no_result.py') test = TestRuntest.TestRuntest() - test.subdir('test') - test.write_no_result_test(['test', 'no_result.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s test/no_result.py +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_no_result_py} NO RESULT TEST STDOUT -""" % locals() +""" expect_stderr = """\ NO RESULT TEST STDERR """ -test.run(arguments='--no-ignore-skips -k test/no_result.py', - status=2, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='--no-ignore-skips -k test/no_result.py', + status=2, + stdout=expect_stdout, + stderr=expect_stderr, +) -test.run(arguments='-k test/no_result.py', - status=0, - stdout=expect_stdout, - stderr=expect_stderr) +test.run( + arguments='-k test/no_result.py', + status=0, + stdout=expect_stdout, + stderr=expect_stderr, +) test.pass_test() diff --git a/test/runtest/simple/pass.py b/test/runtest/simple/pass.py index 7ceb9a0..408ef4c 100644 --- a/test/runtest/simple/pass.py +++ b/test/runtest/simple/pass.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,29 +22,27 @@ # 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 how we handle a passing test specified on the command line. """ +import os + import TestRuntest pythonstring = TestRuntest.pythonstring pythonflags = TestRuntest.pythonflags +test_pass_py = os.path.join('test', 'pass.py') test = TestRuntest.TestRuntest() - test.subdir('test') - test.write_passing_test(['test', 'pass.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s test/pass.py +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT -""" % locals() +""" expect_stderr = """\ PASSING TEST STDERR diff --git a/test/runtest/testargv.py b/test/runtest/testargv.py index 22e57e8..20dcdc8 100644 --- a/test/runtest/testargv.py +++ b/test/runtest/testargv.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 subdir args for runtest.py, for example: @@ -38,34 +37,35 @@ import TestRuntest test = TestRuntest.TestRuntest() test.subdir('test', ['test', 'subdir']) -files = {} -files['pythonstring'] = TestRuntest.pythonstring -files['pythonflags'] = TestRuntest.pythonflags +pythonstring = TestRuntest.pythonstring +pythonflags = TestRuntest.pythonflags -files['one'] = os.path.join('test/subdir', 'test_one.py') -files['two'] = os.path.join('test/subdir', 'two.py') -files['three'] = os.path.join('test', 'test_three.py') +one = os.path.join('test', 'subdir', 'test_one.py') +two = os.path.join('test', 'subdir', 'two.py') +three = os.path.join('test', 'test_three.py') -test.write_passing_test(files['one']) -test.write_passing_test(files['two']) -test.write_passing_test(files['three']) +test.write_passing_test(['test', 'subdir', 'test_one.py']) +test.write_passing_test(['test', 'subdir', 'two.py']) +test.write_passing_test(['test', 'test_three.py']) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(one)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {one} PASSING TEST STDOUT -%(pythonstring)s%(pythonflags)s %(two)s +{pythonstring}{pythonflags} {two} PASSING TEST STDOUT -""" % files +""" expect_stderr = """\ PASSING TEST STDERR PASSING TEST STDERR """ -test.run(arguments = '--no-progress test/subdir', - status = 0, - stdout = expect_stdout, - stderr = expect_stderr) +test.run( + arguments='--no-progress test/subdir', + status=0, + stdout=expect_stdout, + stderr=expect_stderr, +) test.pass_test() diff --git a/test/runtest/testlistfile.py b/test/runtest/testlistfile.py index 5c956b8..e5d85b8 100644 --- a/test/runtest/testlistfile.py +++ b/test/runtest/testlistfile.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 a list of tests to run in a file specified with the -f option. @@ -46,15 +45,18 @@ test.write_failing_test(['test', 'fail.py']) test.write_no_result_test(['test', 'no_result.py']) test.write_passing_test(['test', 'pass.py']) -test.write('t.txt', """\ -#%(test_fail_py)s -%(test_pass_py)s -""" % locals()) +test.write( + 't.txt', + f"""\ +#{test_fail_py} +{test_pass_py} +""", +) -expect_stdout = """\ -%(pythonstring)s%(pythonflags)s %(test_pass_py)s +expect_stdout = f"""\ +{pythonstring}{pythonflags} {test_pass_py} PASSING TEST STDOUT -""" % locals() +""" expect_stderr = """\ PASSING TEST STDERR diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py index cd20dbd..66ec656 100644 --- a/test/runtest/xml/output.py +++ b/test/runtest/xml/output.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 writing XML output to a file. @@ -34,8 +33,7 @@ import re import TestCmd import TestRuntest -test = TestRuntest.TestRuntest(match = TestCmd.match_re, - diff = TestCmd.diff_re) +test = TestRuntest.TestRuntest(match=TestCmd.match_re, diff=TestCmd.diff_re) pythonstring = re.escape(TestRuntest.pythonstring) pythonflags = TestRuntest.pythonflags @@ -44,22 +42,18 @@ test_no_result_py = re.escape(os.path.join('test', 'no_result.py')) test_pass_py = re.escape(os.path.join('test', 'pass.py')) test.subdir('test') - test.write_fake_scons_source_tree() - test.write_failing_test(['test', 'fail.py']) - test.write_no_result_test(['test', 'no_result.py']) - test.write_passing_test(['test', 'pass.py']) -test.run(arguments = '--xml xml.out test', status=1) +test.run(arguments='--xml xml.out test', status=1) -expect = """\ +expect = f"""\ - %(test_fail_py)s - %(pythonstring)s%(pythonflags)s %(test_fail_py)s + {test_fail_py} + {pythonstring}{pythonflags} {test_fail_py} 1 FAILING TEST STDOUT @@ -68,8 +62,8 @@ expect = """\ - %(test_no_result_py)s - %(pythonstring)s%(pythonflags)s %(test_no_result_py)s + {test_no_result_py} + {pythonstring}{pythonflags} {test_no_result_py} 2 NO RESULT TEST STDOUT @@ -78,8 +72,8 @@ expect = """\ - %(test_pass_py)s - %(pythonstring)s%(pythonflags)s %(test_pass_py)s + {test_pass_py} + {pythonstring}{pythonflags} {test_pass_py} 0 PASSING TEST STDOUT @@ -89,7 +83,7 @@ expect = """\ -""" % locals() +""" # Just strip carriage returns so the regular expression matching works. contents = test.read('xml.out') -- cgit v0.12 From c31c4d7032eede7eb7389c79a9a602da17487811 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 19 Apr 2023 08:40:20 -0600 Subject: runtest: add additional test of os.sep usage Make sure test lists with "foreign" separator still cause the correct discovery/usage. Signed-off-by: Mats Wichmann --- test/runtest/pathseps.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 test/runtest/pathseps.py diff --git a/test/runtest/pathseps.py b/test/runtest/pathseps.py new file mode 100644 index 0000000..10d86b2 --- /dev/null +++ b/test/runtest/pathseps.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# +# 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 +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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. + +""" +Make sure different path separators don't break things. +Backslashes should be okay on POSIX, forwards slashes on win32, +and combinations should cause no problems. +""" + +import os.path + +import TestRuntest + +# the "expected" paths are generated os-native +test_one_py = os.path.join('test', 'subdir', 'test1.py') +test_two_py = os.path.join('test', 'subdir', 'test2.py') +test_three_py = os.path.join('test', 'subdir', 'test3.py') +test_four_py = os.path.join('test', 'subdir', 'test4.py') + +test = TestRuntest.TestRuntest() +# create files for discovery +testdir = "test/subdir".split("/") +test.subdir(testdir[0], testdir) +test.write_passing_test(testdir + ['test1.py']) +test.write_passing_test(testdir + ['test2.py']) +test.write_passing_test(testdir + ['test3.py']) +test.write_passing_test(testdir + ['test4.py']) + +# discover tests using testlist file with various combinations of slashes +test.write( + 'testlist.txt', + r""" +test/subdir/test1.py +test\subdir/test2.py +test/subdir\test3.py +test\subdir\test4.py +""", +) + +# expect the discovered files to all be os-native +expect_stdout = f"""\ +{test_one_py} +{test_two_py} +{test_three_py} +{test_four_py} +""" + +test.run(arguments="-k -l -f testlist.txt", stdout=expect_stdout, stderr=None) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From faa271d1dd379d5fe46ca2742f5a83e54ea4f36c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 8 May 2023 08:05:06 -0600 Subject: add RELEASE entry for runtest changes [skip ci] Signed-off-by: Mats Wichmann --- RELEASE.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE.txt b/RELEASE.txt index c2244f2..bafda47 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -64,7 +64,11 @@ DOCUMENTATION DEVELOPMENT ----------- -- List visible changes in the way SCons is developed +- SCons test runner now uses pathlib to normalize and compare paths + to test files, which allows test lists, exclude lists, and tests on + the command line to "not care" about the OS convention for pathname + separators. + Thanks to the following contributors listed below for their contributions to this release. ========================================================================================== -- cgit v0.12 From d723812004c1e88c5bfab37b454b7164f5b4ae00 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 8 May 2023 12:55:27 -0600 Subject: Put back Builder entityref in UG add-method [skip appveyor] Entity reference &Builder;s was turned to plain text in a few places. Restored, this time using existing pluralized entity name &Builders;. Also twiddled a little wording in same User Guide chapter. Signed-off-by: Mats Wichmann --- doc/user/add-method.xml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index 7c59bf2..179be95 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -32,9 +32,14 @@ Copyright The SCons Foundation The &f-link-AddMethod; function is used to add a method to an environment. It is typically used to add a "pseudo-builder," a function that looks like a &Builder; but - wraps up calls to multiple other Builders + wraps up calls to multiple other &Builders; or otherwise processes its arguments - before calling one or more Builders. + before calling one or more &Builders;. + + + + + In the following example, we want to install the program into the standard /usr/bin directory hierarchy, @@ -70,11 +75,11 @@ int main() { printf("Hello, world!\n"); } - A pseudo-builder is useful because it provides more flexibility - in parsing arguments than you can get with a standard &Builder;. + A pseudo-builder is useful because it gives you more flexibility + parsing arguments than you can get with a standard &Builder;. The next example shows a pseudo-builder with a - named argument that modifies the filename, and a separate argument - for the resource file (rather than having the builder figure it out + named argument that modifies the filename, and a separate optional + argument for a resource file (rather than having the builder figure it out by file extension). This example also demonstrates using the global &AddMethod; function to add a method to the global Environment class, so it will be available in all subsequently created environments. -- cgit v0.12 From 73f05debff36d451eb966daefd5a1687521387fb Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 10 May 2023 08:33:33 -0600 Subject: Find choco msys mingw 4c835c4 introduced an effort to find mingw if installed as part of the msys2 chocolatey package. Unfortunately that change worked only for one specific user (me) who had set environment variable %ChocolateyToolsLocation% to a prefix in that path. Instead, reference the environment variable to try to find it. Usually we don't like environment variables, but this one actually makes the lookup *less* system-specific, as it extracts the best possible guess where chocolatey has put the files on that system. Also moved a CHANGES.txt entry that had gotten merged under an earlier release (submission of that PR had been before 4.5 went out) Signed-off-by: Mats Wichmann --- CHANGES.txt | 7 ++++--- SCons/Tool/mingw.py | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5ad76b8..a937ea2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -25,6 +25,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER Only used in msvs.py. Use base64.decodebytes instead. - SCons test runner now uses pathlib to normalize and compare paths to test files. + - Fixed: when using the mingw tool, if an msys2 Python is used (os.sep + is '/' rather than the Windows default '\'), certain Configure checks + could fail due to the construction of the path to run the compiled check. + - Added effort to find mingw if it comes from Chocolatey install of msys2. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 @@ -198,9 +202,6 @@ RELEASE 4.5.0 - Sun, 05 Mar 2023 14:08:29 -0700 We take advantage that their order is now stable based on insertion order in Python 3.5+ - Added/modifed unit and system tests to verify these changes. - - Fixed: when using the mingw tool, if an msys2 Python is used (os.sep - is '/' rather than the Windows default '\'), certain Configure checks - could fail due to the construction of the path to run the compiled check. RELEASE 4.4.0 - Sat, 30 Jul 2022 14:08:29 -0700 diff --git a/SCons/Tool/mingw.py b/SCons/Tool/mingw.py index 8d4f3ed..0119444 100644 --- a/SCons/Tool/mingw.py +++ b/SCons/Tool/mingw.py @@ -41,6 +41,8 @@ import SCons.Defaults import SCons.Tool import SCons.Util +# TODO: should this be synced with SCons/Platform/mingw.py:MINGW_DEFAULTPATHS +# i.e. either keep the same, or make sure there's only one? mingw_base_paths = [ r'c:\MinGW\bin', r'C:\cygwin64\bin', @@ -48,9 +50,14 @@ mingw_base_paths = [ r'C:\msys64\mingw64\bin', r'C:\cygwin\bin', r'C:\msys', + # Chocolatey mingw (pkg name for MinGW-w64) does not use ChocolateyToolsLocation r'C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin', - os.path.expandvars(r'%LocalAppData%\Programs\msys64\usr\bin'), ] +# Chocolatey msys2 uses envvar ChocolateyToolsLocation to base the install +# location (unless the user supplied additional params). Try to reproduce: +choco = os.environ.get('ChocolateyToolsLocation') +if choco: + mingw_base_paths.append(choco + r'\msys64\bin') def shlib_generator(target, source, env, for_signature): -- cgit v0.12 From 959e2d4c4b029890ed90327bf66a29ca1f515678 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Thu, 11 May 2023 07:01:32 -0600 Subject: Release blurb [skip ci] Signed-off-by: Mats Wichmann --- RELEASE.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/RELEASE.txt b/RELEASE.txt index bafda47..e90cdee 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -32,7 +32,6 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY FIXES ----- - - Fixed: when using the mingw tool, if an msys2 Python is used (os.sep is '/' rather than the Windows default '\'), certain Configure checks could fail due to the construction of the path to run the compiled check. @@ -45,9 +44,7 @@ FIXES IMPROVEMENTS ------------ -- List improvements that wouldn't be visible to the user in the - documentation: performance improvements (describe the circumstances - under which they would be observed), or major code cleanups +- Now tries to find mingw if it comes from Chocolatey install of msys2. PACKAGING --------- -- cgit v0.12 From d6c4a4236512d1310ca5cfe990bd0af71dfe89a9 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 16 May 2023 09:23:33 -0600 Subject: Doc fiddling - Alias, Action, Decider [skip appveyor] * Signature of Alias() now matches implementation to avoid problem if kwargs used * Case of Alias with no targets is mentioned in text (was already shown in example) * Now mention that Action([item]) does not return a ListAction - previously implied that if arg was a list, a ListAction was *always* returned * Mention default Decider and sort the names of available decider functions, and add version marking. * Minor fiddling with Alias.py docstrings. Signed-off-by: Mats Wichmann --- CHANGES.txt | 7 +++ RELEASE.txt | 7 +-- SCons/Action.py | 55 ++++++++++--------- SCons/Environment.xml | 142 ++++++++++++++++++++++++++++++-------------------- doc/man/scons.xml | 12 +++-- doc/user/caching.xml | 2 +- 6 files changed, 134 insertions(+), 91 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5ad76b8..6e8e677 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -25,6 +25,13 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER Only used in msvs.py. Use base64.decodebytes instead. - SCons test runner now uses pathlib to normalize and compare paths to test files. + - Minor doc fixes: signature of Alias() now matches implementation + to avoid problem if kwargs used; case of Alias with no targets is + mentioned in text (was already shown in example); now mention that + Action([item]) does not return a ListAction - previously implied + that if arg was a list, a ListAction was *always* returned; mention + default Decider and sort the names of available decider functions, + and add a version marking. Minor fiddling with Alias.py docstrings. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/RELEASE.txt b/RELEASE.txt index bafda47..5cef731 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -57,9 +57,10 @@ PACKAGING DOCUMENTATION ------------- -- List any significant changes to the documentation (not individual - typo fixes, even if they're mentioned in src/CHANGES.txt to give - the contributor credit) +- Aligned manpage signature for Alias function to match implementation - + if the previous *targets* parameter had been used as a keyword argument, + the results would be incorrect (does not apply to positional argument + usage, which had no problem). DEVELOPMENT ----------- diff --git a/SCons/Action.py b/SCons/Action.py index 3f1a24e..fcc6f3f 100644 --- a/SCons/Action.py +++ b/SCons/Action.py @@ -148,9 +148,8 @@ def default_exitstatfunc(s): strip_quotes = re.compile(r'^[\'"](.*)[\'"]$') -def _callable_contents(obj): - """Return the signature contents of a callable Python object. - """ +def _callable_contents(obj) -> bytearray: + """Return the signature contents of a callable Python object.""" try: # Test if obj is a method. return _function_contents(obj.__func__) @@ -170,7 +169,7 @@ def _callable_contents(obj): return _function_contents(obj) -def _object_contents(obj): +def _object_contents(obj) -> bytearray: """Return the signature contents of any Python object. We have to handle the case where object contains a code object @@ -210,8 +209,10 @@ def _object_contents(obj): # the best we can. return bytearray(repr(obj), 'utf-8') +# TODO: docstrings for _code_contents and _function_contents +# do not render well with Sphinx. Consider reworking. -def _code_contents(code, docstring=None): +def _code_contents(code, docstring=None) -> bytearray: r"""Return the signature contents of a code object. By providing direct access to the code object of the @@ -223,7 +224,7 @@ def _code_contents(code, docstring=None): recompilations from moving a Python function. See: - - https://docs.python.org/2/library/inspect.html + - https://docs.python.org/3/library/inspect.html - http://python-reference.readthedocs.io/en/latest/docs/code/index.html For info on what each co\_ variable provides @@ -243,7 +244,6 @@ def _code_contents(code, docstring=None): co_code - Returns a string representing the sequence of bytecode instructions. """ - # contents = [] # The code contents depends on the number of local variables @@ -281,8 +281,9 @@ def _code_contents(code, docstring=None): return contents -def _function_contents(func): - """ +def _function_contents(func) -> bytearray: + """Return the signature contents of a function. + The signature is as follows (should be byte/chars): < _code_contents (see above) from func.__code__ > ,( comma separated _object_contents for function argument defaults) @@ -293,11 +294,7 @@ def _function_contents(func): - func.__code__ - The code object representing the compiled function body. - func.__defaults__ - A tuple containing default argument values for those arguments that have defaults, or None if no arguments have a default value - func.__closure__ - None or a tuple of cells that contain bindings for the function's free variables. - - :Returns: - Signature contents of a function. (in bytes) """ - contents = [_code_contents(func.__code__, func.__doc__)] # The function contents depends on the value of defaults arguments @@ -439,16 +436,13 @@ def _do_create_keywords(args, kw): def _do_create_action(act, kw): - """This is the actual "implementation" for the - Action factory method, below. This handles the - fact that passing lists to Action() itself has - different semantics than passing lists as elements - of lists. - - The former will create a ListAction, the latter - will create a CommandAction by converting the inner - list elements to strings.""" + """The internal implementation for the Action factory method. + This handles the fact that passing lists to :func:`Action` itself has + different semantics than passing lists as elements of lists. + The former will create a :class:`ListAction`, the latter will create a + :class:`CommandAction by converting the inner list elements to strings. + """ if isinstance(act, ActionBase): return act @@ -491,13 +485,22 @@ def _do_create_action(act, kw): return None -def _do_create_list_action(act, kw): - """A factory for list actions. Convert the input list into Actions - and then wrap them in a ListAction.""" +# TODO: from __future__ import annotations once we get to Python 3.7 base, +# to avoid quoting the defined-later classname +def _do_create_list_action(act, kw) -> "ListAction": + """A factory for list actions. + + Convert the input list *act* into Actions and then wrap them in a + :class:`ListAction`. If *act* has only a single member, return that + member, not a *ListAction*. This is intended to allow a contained + list to specify a command action without being processed into a + list action. + """ acts = [] for a in act: aa = _do_create_action(a, kw) - if aa is not None: acts.append(aa) + if aa is not None: + acts.append(aa) if not acts: return ListAction([]) elif len(acts) == 1: diff --git a/SCons/Environment.xml b/SCons/Environment.xml index f87e883..2b4c4af 100644 --- a/SCons/Environment.xml +++ b/SCons/Environment.xml @@ -351,9 +351,9 @@ to be performed after the specified target has been built. -The specified action(s) may be +action may be an Action object, or anything that -can be converted into an Action object +can be converted into an Action object. See the manpage section "Action Objects" for a complete explanation. @@ -364,6 +364,13 @@ the action may be called multiple times, once after each action that generates one or more targets in the list. + + +foo = Program('foo.c') +# remove execute permission from binary: +AddPostAction(foo, Chmod('$TARGET', "a-x")) + + @@ -379,9 +386,9 @@ to be performed before the specified target is built. -The specified action(s) may be +action may be an Action object, or anything that -can be converted into an Action object +can be converted into an Action object. See the manpage section "Action Objects" for a complete explanation.
@@ -426,21 +433,35 @@ file into an object file. -(alias, [targets, [action]]) +(alias, [source, [action]]) -Creates one or more phony targets that -expand to one or more other targets. -An optional +Creates a phony target (or targets) that +can be used as references to zero or more other targets, +as specified by the optional source +parameter. +alias and +source +may each be a string or Node object, +or a list of strings or Node objects; +if Nodes are used for +alias +they must be Alias nodes. +The optional action -(command) -or list of actions -can be specified that will be executed +parameter specifies an action or list of actions +that will be executed whenever the any of the alias targets are out-of-date. -Returns the Node object representing the alias, -which exists outside of any file system. -This Node object, or the alias name, + + + +Returns a list of Alias Node objects representing the alias(es), +which exist outside of any physical file system. + + + +The alias name, or an Alias Node object, may be used as a dependency of any other target, including another alias. &f-Alias; @@ -593,7 +614,7 @@ giving an easy way to enter multiple macros in one addition. Use an = to specify a valued macro. -A tuple is treated as a valued macro. +A tuple is treated as a valued macro. Use the value None if the macro should not have a value. It is an error to supply more than two elements in such a tuple. @@ -1238,8 +1259,8 @@ so you normally don't need to create directories by hand. -Creates a Configure object for integrated -functionality similar to GNU autoconf. +Creates a &Configure; object for integrated +functionality similar to GNU autoconf. See the manpage section "Configure Contexts" for a complete explanation of the arguments and behavior. @@ -1265,50 +1286,24 @@ that will be applied: -"timestamp-newer" - - -Specifies that a target shall be considered out of date and rebuilt -if the dependency's timestamp is newer than the target file's timestamp. -This is the behavior of the classic Make utility, -and -make -can be used a synonym for -timestamp-newer. - - - - -"timestamp-match" - - -Specifies that a target shall be considered out of date and rebuilt -if the dependency's timestamp is different than the -timestamp recorded the last time the target was built. -This provides behavior very similar to the classic Make utility -(in particular, files are not opened up so that their -contents can be checksummed) -except that the target will also be rebuilt if a -dependency file has been restored to a version with an -earlier -timestamp, such as can happen when restoring files from backup archives. - - - - "content" Specifies that a target shall be considered out of date and rebuilt if the dependency's content has changed since the last time the target was built, -as determined be performing an checksum -on the dependency's contents +as determined by performing a checksum +on the dependency's contents using the selected hash function, and comparing it to the checksum recorded the last time the target was built. -MD5 -can be used as a synonym for -content, but it is deprecated. +content is the default decider. + + +Changed in version 4.1: +The decider was renamed to content +since the hash function is now selectable. +The former name, MD5, +can still be used as a synonym, but is deprecated. @@ -1339,9 +1334,44 @@ that runs a build, updates a file, and runs the build again, all within a single second. -MD5-timestamp -can be used as a synonym for -content-timestamp, but it is deprecated. + + +Changed in version 4.1: +The decider was renamed to content-timestamp +since the hash function is now selectable. +The former name, MD5-timestamp, +can still be used as a synonym, but is deprecated. + + + + +"timestamp-newer" + + +Specifies that a target shall be considered out of date and rebuilt +if the dependency's timestamp is newer than the target file's timestamp. +This is the behavior of the classic Make utility, +and +make +can be used a synonym for +timestamp-newer. + + + + +"timestamp-match" + + +Specifies that a target shall be considered out of date and rebuilt +if the dependency's timestamp is different than the +timestamp recorded the last time the target was built. +This provides behavior very similar to the classic Make utility +(in particular, files are not opened up so that their +contents can be checksummed) +except that the target will also be rebuilt if a +dependency file has been restored to a version with an +earlier +timestamp, such as can happen when restoring files from backup archives. diff --git a/doc/man/scons.xml b/doc/man/scons.xml index e79a267..b070dcb 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -1216,7 +1216,7 @@ small block-size slows down the build considerably. The default value is to use a chunk size of 64 kilobytes, which should be appropriate for most uses. -New in version 4.2. +New in version 4.1. @@ -1256,7 +1256,7 @@ For example, uses a SConsign database named .sconsign_sha256.dblite. -New in version 4.2. +New in version 4.1. @@ -3961,7 +3961,7 @@ it will not be added again. The default is False. library can be a list of library names, or None (the default if the argument is omitted). If the former, symbol is checked against -each library name in order, returning +each library name in order, returning (and reporting success) on the first successful test; if the latter, it is checked with the current value of &cv-LIBS; @@ -6526,9 +6526,11 @@ env.Command( -The behavior of Chmod is limited on Windows, +The behavior of Chmod is limited on Windows +and on WebAssembly platforms, see the notes in the Python documentation for -os.chmod, which is the underlying function. + +os.chmod, which is the underlying function. diff --git a/doc/user/caching.xml b/doc/user/caching.xml index 69368d7..f00bd69 100644 --- a/doc/user/caching.xml +++ b/doc/user/caching.xml @@ -129,7 +129,7 @@ CacheDir('/usr/local/build_cache') A few inside details: &SCons; tracks two main kinds of cryptographic hashes: a &contentsig;, which is a hash of the contents of a file participating in the - build (depepdencies as well as targets); + build (dependencies as well as targets); and a &buildsig;, which is a hash of the elements needed to build a target, such as the command line, the contents of the sources, and possibly information about -- cgit v0.12 From 27132f89fa411aae71b931138561b00549a163f8 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Wed, 17 May 2023 18:57:26 -0700 Subject: Minor update to scanner description --- doc/user/scanners.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index 9a0a1d3..6538987 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -149,10 +149,13 @@ over the file scanning rather than being called for each input line: &SCons; has built-in &Scanners; that know how to look in C/C++, Fortran, D, IDL, LaTeX, Python and SWIG source files for information about - other files that targets built from those files depend on - - for example, in the case of files that use the C preprocessor, - the .h files that are specified - using #include lines in the source. + other files that targets built from those files depend on. + + For example, if you have a file format which uses #include + to specify files which should be included into the source file + when it is processed, you can use an existing scanner already + included in &SCons;. + You can use the same mechanisms that &SCons; uses to create its built-in Scanners to write Scanners of your own for file types that &SCons; does not know how to scan "out of the box." -- cgit v0.12 From 14a58022619c81533bcc7fe1f026dd02409235b3 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 20 Feb 2023 11:43:59 -0700 Subject: Add a copyright header to test files A lot of files that are not the main test scripts had no license/copyright headers. This change adds those. In a small number of cases, this necessitaed a change to an expected line number from a failure/exception message. Along the way, some are lightly reformatted and some add a DefaultEnvironment call. Signed-off-by: Mats Wichmann --- test/AS/fixture/myas.py | 4 + test/AS/fixture/myas_args.py | 4 + test/Actions/addpost-link-fixture/strip.py | 5 ++ test/Actions/addpost-link-fixture/test1.c | 5 ++ test/Actions/addpost-link-fixture/test_lib.c | 4 + test/Actions/append-fixture/foo.c | 4 + test/Actions/pre-post-fixture/work1/bar.c | 4 + test/Actions/pre-post-fixture/work1/foo.c | 4 + test/Actions/pre-post-fixture/work2/SConstruct | 14 +++- test/Actions/pre-post-fixture/work3/SConstruct | 8 ++ test/Actions/pre-post-fixture/work4/build.py | 5 ++ test/Actions/pre-post.py | 2 +- test/Actions/subst_shell_env-fixture/SConstruct | 5 ++ test/Actions/unicode-signature-fixture/SConstruct | 6 +- test/Batch/SConstruct_changed_sources_alwaysBuild | 8 +- test/Batch/changed_sources_main.cpp | 3 + test/CC/CC-fixture/bar.c | 4 + test/CC/CC-fixture/foo.c | 4 + test/CC/CC-fixture/mycc.py | 4 + test/CC/CCVERSION-fixture/versioned.py | 5 ++ test/CC/gcc-non-utf8-fixture/gcc-non-utf8.py | 4 + test/CXX/CXX-fixture/myc++.py | 4 + test/CacheDir/CACHEDIR_CLASS_fixture/SConstruct | 9 ++- test/CacheDir/custom_cachedir_fixture/SConstruct | 9 ++- test/CacheDir/double_cachedir_fixture/SConstruct | 8 +- .../invalid_custom_cachedir_fixture/SConstruct | 7 +- test/CacheDir/value_dependencies/SConstruct | 14 ++-- test/CompilationDatabase/fixture/SConstruct | 4 + .../fixture/SConstruct_tempfile | 4 + .../CompilationDatabase/fixture/SConstruct_variant | 4 + test/Configure/conftest_source_file/SConstruct | 6 +- test/Configure/conftest_source_file/header1.h | 6 +- test/Configure/conftest_source_file/header2.h | 6 +- test/Configure/conftest_source_file/header3.h | 6 +- test/Configure/conftest_source_file/main.c | 6 +- test/Configure/fixture/SConstruct.issue-2906 | 7 +- test/Configure/is_conftest/fixture/SConstruct | 10 ++- ...ssue-2906-useful-duplicate-configure-message.py | 9 +-- test/Configure/issue-3469/fixture/SConstruct | 1 - test/D/AllAtOnce/Image/SConstruct_template | 18 +++-- test/D/AllAtOnce/Image/amod.d | 4 + test/D/AllAtOnce/Image/bmod.d | 4 + test/D/AllAtOnce/Image/main.d | 4 + test/D/CoreScanner/Image/SConstruct_template | 8 +- test/D/CoreScanner/Image/ignored.d | 4 + test/D/CoreScanner/Image/module1.d | 4 + test/D/CoreScanner/Image/module2.d | 4 + test/D/CoreScanner/Image/p/ignored.d | 4 + test/D/CoreScanner/Image/p/submodule1.d | 4 + test/D/CoreScanner/Image/p/submodule2.d | 4 + test/D/CoreScanner/Image/test1.d | 4 + test/D/CoreScanner/Image/test2.d | 4 + test/D/HSTeoh/ArLibIssue/SConstruct_template | 8 +- .../D/HSTeoh/LibCompileOptions/SConstruct_template | 14 ++-- test/D/HSTeoh/LibCompileOptions/prog.d | 4 + test/D/HSTeoh/LinkingProblem/SConstruct_template | 13 ++-- test/D/HSTeoh/LinkingProblem/cprog.c | 4 + test/D/HSTeoh/LinkingProblem/ncurs_impl.c | 4 + test/D/HSTeoh/LinkingProblem/prog.d | 4 + .../SConstruct_template | 13 +++- .../SingleStringCannotBeMultipleOptions/cmod.c | 4 + .../SingleStringCannotBeMultipleOptions/mod1.d | 4 + .../SingleStringCannotBeMultipleOptions/proj.d | 4 + .../Image/SConstruct_template | 9 ++- .../CompileAndLinkOneStep/Image/helloWorld.d | 4 + .../Image/SConstruct_template | 10 +-- .../CompileThenLinkTwoSteps/Image/helloWorld.d | 4 + .../2939_Ariovistus/Project/SConstruct_template | 14 ++-- .../2939_Ariovistus/Project/test/test1/SConscript | 4 + .../2939_Ariovistus/Project/test/test1/stuff.cpp | 4 + .../2939_Ariovistus/Project/test/test1/stuff.h | 4 + .../2939_Ariovistus/Project/test/test1/test1.cpp | 4 + .../2939_Ariovistus/Project/test/test1/test2.d | 4 + .../2940_Ariovistus/Project/SConstruct_template | 14 ++-- .../2940_Ariovistus/Project/test/test1/SConscript | 4 + .../2940_Ariovistus/Project/test/test1/stuff.cpp | 4 + .../2940_Ariovistus/Project/test/test1/stuff.h | 4 + .../2940_Ariovistus/Project/test/test1/test1.cpp | 4 + .../2940_Ariovistus/Project/test/test1/test2.d | 4 + test/D/Issues/2994/Project/SConstruct_template | 5 +- test/D/Issues/2994/Project/main.d | 4 + test/D/MixedDAndC/Image/SConstruct | 8 +- test/D/MixedDAndC/Image/cmod.c | 4 + test/D/MixedDAndC/Image/dmod.d | 4 + test/D/MixedDAndC/Image/proj.d | 4 + test/D/SharedObjects/Image/SConstruct_template | 4 +- test/D/SharedObjects/Image/code.d | 4 + test/Decider/MD5-winonly-fixture/SConstruct | 4 + test/Dir/DriveAbsPath/SConstruct | 34 +++++--- test/Dir/PyPackageDir/image/SConstruct | 4 + test/Docbook/basedir/htmlchunked/image/SConstruct | 5 ++ .../basedir/htmlchunked/image/SConstruct.cmd | 5 ++ test/Docbook/basedir/htmlhelp/image/SConstruct | 5 ++ test/Docbook/basedir/htmlhelp/image/SConstruct.cmd | 5 ++ test/Docbook/basedir/slideshtml/image/SConstruct | 5 ++ .../basedir/slideshtml/image/SConstruct.cmd | 5 ++ test/Docbook/basedir/slideshtml/image/xsltver.py | 4 + test/Docbook/basic/epub/image/SConstruct | 5 ++ test/Docbook/basic/epub/image/SConstruct.cmd | 5 ++ test/Docbook/basic/html/image/SConstruct | 5 ++ test/Docbook/basic/html/image/SConstruct.cmd | 5 ++ test/Docbook/basic/htmlchunked/image/SConstruct | 5 ++ .../Docbook/basic/htmlchunked/image/SConstruct.cmd | 5 ++ test/Docbook/basic/htmlhelp/image/SConstruct | 5 ++ test/Docbook/basic/htmlhelp/image/SConstruct.cmd | 5 ++ test/Docbook/basic/man/image/SConstruct | 5 ++ test/Docbook/basic/man/image/SConstruct.cmd | 5 ++ test/Docbook/basic/pdf/image/SConstruct | 5 ++ test/Docbook/basic/pdf/image/SConstruct.cmd | 5 ++ test/Docbook/basic/slideshtml/image/SConstruct | 11 ++- test/Docbook/basic/slideshtml/image/SConstruct.cmd | 11 ++- test/Docbook/basic/slideshtml/image/xsltver.py | 4 + test/Docbook/basic/slidespdf/image/SConstruct | 5 ++ test/Docbook/basic/slidespdf/image/SConstruct.cmd | 5 ++ test/Docbook/basic/xinclude/image/SConstruct | 5 ++ test/Docbook/basic/xslt/image/SConstruct | 8 +- test/Docbook/basic/xsltsubdir/image/SConstruct | 5 ++ .../basic/xsltsubdir/image/subdir/SConscript | 7 +- .../Docbook/dependencies/xinclude/image/SConstruct | 5 ++ test/Docbook/rootname/htmlchunked/image/SConstruct | 5 ++ test/Docbook/rootname/htmlhelp/image/SConstruct | 5 ++ test/Docbook/rootname/slideshtml/image/SConstruct | 5 ++ test/Docbook/rootname/slideshtml/image/xsltver.py | 4 + test/File/fixture/relpath/base/SConstruct | 26 ++++--- test/Fortran/fixture/myfortran.py | 4 + test/Fortran/fixture/myfortran_flags.py | 4 + test/Install/fixture/SConstruct-multi | 4 + test/Install/multi-dir/src/SConstruct | 4 + test/Java/Java-fixture/myjar.py | 4 + test/Java/Java-fixture/myjavac.py | 4 + test/Java/Java-fixture/myrmic.py | 4 + test/Java/java_version_image/SConstruct | 28 ++++--- .../java_version_image/com/sub/bar/Example4.java | 4 + .../java_version_image/com/sub/bar/Example5.java | 4 + .../java_version_image/com/sub/bar/Example6.java | 4 + .../java_version_image/com/sub/foo/Example1.java | 4 + .../java_version_image/com/sub/foo/Example2.java | 4 + .../java_version_image/com/sub/foo/Example3.java | 4 + test/Java/java_version_image/src1/Example7.java | 4 + test/Java/java_version_image/src2/Test.java | 4 + .../java_version_image/src4/NestedExample.java | 4 + test/Java/java_version_image/src5/TestSCons.java | 4 + test/Java/java_version_image/src6/TestSCons.java | 4 + test/LEX/lex_headerfile/spaced path/SConstruct | 6 +- test/LEX/lex_headerfile/spaced path/src/SConscript | 6 +- .../applelink_image/SConstruct_CurVers_CompatVers | 46 +++++++---- test/LINK/applelink_image/SConstruct_gh2580 | 4 + test/LINK/applelink_image/foo.c | 6 +- test/Libs/bug2903/SConstruct | 20 +++-- test/Libs/bug2903/SConstruct-libs | 12 ++- test/Libs/bug2903/lib.c | 4 + test/Libs/bug2903/main.c | 4 + test/MSVC/MSVC_BATCH-spaces-targetdir.py | 10 +-- test/MSVC/MSVC_BATCH-spaces-targetdir/SConstruct | 17 ++-- test/MSVC/MSVC_BATCH-spaces-targetdir/src/a.c | 6 +- test/MSVC/MSVC_BATCH-spaces-targetdir/src/b.c | 6 +- test/MSVC/MSVC_BATCH-spaces-targetdir/src/c.c | 6 +- test/MSVC/MSVC_USE_SCRIPT_ARGS-fixture/SConstruct | 4 + test/MSVC/VSWHERE-fixture/SConstruct | 5 ++ test/MSVC/msvc_fixture/SConstruct | 6 +- test/MSVC/msvc_fixture/StdAfx.cpp | 6 +- test/MSVC/msvc_fixture/StdAfx.h | 6 +- test/MSVC/msvc_fixture/foo.cpp | 6 +- test/MSVC/msvc_fixture/resource.h | 4 + test/MSVC/msvc_fixture/test.cpp | 6 +- test/MSVC/pch_gen/fixture/SConstruct | 36 +++++---- test/MinGW/bug_2799/SConstruct | 7 +- test/MinGW/bug_2799/module.c | 4 + test/MinGW/bug_2799/shlib.c | 4 + test/Parallel/failed-build/fixture/SConstruct | 15 +++- test/Parallel/failed-build/fixture/mycopy.py | 6 +- test/Parallel/failed-build/fixture/myfail.py | 6 +- test/Parallel/failed-build/fixture/teststate.py | 6 +- test/Progress/multi_target_fixture/SConstruct | 15 ++-- test/SConscript/fixture/SConstruct | 4 + test/SConscript/must_exist_deprecation.py | 2 +- test/Scanner/Python/SConstruct | 7 +- test/Scanner/Python/script.py | 4 + test/Scanner/Python/to_be_copied/__init__.py | 6 +- test/SideEffect/Issues/3013/files/SConscript | 4 + test/SideEffect/Issues/3013/files/SConstruct | 5 ++ test/SideEffect/Issues/3013/files/test.cpp | 4 + test/Subst/fixture/SConstruct.callable_exception | 8 +- .../fixture/SConstruct-tempfile-actionlist | 16 +++- test/TEMPFILE/fixture/SConstruct.tempfiledir | 5 ++ test/TaskMaster/bug_2811/fixture_dir/SConstruct | 13 ++-- test/TaskMaster/bug_2811/fixture_dir/mycopy.py | 4 + test/YACC/YACC-fixture/SConstruct_YACC_before | 9 ++- test/YACC/YACC-fixture/myyacc.py | 4 + test/YACC/YACCFLAGS-fixture/myyacc.py | 4 + test/fixture/SConstruct-check-valid-options | 2 + test/fixture/SConstruct_test_main.py | 4 + test/fixture/echo.py | 4 + test/fixture/mycompile.py | 4 + test/fixture/mygcc.py | 4 + test/fixture/mylex.py | 4 + test/fixture/mylink.py | 4 + test/fixture/myrewrite.py | 4 + test/fixture/no_msvc/no_msvcs_sconstruct.py | 14 +++- ..._msvcs_sconstruct_msvc_query_toolset_version.py | 14 +++- .../no_msvcs_sconstruct_msvc_sdk_versions.py | 14 +++- .../no_msvcs_sconstruct_msvc_toolset_versions.py | 14 +++- test/fixture/no_msvc/no_msvcs_sconstruct_tools.py | 11 ++- .../fixture/no_msvc/no_msvcs_sconstruct_version.py | 14 ++-- test/fixture/no_msvc/no_regs_sconstruct.py | 12 ++- .../python_scanner/curdir_reference/script.py | 4 + .../from_import_simple_package_module1.py | 4 + .../from_import_simple_package_module1_as.py | 4 + .../from_import_simple_package_module1_func.py | 6 +- .../from_import_simple_package_modules_no_space.py | 4 + ...rom_import_simple_package_modules_with_space.py | 4 + .../python_scanner/from_nested1_import_multiple.py | 6 +- .../import_simple_package_module1.py | 4 + .../import_simple_package_module1_as.py | 4 + test/fixture/python_scanner/imports_nested3.py | 4 + .../python_scanner/imports_simple_package.py | 4 + .../python_scanner/imports_unknown_files.py | 6 +- .../nested2/nested3/imports_grandparent_module.py | 4 + .../nested2/nested3/imports_parent_module.py | 4 + .../nested3/imports_parent_then_submodule.py | 4 + .../python_scanner/simple_package/module1.py | 6 +- test/fixture/test_main.c | 4 + test/fixture/wrapper.py | 4 + test/fixture/wrapper_with_args.py | 4 + test/ninja/ninja-fixture/bar.c | 4 + test/ninja/ninja-fixture/foo.c | 4 + test/ninja/ninja-fixture/gen_source.c | 4 + test/ninja/ninja-fixture/test1.c | 4 + test/ninja/ninja-fixture/test2.cpp | 6 +- test/ninja/ninja-fixture/test_impl.c | 4 + test/ninja/ninja_test_sconscripts/ninja_conftest | 9 ++- .../sconstruct_control_c_ninja | 4 + .../sconstruct_default_targets | 6 +- .../sconstruct_force_scons_callback | 4 + .../sconstruct_generate_and_build | 4 + .../sconstruct_generate_and_build_cxx | 4 + .../sconstruct_generated_sources_alias | 6 +- .../sconstruct_mingw_command_generator_action | 6 +- .../sconstruct_mingw_depfile_format | 4 + .../sconstruct_ninja_command_line | 4 + .../sconstruct_ninja_determinism | 4 + .../sconstruct_no_for_sig_subst | 4 + .../sconstruct_response_file | 6 +- test/option/fixture/SConstruct__experimental | 4 + test/option/fixture/SConstruct__taskmastertrace | 4 + test/option/hash-format/SConstruct | 4 + test/option/hash-format/build.py | 6 +- .../convenience-functions/image/SConstruct | 5 ++ test/packaging/rpm/src/main.c | 4 + test/packaging/sandbox-test/SConstruct | 30 +++++--- test/textfile/fixture/SConstruct | 13 +++- test/textfile/fixture/SConstruct.2 | 13 +++- test/textfile/fixture/SConstruct.issue-3540 | 15 ++-- test/textfile/fixture/SConstruct.issue-3550 | 4 + test/textfile/fixture/SConstruct.issue-4037 | 13 ++-- .../image/Libs/tools_example/Toolpath_TestTool1.py | 5 ++ .../tools_example/Toolpath_TestTool2/__init__.py | 5 ++ .../tools_example/subdir1/Toolpath_TestTool1_1.py | 5 ++ .../subdir1/Toolpath_TestTool1_2/__init__.py | 5 ++ .../subdir1/subdir2/Toolpath_TestTool2_1.py | 5 ++ .../subdir2/Toolpath_TestTool2_2/__init__.py | 5 ++ test/toolpath/nested/image/SConstruct | 90 ++++++++++++---------- .../site_scons/site_tools/Toolpath_TestTool1.py | 5 ++ .../site_tools/Toolpath_TestTool2/__init__.py | 5 ++ .../site_tools/subdir1/Toolpath_TestTool1_1.py | 5 ++ .../subdir1/Toolpath_TestTool1_2/__init__.py | 5 ++ .../subdir1/subdir2/Toolpath_TestTool2_1.py | 5 ++ .../subdir2/Toolpath_TestTool2_2/__init__.py | 5 ++ test/toolpath/relative_import/image/SConstruct | 15 ++-- .../image/tools/TestTool1/TestTool1_1.py | 5 ++ .../tools/TestTool1/TestTool1_2/TestTool1_2_1.py | 5 ++ .../TestTool1_2/TestTool1_2_2/__init__.py | 5 ++ .../image/tools/TestTool1/TestTool1_2/__init__.py | 5 ++ .../image/tools/TestTool1/__init__.py | 5 ++ 274 files changed, 1498 insertions(+), 350 deletions(-) diff --git a/test/AS/fixture/myas.py b/test/AS/fixture/myas.py index a348ace..b3d441c 100644 --- a/test/AS/fixture/myas.py +++ b/test/AS/fixture/myas.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys diff --git a/test/AS/fixture/myas_args.py b/test/AS/fixture/myas_args.py index 7a5e6fa..0249a9e 100644 --- a/test/AS/fixture/myas_args.py +++ b/test/AS/fixture/myas_args.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys diff --git a/test/Actions/addpost-link-fixture/strip.py b/test/Actions/addpost-link-fixture/strip.py index 88242f2..ad21dbc 100644 --- a/test/Actions/addpost-link-fixture/strip.py +++ b/test/Actions/addpost-link-fixture/strip.py @@ -1,2 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys + print("strip.py: %s" % " ".join(sys.argv[1:])) diff --git a/test/Actions/addpost-link-fixture/test1.c b/test/Actions/addpost-link-fixture/test1.c index 333f5c7..585021f 100644 --- a/test/Actions/addpost-link-fixture/test1.c +++ b/test/Actions/addpost-link-fixture/test1.c @@ -1,4 +1,9 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + extern void test_lib_fn(); + int main(int argc, char **argv) { test_lib_fn(); return 0; diff --git a/test/Actions/addpost-link-fixture/test_lib.c b/test/Actions/addpost-link-fixture/test_lib.c index 0ac1076..8bb0e60 100644 --- a/test/Actions/addpost-link-fixture/test_lib.c +++ b/test/Actions/addpost-link-fixture/test_lib.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include void test_lib_fn() { diff --git a/test/Actions/append-fixture/foo.c b/test/Actions/append-fixture/foo.c index e6428b5..83ab6e1 100644 --- a/test/Actions/append-fixture/foo.c +++ b/test/Actions/append-fixture/foo.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include int main(void) diff --git a/test/Actions/pre-post-fixture/work1/bar.c b/test/Actions/pre-post-fixture/work1/bar.c index eb3fd78..1ea20c1 100644 --- a/test/Actions/pre-post-fixture/work1/bar.c +++ b/test/Actions/pre-post-fixture/work1/bar.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include int main(void) diff --git a/test/Actions/pre-post-fixture/work1/foo.c b/test/Actions/pre-post-fixture/work1/foo.c index 32f2a3e..80d2e32 100644 --- a/test/Actions/pre-post-fixture/work1/foo.c +++ b/test/Actions/pre-post-fixture/work1/foo.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include int main(void) diff --git a/test/Actions/pre-post-fixture/work2/SConstruct b/test/Actions/pre-post-fixture/work2/SConstruct index e0af0ee..347dcbe 100644 --- a/test/Actions/pre-post-fixture/work2/SConstruct +++ b/test/Actions/pre-post-fixture/work2/SConstruct @@ -1,13 +1,19 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def b(target, source, env): with open(str(target[0]), 'wb') as f: f.write((env['X'] + '\n').encode()) + +DefaultEnvironment(tools=[]) env1 = Environment(X='111', tools=[]) env2 = Environment(X='222', tools=[]) -B = Builder(action = b, env = env1, multi=1) +B = Builder(action=b, env=env1, multi=1) print("B =", B) print("B.env =", B.env) -env1.Append(BUILDERS = {'B' : B}) -env2.Append(BUILDERS = {'B' : B}) +env1.Append(BUILDERS={'B': B}) +env2.Append(BUILDERS={'B': B}) env3 = env1.Clone(X='333') print("env1 =", env1) print("env2 =", env2) @@ -15,8 +21,10 @@ print("env3 =", env3) f1 = env1.B(File('file1.out'), []) f2 = env2.B('file2.out', []) f3 = env3.B('file3.out', []) + def do_nothing(env, target, source): pass + AddPreAction(f2[0], do_nothing) AddPostAction(f3[0], do_nothing) print("f1[0].builder =", f1[0].builder) diff --git a/test/Actions/pre-post-fixture/work3/SConstruct b/test/Actions/pre-post-fixture/work3/SConstruct index e0aa257..54f537a 100644 --- a/test/Actions/pre-post-fixture/work3/SConstruct +++ b/test/Actions/pre-post-fixture/work3/SConstruct @@ -1,10 +1,18 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def pre(target, source, env): pass + def post(target, source, env): pass + def build(target, source, env): with open(str(target[0]), 'wb') as f: f.write(b'build()\n') + +DefaultEnvironment(tools=[]) env = Environment(tools=[]) AddPreAction('dir', pre) AddPostAction('dir', post) diff --git a/test/Actions/pre-post-fixture/work4/build.py b/test/Actions/pre-post-fixture/work4/build.py index 390c8b9..2758b30 100644 --- a/test/Actions/pre-post-fixture/work4/build.py +++ b/test/Actions/pre-post-fixture/work4/build.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys + with open(sys.argv[1], 'wb') as outfp: for f in sys.argv[2:]: with open(f, 'rb') as infp: diff --git a/test/Actions/pre-post.py b/test/Actions/pre-post.py index ce8cbdc..ac6a96f 100644 --- a/test/Actions/pre-post.py +++ b/test/Actions/pre-post.py @@ -43,7 +43,7 @@ test.write(['work1', 'SConstruct'], """ import os.path import stat -# DefaultEnvironment(tools=[]) +DefaultEnvironment(tools=[]) env = Environment(XXX='bar%(_exe)s') def before(env, target, source): diff --git a/test/Actions/subst_shell_env-fixture/SConstruct b/test/Actions/subst_shell_env-fixture/SConstruct index 5ba822e..f6d5dc0 100644 --- a/test/Actions/subst_shell_env-fixture/SConstruct +++ b/test/Actions/subst_shell_env-fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys def custom_environment_expansion1(env, target, source, shell_env): @@ -16,6 +20,7 @@ def expand_this_generator(env, target, source, for_signature): def expand_that_generator(env, target, source, for_signature): return str(target[0]) + "_is_from_expansion" +DefaultEnvironment(tools=[]) env = Environment(tools=['textfile']) env['SHELL_ENV_GENERATORS'] = [custom_environment_expansion1, custom_environment_expansion2] diff --git a/test/Actions/unicode-signature-fixture/SConstruct b/test/Actions/unicode-signature-fixture/SConstruct index 4d466e1..95c969d 100644 --- a/test/Actions/unicode-signature-fixture/SConstruct +++ b/test/Actions/unicode-signature-fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + fnode = File(u'foo.txt') def funcact(target, source, env): @@ -7,6 +11,6 @@ def funcact(target, source, env): pass return 0 +DefaultEnvironment(tools=[]) env = Environment() - env.Command(fnode, [], ["echo $TARGET", funcact]) diff --git a/test/Batch/SConstruct_changed_sources_alwaysBuild b/test/Batch/SConstruct_changed_sources_alwaysBuild index dea7908..e6ae974 100644 --- a/test/Batch/SConstruct_changed_sources_alwaysBuild +++ b/test/Batch/SConstruct_changed_sources_alwaysBuild @@ -1,8 +1,10 @@ -# Testcase for tigris bug 2622 +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +"""Testcase for tigris bug 2622""" obj = Object('changed_sources_main.cpp') AlwaysBuild(obj) - program = Program('test', source=[obj]) - Default(program) diff --git a/test/Batch/changed_sources_main.cpp b/test/Batch/changed_sources_main.cpp index 810625a..886d0bc 100644 --- a/test/Batch/changed_sources_main.cpp +++ b/test/Batch/changed_sources_main.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation #include diff --git a/test/CC/CC-fixture/bar.c b/test/CC/CC-fixture/bar.c index de1e6e5..2ebfa66 100644 --- a/test/CC/CC-fixture/bar.c +++ b/test/CC/CC-fixture/bar.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/CC/CC-fixture/foo.c b/test/CC/CC-fixture/foo.c index de1e6e5..2ebfa66 100644 --- a/test/CC/CC-fixture/foo.c +++ b/test/CC/CC-fixture/foo.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/CC/CC-fixture/mycc.py b/test/CC/CC-fixture/mycc.py index eb11c87..0a0da59 100644 --- a/test/CC/CC-fixture/mycc.py +++ b/test/CC/CC-fixture/mycc.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony cc command for testing SCons. diff --git a/test/CC/CCVERSION-fixture/versioned.py b/test/CC/CCVERSION-fixture/versioned.py index 33dc574..b0f0978 100644 --- a/test/CC/CCVERSION-fixture/versioned.py +++ b/test/CC/CCVERSION-fixture/versioned.py @@ -1,5 +1,10 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import subprocess import sys + if '-dumpversion' in sys.argv: print('3.9.9') sys.exit(0) diff --git a/test/CC/gcc-non-utf8-fixture/gcc-non-utf8.py b/test/CC/gcc-non-utf8-fixture/gcc-non-utf8.py index 292e5cb..f42f957 100644 --- a/test/CC/gcc-non-utf8-fixture/gcc-non-utf8.py +++ b/test/CC/gcc-non-utf8-fixture/gcc-non-utf8.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys if __name__ == '__main__': diff --git a/test/CXX/CXX-fixture/myc++.py b/test/CXX/CXX-fixture/myc++.py index d369f61..65613c3 100644 --- a/test/CXX/CXX-fixture/myc++.py +++ b/test/CXX/CXX-fixture/myc++.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony c++ command for testing SCons. diff --git a/test/CacheDir/CACHEDIR_CLASS_fixture/SConstruct b/test/CacheDir/CACHEDIR_CLASS_fixture/SConstruct index 6ec40c6..db07dc6 100644 --- a/test/CacheDir/CACHEDIR_CLASS_fixture/SConstruct +++ b/test/CacheDir/CACHEDIR_CLASS_fixture/SConstruct @@ -1,12 +1,17 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons -class CustomCacheDir(SCons.CacheDir.CacheDir): +class CustomCacheDir(SCons.CacheDir.CacheDir): @classmethod def copy_to_cache(cls, env, src, dst): print("MY_CUSTOM_CACHEDIR_CLASS") super().copy_to_cache(env, src, dst) +DefaultEnvironment(tools=[]) env = Environment(tools=[]) env['CACHEDIR_CLASS'] = CustomCacheDir env.CacheDir('cache') -env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) \ No newline at end of file +env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) diff --git a/test/CacheDir/custom_cachedir_fixture/SConstruct b/test/CacheDir/custom_cachedir_fixture/SConstruct index 6389999..8d9c478 100644 --- a/test/CacheDir/custom_cachedir_fixture/SConstruct +++ b/test/CacheDir/custom_cachedir_fixture/SConstruct @@ -1,11 +1,16 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons -class CustomCacheDir(SCons.CacheDir.CacheDir): +class CustomCacheDir(SCons.CacheDir.CacheDir): @classmethod def copy_to_cache(cls, env, src, dst): print("MY_CUSTOM_CACHEDIR_CLASS") super().copy_to_cache(env, src, dst) +DefaultEnvironment(tools=[]) env = Environment(tools=[]) env.CacheDir('cache', CustomCacheDir) -env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) \ No newline at end of file +env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) diff --git a/test/CacheDir/double_cachedir_fixture/SConstruct b/test/CacheDir/double_cachedir_fixture/SConstruct index 322e286..34c27b0 100644 --- a/test/CacheDir/double_cachedir_fixture/SConstruct +++ b/test/CacheDir/double_cachedir_fixture/SConstruct @@ -1,6 +1,10 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons -class CustomCacheDir1(SCons.CacheDir.CacheDir): +class CustomCacheDir1(SCons.CacheDir.CacheDir): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) print("INSTANCIATED %s" % str(type(self).__name__)) @@ -11,7 +15,6 @@ class CustomCacheDir1(SCons.CacheDir.CacheDir): super().copy_to_cache(env, src, dst) class CustomCacheDir2(SCons.CacheDir.CacheDir): - def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) print("INSTANCIATED %s" % str(type(self).__name__)) @@ -21,6 +24,7 @@ class CustomCacheDir2(SCons.CacheDir.CacheDir): print("MY_CUSTOM_CACHEDIR_CLASS2") super().copy_to_cache(env, src, dst) +DefaultEnvironment(tools=[]) env = Environment(tools=[]) env.CacheDir('cache1', CustomCacheDir1) env.CacheDir('cache2', CustomCacheDir2) diff --git a/test/CacheDir/invalid_custom_cachedir_fixture/SConstruct b/test/CacheDir/invalid_custom_cachedir_fixture/SConstruct index ad467e0..78f1bc6 100644 --- a/test/CacheDir/invalid_custom_cachedir_fixture/SConstruct +++ b/test/CacheDir/invalid_custom_cachedir_fixture/SConstruct @@ -1,6 +1,11 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + class CustomCacheDir: pass +DefaultEnvironment(tools=[]) env = Environment(tools=[]) env.CacheDir('cache', CustomCacheDir) -env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) \ No newline at end of file +env.Command('file.out', 'file.in', Copy('$TARGET', '$SOURCE')) diff --git a/test/CacheDir/value_dependencies/SConstruct b/test/CacheDir/value_dependencies/SConstruct index 7b7e596..55c22ff 100644 --- a/test/CacheDir/value_dependencies/SConstruct +++ b/test/CacheDir/value_dependencies/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons.Node CacheDir('cache') @@ -7,8 +11,7 @@ def b(target, source, env): pass def scan(node, env, path): - # Have the node depend on a directory, which depends on an instance of - # SCons.Node.Python.Value. + """Have the node depend on a directory, which depends on a Value node.""" sample_dir = env.fs.Dir('dir2') env.Depends(sample_dir, env.Value('c')) return [sample_dir, env.Value('d'), env.Value(b'\x03\x0F', name='name3')] @@ -16,17 +19,16 @@ def scan(node, env, path): scanner = Scanner(function=scan, node_class=SCons.Node.Node) builder = Builder(action=b, source_scanner=scanner) +DefaultEnvironment(tools=[]) env = Environment() env.Append(BUILDERS={'B': builder}) # Create a node and a directory that each depend on an instance of # SCons.Node.Python.Value. sample_dir = env.fs.Dir('dir1') -env.Depends(sample_dir, - [env.Value('a'), env.Value(b'\x01\x0F', name='name1')]) +env.Depends(sample_dir, [env.Value('a'), env.Value(b'\x01\x0F', name='name1')]) sample_file = env.fs.File('testfile') -env.Depends(sample_file, - [env.Value('b'), env.Value(b'\x02\x0F', name='name2')]) +env.Depends(sample_file, [env.Value('b'), env.Value(b'\x02\x0F', name='name2')]) env.B(target='File1.out', source=[sample_dir, sample_file]) diff --git a/test/CompilationDatabase/fixture/SConstruct b/test/CompilationDatabase/fixture/SConstruct index bd2f780..47d35fb 100644 --- a/test/CompilationDatabase/fixture/SConstruct +++ b/test/CompilationDatabase/fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys DefaultEnvironment(tools=[]) diff --git a/test/CompilationDatabase/fixture/SConstruct_tempfile b/test/CompilationDatabase/fixture/SConstruct_tempfile index 6b95977..4bc5c14 100644 --- a/test/CompilationDatabase/fixture/SConstruct_tempfile +++ b/test/CompilationDatabase/fixture/SConstruct_tempfile @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys DefaultEnvironment(tools=[]) diff --git a/test/CompilationDatabase/fixture/SConstruct_variant b/test/CompilationDatabase/fixture/SConstruct_variant index ea461fb..eaf19e8 100644 --- a/test/CompilationDatabase/fixture/SConstruct_variant +++ b/test/CompilationDatabase/fixture/SConstruct_variant @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys DefaultEnvironment(tools=[]) diff --git a/test/Configure/conftest_source_file/SConstruct b/test/Configure/conftest_source_file/SConstruct index dd8d28e..521afc1 100644 --- a/test/Configure/conftest_source_file/SConstruct +++ b/test/Configure/conftest_source_file/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) env = Environment() env.Append(CPPPATH=['.']) @@ -5,4 +9,4 @@ conf1 = Configure(env) conf1.CheckHeader("header1.h") conf1.CheckHeader("header3.h") conf1.Finish() -env.Program('out', 'main.c') \ No newline at end of file +env.Program('out', 'main.c') diff --git a/test/Configure/conftest_source_file/header1.h b/test/Configure/conftest_source_file/header1.h index 85dcd68..336f921 100644 --- a/test/Configure/conftest_source_file/header1.h +++ b/test/Configure/conftest_source_file/header1.h @@ -1,2 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #pragma once -#include "header2.h" \ No newline at end of file +#include "header2.h" diff --git a/test/Configure/conftest_source_file/header2.h b/test/Configure/conftest_source_file/header2.h index 2cf8e90..90171bd 100644 --- a/test/Configure/conftest_source_file/header2.h +++ b/test/Configure/conftest_source_file/header2.h @@ -1,2 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #pragma once -int test_header = 1; \ No newline at end of file +int test_header = 1; diff --git a/test/Configure/conftest_source_file/header3.h b/test/Configure/conftest_source_file/header3.h index dc4359e..68d9765 100644 --- a/test/Configure/conftest_source_file/header3.h +++ b/test/Configure/conftest_source_file/header3.h @@ -1,2 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #pragma once -int test_header = 3; \ No newline at end of file +int test_header = 3; diff --git a/test/Configure/conftest_source_file/main.c b/test/Configure/conftest_source_file/main.c index a9f9570..e6ef776 100644 --- a/test/Configure/conftest_source_file/main.c +++ b/test/Configure/conftest_source_file/main.c @@ -1,2 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "header1.h" -int main(){return 0;} \ No newline at end of file +int main(){return 0;} diff --git a/test/Configure/fixture/SConstruct.issue-2906 b/test/Configure/fixture/SConstruct.issue-2906 index 7763653..87a4d9e 100644 --- a/test/Configure/fixture/SConstruct.issue-2906 +++ b/test/Configure/fixture/SConstruct.issue-2906 @@ -1,5 +1,10 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# +DefaultEnvironment(tools=[]) env = Environment() conf1 = Configure(env) env2 = Environment() # Error right here. You can't have two configure contexts in flight at the same time. -conf2 = Configure(env2) \ No newline at end of file +conf2 = Configure(env2) diff --git a/test/Configure/is_conftest/fixture/SConstruct b/test/Configure/is_conftest/fixture/SConstruct index b0d4288..5494ea5 100644 --- a/test/Configure/is_conftest/fixture/SConstruct +++ b/test/Configure/is_conftest/fixture/SConstruct @@ -1,9 +1,11 @@ -""" -Test the nodes are created as conftest nodes in configure tests. -""" +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +"""Test the nodes are created as conftest nodes in configure tests.""" import sys -DefaultEnvironment(tools=[]) +DefaultEnvironment(tools=[]) env = Environment() conf = Configure(env) diff --git a/test/Configure/issue-2906-useful-duplicate-configure-message.py b/test/Configure/issue-2906-useful-duplicate-configure-message.py index 94c55c0..8fe3f8f 100644 --- a/test/Configure/issue-2906-useful-duplicate-configure-message.py +++ b/test/Configure/issue-2906-useful-duplicate-configure-message.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 useful error message when you create a second Configure context without @@ -44,7 +43,7 @@ expected_stdout = "scons: Reading SConscript files ...\n" expected_stderr = """ scons: *** Configure() called while another Configure() exists. Please call .Finish() before creating and second Configure() context -File "%s", line 5, in \n"""%test_SConstruct_path +File "%s", line 10, in \n"""%test_SConstruct_path test.run(stderr=expected_stderr, stdout=expected_stdout, status=2) test.pass_test() diff --git a/test/Configure/issue-3469/fixture/SConstruct b/test/Configure/issue-3469/fixture/SConstruct index ae1fb30..93d91a7 100644 --- a/test/Configure/issue-3469/fixture/SConstruct +++ b/test/Configure/issue-3469/fixture/SConstruct @@ -8,7 +8,6 @@ Github issue #3469 """ DefaultEnvironment(tools=[]) - vars = Variables() vars.Add(BoolVariable('SKIP', 'Skip Middle Conf test', False)) env = Environment(variables=vars) diff --git a/test/D/AllAtOnce/Image/SConstruct_template b/test/D/AllAtOnce/Image/SConstruct_template index 89d058e..0faf715 100644 --- a/test/D/AllAtOnce/Image/SConstruct_template +++ b/test/D/AllAtOnce/Image/SConstruct_template @@ -1,13 +1,19 @@ -# -*- coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os +DefaultEnvironment(tools=[]) environment = Environment( tools=['{}', 'link'], ) -environment.ProgramAllAtOnce('project', [ -'main.d', -'amod.d', -'bmod.d', -]) +environment.ProgramAllAtOnce( + 'project', + [ + 'main.d', + 'amod.d', + 'bmod.d', + ], +) diff --git a/test/D/AllAtOnce/Image/amod.d b/test/D/AllAtOnce/Image/amod.d index a32aa75..0da2a0e 100644 --- a/test/D/AllAtOnce/Image/amod.d +++ b/test/D/AllAtOnce/Image/amod.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; void print_message() { diff --git a/test/D/AllAtOnce/Image/bmod.d b/test/D/AllAtOnce/Image/bmod.d index e4c1e1b..ad99d39 100644 --- a/test/D/AllAtOnce/Image/bmod.d +++ b/test/D/AllAtOnce/Image/bmod.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int calculate_value() { return 42; } diff --git a/test/D/AllAtOnce/Image/main.d b/test/D/AllAtOnce/Image/main.d index 8b99458..f892525 100644 --- a/test/D/AllAtOnce/Image/main.d +++ b/test/D/AllAtOnce/Image/main.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio: writefln; import amod: print_message; import bmod: calculate_value; diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template index e91343b..b67f043 100644 --- a/test/D/CoreScanner/Image/SConstruct_template +++ b/test/D/CoreScanner/Image/SConstruct_template @@ -1,8 +1,10 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -environment = Environment( - tools=['link', '{}']) +DefaultEnvironment(tools=[]) +environment = Environment(tools=['link', '{}']) environment.Program('test1.d') environment.Program('test2.d') diff --git a/test/D/CoreScanner/Image/ignored.d b/test/D/CoreScanner/Image/ignored.d index 5b54a07..bcff3b7 100644 --- a/test/D/CoreScanner/Image/ignored.d +++ b/test/D/CoreScanner/Image/ignored.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module ignored; int something; diff --git a/test/D/CoreScanner/Image/module1.d b/test/D/CoreScanner/Image/module1.d index 487c358..1423a0a 100644 --- a/test/D/CoreScanner/Image/module1.d +++ b/test/D/CoreScanner/Image/module1.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module module1; int something; diff --git a/test/D/CoreScanner/Image/module2.d b/test/D/CoreScanner/Image/module2.d index 198fb74..41f1aab 100644 --- a/test/D/CoreScanner/Image/module2.d +++ b/test/D/CoreScanner/Image/module2.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module module2; int something; diff --git a/test/D/CoreScanner/Image/p/ignored.d b/test/D/CoreScanner/Image/p/ignored.d index 43d2bd8..c01e057 100644 --- a/test/D/CoreScanner/Image/p/ignored.d +++ b/test/D/CoreScanner/Image/p/ignored.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module p.ignored; int something; diff --git a/test/D/CoreScanner/Image/p/submodule1.d b/test/D/CoreScanner/Image/p/submodule1.d index 1ec0369..c4e1be4 100644 --- a/test/D/CoreScanner/Image/p/submodule1.d +++ b/test/D/CoreScanner/Image/p/submodule1.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module p.submodule1; int something; diff --git a/test/D/CoreScanner/Image/p/submodule2.d b/test/D/CoreScanner/Image/p/submodule2.d index 57a2825..f59116c 100644 --- a/test/D/CoreScanner/Image/p/submodule2.d +++ b/test/D/CoreScanner/Image/p/submodule2.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module p.submodule2; int something; diff --git a/test/D/CoreScanner/Image/test1.d b/test/D/CoreScanner/Image/test1.d index d386d97..4ca6799 100644 --- a/test/D/CoreScanner/Image/test1.d +++ b/test/D/CoreScanner/Image/test1.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import module1; import module2; import module3; diff --git a/test/D/CoreScanner/Image/test2.d b/test/D/CoreScanner/Image/test2.d index f880d2f..dd43cfa 100644 --- a/test/D/CoreScanner/Image/test2.d +++ b/test/D/CoreScanner/Image/test2.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import module1, module2, diff --git a/test/D/HSTeoh/ArLibIssue/SConstruct_template b/test/D/HSTeoh/ArLibIssue/SConstruct_template index b17847a..a39c228 100644 --- a/test/D/HSTeoh/ArLibIssue/SConstruct_template +++ b/test/D/HSTeoh/ArLibIssue/SConstruct_template @@ -1,6 +1,10 @@ -env = Environment({}) +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd +DefaultEnvironment(tools=[]) +env = Environment({}) +env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd env.StaticLibrary('mylib', ['a.d', 'b.d']) diff --git a/test/D/HSTeoh/LibCompileOptions/SConstruct_template b/test/D/HSTeoh/LibCompileOptions/SConstruct_template index 1489624..b2fde06 100644 --- a/test/D/HSTeoh/LibCompileOptions/SConstruct_template +++ b/test/D/HSTeoh/LibCompileOptions/SConstruct_template @@ -1,12 +1,12 @@ -env = Environment({}) +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd +DefaultEnvironment(tools=[]) +env = Environment({}) +env['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd env.Library('mylib', 'mylib.d') - -prog_env = env.Clone( - LIBS = ['mylib'], - LIBPATH = '#' - ) +prog_env = env.Clone(LIBS=['mylib'], LIBPATH='#') prog_env.Program('prog', 'prog.d') diff --git a/test/D/HSTeoh/LibCompileOptions/prog.d b/test/D/HSTeoh/LibCompileOptions/prog.d index 33c14ce..079a8df 100644 --- a/test/D/HSTeoh/LibCompileOptions/prog.d +++ b/test/D/HSTeoh/LibCompileOptions/prog.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int main() { return 0; } diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template index 2c53b54..993f14c 100644 --- a/test/D/HSTeoh/LinkingProblem/SConstruct_template +++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template @@ -1,20 +1,17 @@ -# -*- mode:python; coding=utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -environment = Environment( - tools = ['cc', '{}', 'link'], - LIBS = ['ncurses']) - +DefaultEnvironment(tools=[]) +environment = Environment(tools=['cc', '{}', 'link'], LIBS=['ncurses']) environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd - environment.Object('ncurs_impl.o', 'ncurs_impl.c') - environment.Program('prog', Split(""" prog.d ncurs_impl.o """)) - environment.Program('cprog', Split(""" cprog.c ncurs_impl.o diff --git a/test/D/HSTeoh/LinkingProblem/cprog.c b/test/D/HSTeoh/LinkingProblem/cprog.c index 674fd96..a70ea29 100644 --- a/test/D/HSTeoh/LinkingProblem/cprog.c +++ b/test/D/HSTeoh/LinkingProblem/cprog.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + extern void ncurs_init(); extern void ncurs_cleanup(); diff --git a/test/D/HSTeoh/LinkingProblem/ncurs_impl.c b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c index 3ca6dd3..93e8276 100644 --- a/test/D/HSTeoh/LinkingProblem/ncurs_impl.c +++ b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + /* Ncurses wrappers */ #include diff --git a/test/D/HSTeoh/LinkingProblem/prog.d b/test/D/HSTeoh/LinkingProblem/prog.d index 1337210..72d4099 100644 --- a/test/D/HSTeoh/LinkingProblem/prog.d +++ b/test/D/HSTeoh/LinkingProblem/prog.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + /* * Simple D program that links to ncurses via a C wrapping file. */ diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template index 118a7b2..1c75620 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template @@ -1,12 +1,17 @@ -# -*- mode:python; coding=utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os +DefaultEnvironment(tools=[]) environment = Environment( tools=['link', '{}'], - # It might be thought that a single string can contain multiple options space separated. Actually this - # is deemed to be a single option, so leads to an error. - DFLAGS = '-m64 -O') + # It might be thought that a single string can contain multiple + # options space separated. Actually this is deemed to be a single option, + # so leads to an error. + DFLAGS='-m64 -O', +) environment.Program('proj', Split(""" proj.d diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c index 41c57f3..517c7e3 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + /* This is a sample C module. */ int csqr(int arg) { diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d index 5f61802..165514b 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module mod1; import std.stdio; diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d index e97f9dd..64d360a 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; import mod1; diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template index e2e7439..a6a9b80 100644 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template @@ -1,8 +1,9 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -environment = Environment( - tools=['link', '{}']) - +DefaultEnvironment(tools=[]) +environment = Environment(tools=['link', '{}']) environment.Program('helloWorld.d') diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d b/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d index 4d95b24..e9bc225 100644 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; int main(immutable string[] args) { diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template index b38a9f0..3fa6860 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template @@ -1,10 +1,10 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -environment = Environment( - tools=['link', '{}']) - +DefaultEnvironment(tools=[]) +environment = Environment(tools=['link', '{}']) objects = environment.Object('helloWorld.d') - environment.Program('helloWorld', objects) diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d index 4d95b24..e9bc225 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; int main(immutable string[] args) { diff --git a/test/D/Issues/2939_Ariovistus/Project/SConstruct_template b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template index c78ba96..9202c45 100644 --- a/test/D/Issues/2939_Ariovistus/Project/SConstruct_template +++ b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template @@ -1,12 +1,12 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +import os from os.path import join +DefaultEnvironment(tools=[]) environment = Environment({}) - -import os environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd - Export('environment') - -environment.SConscript([ - join("test","test1", "SConscript"), -]); +environment.SConscript([join("test","test1", "SConscript")]); diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript b/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript index 53a1ca0..4b0d579 100644 --- a/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + Import('environment') env = Environment() diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp index 2970549..a19fb34 100644 --- a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "stuff.h" X::X() { diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h index 863c330..6dc578d 100644 --- a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + class X { public: diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp b/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp index f4d7208..b995685 100644 --- a/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "stuff.h" int main() { diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d b/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d index 4fbfa4d..07179c1 100644 --- a/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; struct X { diff --git a/test/D/Issues/2940_Ariovistus/Project/SConstruct_template b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template index c78ba96..00fd2b7 100644 --- a/test/D/Issues/2940_Ariovistus/Project/SConstruct_template +++ b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template @@ -1,12 +1,12 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +import os from os.path import join +DefaultEnvironment(tools=[]) environment = Environment({}) - -import os environment['ENV']['HOME'] = os.environ['HOME'] # Hack for gdmd - Export('environment') - -environment.SConscript([ - join("test","test1", "SConscript"), -]); +environment.SConscript([join("test","test1", "SConscript")]) diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript b/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript index 45e517a..00aaf14 100644 --- a/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + Import('environment') env = Environment() diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp index 2970549..a19fb34 100644 --- a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "stuff.h" X::X() { diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h index 863c330..6dc578d 100644 --- a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + class X { public: diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp b/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp index f4d7208..b995685 100644 --- a/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "stuff.h" int main() { diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d b/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d index 4fbfa4d..07179c1 100644 --- a/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; struct X { diff --git a/test/D/Issues/2994/Project/SConstruct_template b/test/D/Issues/2994/Project/SConstruct_template index 555b1b0..3d1bbc6 100644 --- a/test/D/Issues/2994/Project/SConstruct_template +++ b/test/D/Issues/2994/Project/SConstruct_template @@ -1,5 +1,8 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +DefaultEnvironment(tools=[]) env=Environment({}) change = ARGUMENTS.get('change', 0) diff --git a/test/D/Issues/2994/Project/main.d b/test/D/Issues/2994/Project/main.d index f0aa23a..8bea7ff 100644 --- a/test/D/Issues/2994/Project/main.d +++ b/test/D/Issues/2994/Project/main.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + /* This program prints a hello world message to the console. */ diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct index f24e2b3..d104e2f 100644 --- a/test/D/MixedDAndC/Image/SConstruct +++ b/test/D/MixedDAndC/Image/SConstruct @@ -1,9 +1,11 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation import os -environment = Environment( -) +DefaultEnvironment(tools=[]) +environment = Environment() # CFLAGS=['-m64'], # DLINKFLAGS=['-m64'], # DFLAGS=['-m64', '-O']) diff --git a/test/D/MixedDAndC/Image/cmod.c b/test/D/MixedDAndC/Image/cmod.c index 31be5e9..72ace7b 100644 --- a/test/D/MixedDAndC/Image/cmod.c +++ b/test/D/MixedDAndC/Image/cmod.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int csqr(int arg) { return arg*arg; } diff --git a/test/D/MixedDAndC/Image/dmod.d b/test/D/MixedDAndC/Image/dmod.d index c609b9c..4ab1b39 100644 --- a/test/D/MixedDAndC/Image/dmod.d +++ b/test/D/MixedDAndC/Image/dmod.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + module dmod; import std.stdio; diff --git a/test/D/MixedDAndC/Image/proj.d b/test/D/MixedDAndC/Image/proj.d index 3e0bf95..2da7057 100644 --- a/test/D/MixedDAndC/Image/proj.d +++ b/test/D/MixedDAndC/Image/proj.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + import std.stdio; import dmod; diff --git a/test/D/SharedObjects/Image/SConstruct_template b/test/D/SharedObjects/Image/SConstruct_template index 7ae1c8d..f852c09 100644 --- a/test/D/SharedObjects/Image/SConstruct_template +++ b/test/D/SharedObjects/Image/SConstruct_template @@ -1,4 +1,6 @@ -# -*- mode:python; coding:utf-8; -*- +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation # The core difference between this test and the one of SharedObjectSuffixIssue # is that here we explicitly use the relevant D tool and things work. diff --git a/test/D/SharedObjects/Image/code.d b/test/D/SharedObjects/Image/code.d index 0d9d1d7..2073b31 100644 --- a/test/D/SharedObjects/Image/code.d +++ b/test/D/SharedObjects/Image/code.d @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int returnTheAnswer() { return 42; } diff --git a/test/Decider/MD5-winonly-fixture/SConstruct b/test/Decider/MD5-winonly-fixture/SConstruct index 9775a43..9eb66a3 100644 --- a/test/Decider/MD5-winonly-fixture/SConstruct +++ b/test/Decider/MD5-winonly-fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) env=Environment() env.Decider('MD5-timestamp') diff --git a/test/Dir/DriveAbsPath/SConstruct b/test/Dir/DriveAbsPath/SConstruct index 5b63193..598723d 100644 --- a/test/Dir/DriveAbsPath/SConstruct +++ b/test/Dir/DriveAbsPath/SConstruct @@ -1,32 +1,42 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import SCons +DefaultEnvironment(tools=[]) env = Environment() drive = os.path.splitdrive(os.getcwd())[0] drive_dir = env.fs.Dir(drive) if not isinstance(drive_dir, SCons.Node.FS.RootDir): - raise Exception('env.fs.Dir("%s") returned a %s instead of a RootDir' % - (drive, type(drive_dir))) + raise Exception( + f'env.fs.Dir("{drive}") returned a {type(drive_dir)} instead of a RootDir' + ) drive_abspath1 = drive_dir._abspath drive_abspath2 = drive_dir.abspath if drive_abspath1 != drive_abspath2: - raise Exception('Calculated _abspath %s is not the same as abspath %s' % - (drive_abspath1, drive_abspath2)) + raise Exception( + f'Calculated _abspath {drive_abspath1} is not the same as abspath {drive_abspath2}' + ) elif not os.path.exists(drive_abspath1): - raise Exception('Calculated abspath %s does not exist' % drive_abspath1) + raise Exception(f'Calculated abspath {drive_abspath1} does not exist') elif drive.rstrip(os.path.sep) != drive_abspath1.rstrip(os.path.sep): - raise Exception('Real drive %s and calculated abspath %s are not the ' - 'same' % (drive, drive_abspath1)) + raise Exception( + f'Real drive {drive} and calculated abspath {drive_abspath1} are not the same' + ) drive_path1 = drive_dir._path drive_path2 = drive_dir.path if drive_path1 != drive_path2: - raise Exception('Calculated _path %s is not the same as path %s' % - (drive_path1, drive_path2)) + raise Exception( + f'Calculated _path {drive_path1} is not the same as path {drive_path2}' + ) elif not os.path.exists(drive_path1): - raise Exception('Calculated path %s does not exist' % drive_path1) + raise Exception(f'Calculated path {drive_path1} does not exist') elif drive.rstrip(os.path.sep) != drive_path1.rstrip(os.path.sep): - raise Exception('Real drive %s and calculated abspath %s are not the ' - 'same' % (drive, drive_abs)) + raise Exception( + f'Real drive {drive} and calculated abspath {drive_abs} are not the same' + ) diff --git a/test/Dir/PyPackageDir/image/SConstruct b/test/Dir/PyPackageDir/image/SConstruct index aceb245..d09b472 100644 --- a/test/Dir/PyPackageDir/image/SConstruct +++ b/test/Dir/PyPackageDir/image/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys, os oldsyspath = sys.path diff --git a/test/Docbook/basedir/htmlchunked/image/SConstruct b/test/Docbook/basedir/htmlchunked/image/SConstruct index 0066271..87a4658 100644 --- a/test/Docbook/basedir/htmlchunked/image/SConstruct +++ b/test/Docbook/basedir/htmlchunked/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlChunked('manual', xsl='html.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd index d981b28..40dc569 100644 --- a/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd +++ b/test/Docbook/basedir/htmlchunked/image/SConstruct.cmd @@ -1,2 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) env.DocbookHtmlChunked('manual', xsl='html.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/htmlhelp/image/SConstruct b/test/Docbook/basedir/htmlhelp/image/SConstruct index cb2893f..3ca5e8f 100644 --- a/test/Docbook/basedir/htmlhelp/image/SConstruct +++ b/test/Docbook/basedir/htmlhelp/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd index 8c7c9ca..f76e99b 100644 --- a/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd +++ b/test/Docbook/basedir/htmlhelp/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) env.DocbookHtmlhelp('manual', xsl='htmlhelp.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/slideshtml/image/SConstruct b/test/Docbook/basedir/slideshtml/image/SConstruct index 2bb86f0..f9b02dd 100644 --- a/test/Docbook/basedir/slideshtml/image/SConstruct +++ b/test/Docbook/basedir/slideshtml/image/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import xsltver v = xsltver.detectXsltVersion('/usr/share/xml/docbook/stylesheet/docbook-xsl') @@ -7,6 +11,7 @@ if v >= (1, 78, 0): # Use namespace-aware input file ns_ext = 'ns' +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookSlidesHtml('virt'+ns_ext, xsl='slides.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/slideshtml/image/SConstruct.cmd b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd index f82444d..151e603 100644 --- a/test/Docbook/basedir/slideshtml/image/SConstruct.cmd +++ b/test/Docbook/basedir/slideshtml/image/SConstruct.cmd @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import xsltver v = xsltver.detectXsltVersion('/usr/share/xml/docbook/stylesheet/docbook-xsl') @@ -7,6 +11,7 @@ if v >= (1, 78, 0): # Use namespace-aware input file ns_ext = 'ns' +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) env.Append(DOCBOOK_XSLTPROCFLAGS=['--novalid', '--nonet']) env.DocbookSlidesHtml('virt'+ns_ext, xsl='slides.xsl', base_dir='output/') diff --git a/test/Docbook/basedir/slideshtml/image/xsltver.py b/test/Docbook/basedir/slideshtml/image/xsltver.py index c845324..e1a7074 100644 --- a/test/Docbook/basedir/slideshtml/image/xsltver.py +++ b/test/Docbook/basedir/slideshtml/image/xsltver.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import re diff --git a/test/Docbook/basic/epub/image/SConstruct b/test/Docbook/basic/epub/image/SConstruct index 16a0699..3f4996d 100644 --- a/test/Docbook/basic/epub/image/SConstruct +++ b/test/Docbook/basic/epub/image/SConstruct @@ -1,2 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookEpub('manual') diff --git a/test/Docbook/basic/epub/image/SConstruct.cmd b/test/Docbook/basic/epub/image/SConstruct.cmd index 9b5e4cb..b86c78d 100644 --- a/test/Docbook/basic/epub/image/SConstruct.cmd +++ b/test/Docbook/basic/epub/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/html/image/SConstruct b/test/Docbook/basic/html/image/SConstruct index 954e639..4a9d074 100644 --- a/test/Docbook/basic/html/image/SConstruct +++ b/test/Docbook/basic/html/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtml('manual') diff --git a/test/Docbook/basic/html/image/SConstruct.cmd b/test/Docbook/basic/html/image/SConstruct.cmd index 3e58102..ef4eceb 100644 --- a/test/Docbook/basic/html/image/SConstruct.cmd +++ b/test/Docbook/basic/html/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/htmlchunked/image/SConstruct b/test/Docbook/basic/htmlchunked/image/SConstruct index 0004f8b..05a617f 100644 --- a/test/Docbook/basic/htmlchunked/image/SConstruct +++ b/test/Docbook/basic/htmlchunked/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlChunked('manual') diff --git a/test/Docbook/basic/htmlchunked/image/SConstruct.cmd b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd index 8734147..765864a 100644 --- a/test/Docbook/basic/htmlchunked/image/SConstruct.cmd +++ b/test/Docbook/basic/htmlchunked/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/htmlhelp/image/SConstruct b/test/Docbook/basic/htmlhelp/image/SConstruct index 0c793d4..433a1c3 100644 --- a/test/Docbook/basic/htmlhelp/image/SConstruct +++ b/test/Docbook/basic/htmlhelp/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual') diff --git a/test/Docbook/basic/htmlhelp/image/SConstruct.cmd b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd index e3e0193..854a266 100644 --- a/test/Docbook/basic/htmlhelp/image/SConstruct.cmd +++ b/test/Docbook/basic/htmlhelp/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/man/image/SConstruct b/test/Docbook/basic/man/image/SConstruct index ddfcfbc..2dcdb6e 100644 --- a/test/Docbook/basic/man/image/SConstruct +++ b/test/Docbook/basic/man/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookMan('refdb') diff --git a/test/Docbook/basic/man/image/SConstruct.cmd b/test/Docbook/basic/man/image/SConstruct.cmd index 122c0ce..6474f49 100644 --- a/test/Docbook/basic/man/image/SConstruct.cmd +++ b/test/Docbook/basic/man/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/pdf/image/SConstruct b/test/Docbook/basic/pdf/image/SConstruct index 01b2c7f..e863047 100644 --- a/test/Docbook/basic/pdf/image/SConstruct +++ b/test/Docbook/basic/pdf/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookPdf('manual') diff --git a/test/Docbook/basic/pdf/image/SConstruct.cmd b/test/Docbook/basic/pdf/image/SConstruct.cmd index db1ed18..5d70905 100644 --- a/test/Docbook/basic/pdf/image/SConstruct.cmd +++ b/test/Docbook/basic/pdf/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) DOCBOOK_XSLTPROC = ARGUMENTS.get('DOCBOOK_XSLTPROC', "") if DOCBOOK_XSLTPROC: diff --git a/test/Docbook/basic/slideshtml/image/SConstruct b/test/Docbook/basic/slideshtml/image/SConstruct index e1437da..a14f9ae 100644 --- a/test/Docbook/basic/slideshtml/image/SConstruct +++ b/test/Docbook/basic/slideshtml/image/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import xsltver v = xsltver.detectXsltVersion('/usr/share/xml/docbook/stylesheet/docbook-xsl') @@ -7,6 +11,9 @@ if v >= (1, 78, 0): # Use namespace-aware input file ns_ext = 'ns' +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) -env.DocbookSlidesHtml('virt'+ns_ext, xsl='/usr/share/xml/docbook/stylesheet/docbook-xsl/slides/xhtml/plain.xsl') - +env.DocbookSlidesHtml( + 'virt' + ns_ext, + xsl='/usr/share/xml/docbook/stylesheet/docbook-xsl/slides/xhtml/plain.xsl', +) diff --git a/test/Docbook/basic/slideshtml/image/SConstruct.cmd b/test/Docbook/basic/slideshtml/image/SConstruct.cmd index 08cbc31..2090bf0 100644 --- a/test/Docbook/basic/slideshtml/image/SConstruct.cmd +++ b/test/Docbook/basic/slideshtml/image/SConstruct.cmd @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import xsltver v = xsltver.detectXsltVersion('/usr/share/xml/docbook/stylesheet/docbook-xsl') @@ -7,7 +11,10 @@ if v >= (1, 78, 0): # Use namespace-aware input file ns_ext = 'ns' +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) env.Append(DOCBOOK_XSLTPROCFLAGS=['--novalid', '--nonet']) -env.DocbookSlidesHtml('virt'+ns_ext, xsl='/usr/share/xml/docbook/stylesheet/docbook-xsl/slides/xhtml/plain.xsl') - +env.DocbookSlidesHtml( + 'virt' + ns_ext, + xsl='/usr/share/xml/docbook/stylesheet/docbook-xsl/slides/xhtml/plain.xsl', +) diff --git a/test/Docbook/basic/slideshtml/image/xsltver.py b/test/Docbook/basic/slideshtml/image/xsltver.py index c845324..e1a7074 100644 --- a/test/Docbook/basic/slideshtml/image/xsltver.py +++ b/test/Docbook/basic/slideshtml/image/xsltver.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import re diff --git a/test/Docbook/basic/slidespdf/image/SConstruct b/test/Docbook/basic/slidespdf/image/SConstruct index e103f02..fbe359c 100644 --- a/test/Docbook/basic/slidespdf/image/SConstruct +++ b/test/Docbook/basic/slidespdf/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookSlidesPdf('virt') diff --git a/test/Docbook/basic/slidespdf/image/SConstruct.cmd b/test/Docbook/basic/slidespdf/image/SConstruct.cmd index 2000713..18ef25b 100644 --- a/test/Docbook/basic/slidespdf/image/SConstruct.cmd +++ b/test/Docbook/basic/slidespdf/image/SConstruct.cmd @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(DOCBOOK_PREFER_XSLTPROC=1, tools=['docbook']) env.Append(DOCBOOK_XSLTPROCFLAGS=['--novalid', '--nonet']) env.DocbookSlidesPdf('virt') diff --git a/test/Docbook/basic/xinclude/image/SConstruct b/test/Docbook/basic/xinclude/image/SConstruct index 91d92e6..a571345 100644 --- a/test/Docbook/basic/xinclude/image/SConstruct +++ b/test/Docbook/basic/xinclude/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookXInclude('manual_xi.xml','manual.xml') diff --git a/test/Docbook/basic/xslt/image/SConstruct b/test/Docbook/basic/xslt/image/SConstruct index 3e8ac4a..8ae620a 100644 --- a/test/Docbook/basic/xslt/image/SConstruct +++ b/test/Docbook/basic/xslt/image/SConstruct @@ -1,9 +1,13 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) # # Create document # -env.DocbookXslt('out.xml', 'in.xml', - xsl='./to_docbook.xslt') +env.DocbookXslt('out.xml', 'in.xml', xsl='./to_docbook.xslt') diff --git a/test/Docbook/basic/xsltsubdir/image/SConstruct b/test/Docbook/basic/xsltsubdir/image/SConstruct index 4fe062a..b01da8c 100644 --- a/test/Docbook/basic/xsltsubdir/image/SConstruct +++ b/test/Docbook/basic/xsltsubdir/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) SConscript('subdir/SConscript', 'env') diff --git a/test/Docbook/basic/xsltsubdir/image/subdir/SConscript b/test/Docbook/basic/xsltsubdir/image/subdir/SConscript index ea19df5..d88eaf5 100644 --- a/test/Docbook/basic/xsltsubdir/image/subdir/SConscript +++ b/test/Docbook/basic/xsltsubdir/image/subdir/SConscript @@ -1,7 +1,10 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + Import('env') # # Create document # -env.DocbookXslt('out.xml', 'in.xml', - xsl='to_docbook.xslt') +env.DocbookXslt('out.xml', 'in.xml', xsl='to_docbook.xslt') diff --git a/test/Docbook/dependencies/xinclude/image/SConstruct b/test/Docbook/dependencies/xinclude/image/SConstruct index 91d92e6..a571345 100644 --- a/test/Docbook/dependencies/xinclude/image/SConstruct +++ b/test/Docbook/dependencies/xinclude/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookXInclude('manual_xi.xml','manual.xml') diff --git a/test/Docbook/rootname/htmlchunked/image/SConstruct b/test/Docbook/rootname/htmlchunked/image/SConstruct index 905eec1..1187960 100644 --- a/test/Docbook/rootname/htmlchunked/image/SConstruct +++ b/test/Docbook/rootname/htmlchunked/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlChunked('manual.html','manual', xsl='html.xsl') diff --git a/test/Docbook/rootname/htmlhelp/image/SConstruct b/test/Docbook/rootname/htmlhelp/image/SConstruct index 913240b..93cd473 100644 --- a/test/Docbook/rootname/htmlhelp/image/SConstruct +++ b/test/Docbook/rootname/htmlhelp/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookHtmlhelp('manual.html', 'manual', xsl='htmlhelp.xsl') diff --git a/test/Docbook/rootname/slideshtml/image/SConstruct b/test/Docbook/rootname/slideshtml/image/SConstruct index 4f1079e..2181936 100644 --- a/test/Docbook/rootname/slideshtml/image/SConstruct +++ b/test/Docbook/rootname/slideshtml/image/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import xsltver v = xsltver.detectXsltVersion('/usr/share/xml/docbook/stylesheet/docbook-xsl') @@ -7,6 +11,7 @@ if v >= (1, 78, 0): # Use namespace-aware input file ns_ext = 'ns' +DefaultEnvironment(tools=[]) env = Environment(tools=['docbook']) env.DocbookSlidesHtml('manual.html', 'virt'+ns_ext, xsl='slides.xsl') diff --git a/test/Docbook/rootname/slideshtml/image/xsltver.py b/test/Docbook/rootname/slideshtml/image/xsltver.py index c845324..e1a7074 100644 --- a/test/Docbook/rootname/slideshtml/image/xsltver.py +++ b/test/Docbook/rootname/slideshtml/image/xsltver.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import re diff --git a/test/File/fixture/relpath/base/SConstruct b/test/File/fixture/relpath/base/SConstruct index 4bb5078..cb99226 100644 --- a/test/File/fixture/relpath/base/SConstruct +++ b/test/File/fixture/relpath/base/SConstruct @@ -1,22 +1,26 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# # Testcase to check that .relpath works on SOURCES,TARGETS, and the singular SOURCE # This is the SConstruct for test/File/File-relpath.py -# + DefaultEnvironment(tools=[]) env = Environment(tools=[]) input_list = [ - "${TARGETS.relpath}", - "${TARGETS.abspath}", - "${SOURCES.relpath}", - "${SOURCES.abspath}", - "${SOURCE.relpath}", - "${SOURCE.abspath}", - ] + "${TARGETS.relpath}", + "${TARGETS.abspath}", + "${SOURCES.relpath}", + "${SOURCES.abspath}", + "${SOURCE.relpath}", + "${SOURCE.abspath}", +] outputs = env.subst( - input_list, + input_list, target=[File("../foo/dir"), File("build/file1")], source=[File("src/file")], ) -for i,s in zip(input_list,outputs): - print("%s=%s"%(i,s)) +for i, s in zip(input_list, outputs): + print("%s=%s" % (i, s)) diff --git a/test/Fortran/fixture/myfortran.py b/test/Fortran/fixture/myfortran.py index 6b4e5ef..2c5b580 100644 --- a/test/Fortran/fixture/myfortran.py +++ b/test/Fortran/fixture/myfortran.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import getopt import sys diff --git a/test/Fortran/fixture/myfortran_flags.py b/test/Fortran/fixture/myfortran_flags.py index 2b433ea..3ef841e 100644 --- a/test/Fortran/fixture/myfortran_flags.py +++ b/test/Fortran/fixture/myfortran_flags.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import getopt import sys diff --git a/test/Install/fixture/SConstruct-multi b/test/Install/fixture/SConstruct-multi index 94de1df..68736af 100644 --- a/test/Install/fixture/SConstruct-multi +++ b/test/Install/fixture/SConstruct-multi @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# # first run creates a src file, makes it read-only, and installs. # second run updates src, Install should successfully replace # the previous install (read-only attr on Windows might fail it) diff --git a/test/Install/multi-dir/src/SConstruct b/test/Install/multi-dir/src/SConstruct index 44e3589..73683d3 100644 --- a/test/Install/multi-dir/src/SConstruct +++ b/test/Install/multi-dir/src/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# # This tests for a bug where installing a sequence dirs and subdirs # outside the source tree can cause SCons to fail to create the dest # dir. diff --git a/test/Java/Java-fixture/myjar.py b/test/Java/Java-fixture/myjar.py index a47e3b0..3e17231 100644 --- a/test/Java/Java-fixture/myjar.py +++ b/test/Java/Java-fixture/myjar.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import fileinput import sys diff --git a/test/Java/Java-fixture/myjavac.py b/test/Java/Java-fixture/myjavac.py index 1c7fdea..c2a2602 100644 --- a/test/Java/Java-fixture/myjavac.py +++ b/test/Java/Java-fixture/myjavac.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys args = sys.argv[1:] diff --git a/test/Java/Java-fixture/myrmic.py b/test/Java/Java-fixture/myrmic.py index 877c1be..8934e7f 100644 --- a/test/Java/Java-fixture/myrmic.py +++ b/test/Java/Java-fixture/myrmic.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import sys diff --git a/test/Java/java_version_image/SConstruct b/test/Java/java_version_image/SConstruct index 945c864..37e49c2 100644 --- a/test/Java/java_version_image/SConstruct +++ b/test/Java/java_version_image/SConstruct @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation AddOption('--javac_path', dest='javac_path', @@ -11,25 +14,20 @@ AddOption('--java_version', default='1.6', type='string') -path=GetOption('javac_path') +path = GetOption('javac_path') if path[0] == "'": path = path[1:-1] version = GetOption('java_version') -env = Environment(tools = ['javac'], - JAVAVERSION = version, - ) - - -env.AppendENVPath('PATH',path) +DefaultEnvironment(tools=[]) +env = Environment(tools=['javac'], JAVAVERSION=version) +env.AppendENVPath('PATH', path) # print('PATH:%s'%env['ENV']['PATH']) - - -env.Java(target = 'class1', source = 'com/sub/foo') -env.Java(target = 'class2', source = 'com/sub/bar') -env.Java(target = 'class3', source = ['src1', 'src2']) -env.Java(target = 'class4', source = ['src4']) -env.Java(target = 'class5', source = ['src5']) -env.Java(target = 'class6', source = ['src6']) +env.Java(target='class1', source='com/sub/foo') +env.Java(target='class2', source='com/sub/bar') +env.Java(target='class3', source=['src1', 'src2']) +env.Java(target='class4', source=['src4']) +env.Java(target='class5', source=['src5']) +env.Java(target='class6', source=['src6']) diff --git a/test/Java/java_version_image/com/sub/bar/Example4.java b/test/Java/java_version_image/com/sub/bar/Example4.java index 0748d54..f27b16c 100644 --- a/test/Java/java_version_image/com/sub/bar/Example4.java +++ b/test/Java/java_version_image/com/sub/bar/Example4.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.sub.bar; public class Example4 diff --git a/test/Java/java_version_image/com/sub/bar/Example5.java b/test/Java/java_version_image/com/sub/bar/Example5.java index 69d2937..de6d765 100644 --- a/test/Java/java_version_image/com/sub/bar/Example5.java +++ b/test/Java/java_version_image/com/sub/bar/Example5.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.other; public class Example5 diff --git a/test/Java/java_version_image/com/sub/bar/Example6.java b/test/Java/java_version_image/com/sub/bar/Example6.java index 1811b80..85166d4 100644 --- a/test/Java/java_version_image/com/sub/bar/Example6.java +++ b/test/Java/java_version_image/com/sub/bar/Example6.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.sub.bar; public class Example6 diff --git a/test/Java/java_version_image/com/sub/foo/Example1.java b/test/Java/java_version_image/com/sub/foo/Example1.java index 82aac2e..1ce4f84 100644 --- a/test/Java/java_version_image/com/sub/foo/Example1.java +++ b/test/Java/java_version_image/com/sub/foo/Example1.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.sub.foo; public class Example1 diff --git a/test/Java/java_version_image/com/sub/foo/Example2.java b/test/Java/java_version_image/com/sub/foo/Example2.java index 6349ac9..9c9144d 100644 --- a/test/Java/java_version_image/com/sub/foo/Example2.java +++ b/test/Java/java_version_image/com/sub/foo/Example2.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.other; public class Example2 diff --git a/test/Java/java_version_image/com/sub/foo/Example3.java b/test/Java/java_version_image/com/sub/foo/Example3.java index 092f0cd..962262a 100644 --- a/test/Java/java_version_image/com/sub/foo/Example3.java +++ b/test/Java/java_version_image/com/sub/foo/Example3.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + package com.sub.foo; public class Example3 diff --git a/test/Java/java_version_image/src1/Example7.java b/test/Java/java_version_image/src1/Example7.java index 80d94f2..b8304e8 100644 --- a/test/Java/java_version_image/src1/Example7.java +++ b/test/Java/java_version_image/src1/Example7.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + public class Example7 { diff --git a/test/Java/java_version_image/src2/Test.java b/test/Java/java_version_image/src2/Test.java index 6f224b0..c6606a2 100644 --- a/test/Java/java_version_image/src2/Test.java +++ b/test/Java/java_version_image/src2/Test.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + class Empty { } diff --git a/test/Java/java_version_image/src4/NestedExample.java b/test/Java/java_version_image/src4/NestedExample.java index 531f2e9..ac4edd5 100644 --- a/test/Java/java_version_image/src4/NestedExample.java +++ b/test/Java/java_version_image/src4/NestedExample.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + // import java.util.*; public class NestedExample diff --git a/test/Java/java_version_image/src5/TestSCons.java b/test/Java/java_version_image/src5/TestSCons.java index 46572c4..d169fd3 100644 --- a/test/Java/java_version_image/src5/TestSCons.java +++ b/test/Java/java_version_image/src5/TestSCons.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + class TestSCons { public static void main(String[] args) { Foo[] fooArray = new Foo[] { new Foo() }; diff --git a/test/Java/java_version_image/src6/TestSCons.java b/test/Java/java_version_image/src6/TestSCons.java index 1aeed2f..abf2077 100644 --- a/test/Java/java_version_image/src6/TestSCons.java +++ b/test/Java/java_version_image/src6/TestSCons.java @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + class test { test() diff --git a/test/LEX/lex_headerfile/spaced path/SConstruct b/test/LEX/lex_headerfile/spaced path/SConstruct index aa4aca0..2ec0ca8 100644 --- a/test/LEX/lex_headerfile/spaced path/SConstruct +++ b/test/LEX/lex_headerfile/spaced path/SConstruct @@ -1,2 +1,6 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) -SConscript("src/SConscript") \ No newline at end of file +SConscript("src/SConscript") diff --git a/test/LEX/lex_headerfile/spaced path/src/SConscript b/test/LEX/lex_headerfile/spaced path/src/SConscript index a3f4bfd..bbfc36e 100644 --- a/test/LEX/lex_headerfile/spaced path/src/SConscript +++ b/test/LEX/lex_headerfile/spaced path/src/SConscript @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + env = Environment(tools=['lex']) def make_header_path(env, target, source, for_signature): @@ -7,4 +11,4 @@ env.Replace(LEX_HEADER_FILE_GEN=make_header_path) env.Append(LEXFLAGS=['--header-file=$LEX_HEADER_FILE_GEN']) env.CFile(target=['#gen_src/lexer.c', '#gen_src/lexer.l.h'], source='lexer.l') -env.CFile(target=['#gen_src/lexer2.c', '#gen_src/lexer2.l.h'], source='lexer2.l') \ No newline at end of file +env.CFile(target=['#gen_src/lexer2.c', '#gen_src/lexer2.l.h'], source='lexer2.l') diff --git a/test/LINK/applelink_image/SConstruct_CurVers_CompatVers b/test/LINK/applelink_image/SConstruct_CurVers_CompatVers index 4a824d3..c92a979 100644 --- a/test/LINK/applelink_image/SConstruct_CurVers_CompatVers +++ b/test/LINK/applelink_image/SConstruct_CurVers_CompatVers @@ -1,13 +1,18 @@ - +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation vars = Variables(None, ARGUMENTS) vars.Add('SHLIBVERSION', 'Set the SHLIBVERSION', 0) vars.Add('APPLELINK_CURRENT_VERSION', 'Set APPLELINK_CURRENT_VERSION', 0) vars.Add('APPLELINK_COMPATIBILITY_VERSION', 'Set APPLELINK_COMPATIBILITY_VERSION', 0) vars.Add('APPLELINK_NO_CURRENT_VERSION', 'Set APPLELINK_NO_CURRENT_VERSION', 0) -vars.Add('APPLELINK_NO_COMPATIBILITY_VERSION', 'Set APPLELINK_NO_COMPATIBILITY_VERSION', 0) +vars.Add( + 'APPLELINK_NO_COMPATIBILITY_VERSION', 'Set APPLELINK_NO_COMPATIBILITY_VERSION', 0 +) -env = Environment(variables = vars, tools=['gcc', 'applelink']) +DefaultEnvironment(tools=[]) +env = Environment(variables=vars, tools=['gcc', 'applelink']) if env['APPLELINK_NO_CURRENT_VERSION'] == '0': env['APPLELINK_NO_CURRENT_VERSION'] = 0 @@ -15,21 +20,30 @@ if env['APPLELINK_NO_CURRENT_VERSION'] == '0': if env['APPLELINK_NO_COMPATIBILITY_VERSION'] == '0': env['APPLELINK_NO_COMPATIBILITY_VERSION'] = 0 - -print("SHLIBVERSION =[%s]"%env.get('SHLIBVERSION', False)) -print("APPLELINK_CURRENT_VERSION =[%s]"%env.get('APPLELINK_CURRENT_VERSION', False)) -print("APPLELINK_COMPATIBILITY_VERSION =[%s]"%env.get('APPLELINK_COMPATIBILITY_VERSION', False)) -print("APPLELINK_NO_CURRENT_VERSION =[%s]"%env.get('APPLELINK_NO_CURRENT_VERSION', False)) -print("APPLELINK_NO_COMPATIBILITY_VERSION=[%s]"%env.get('APPLELINK_NO_COMPATIBILITY_VERSION', False)) +print( + "SHLIBVERSION =[%s]" + % env.get('SHLIBVERSION', False) +) +print( + "APPLELINK_CURRENT_VERSION =[%s]" + % env.get('APPLELINK_CURRENT_VERSION', False) +) +print( + "APPLELINK_COMPATIBILITY_VERSION =[%s]" + % env.get('APPLELINK_COMPATIBILITY_VERSION', False) +) +print( + "APPLELINK_NO_CURRENT_VERSION =[%s]" + % env.get('APPLELINK_NO_CURRENT_VERSION', False) +) +print( + "APPLELINK_NO_COMPATIBILITY_VERSION=[%s]" + % env.get('APPLELINK_NO_COMPATIBILITY_VERSION', False) +) obj = env.SharedObject('foo.c') sl = env.SharedLibrary('foo', obj) sl2 = env.SharedLibrary('foo2', obj, SONAME='libfoo.4.dynlib') lm = env.LoadableModule('fool', obj) - -env.InstallVersionedLib(target='#/install', - source=sl) - -env.InstallVersionedLib(target='#/install', - source=lm) - +env.InstallVersionedLib(target='#/install', source=sl) +env.InstallVersionedLib(target='#/install', source=lm) diff --git a/test/LINK/applelink_image/SConstruct_gh2580 b/test/LINK/applelink_image/SConstruct_gh2580 index 79fd9d5..62255fa 100644 --- a/test/LINK/applelink_image/SConstruct_gh2580 +++ b/test/LINK/applelink_image/SConstruct_gh2580 @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) env = Environment(PLATFORM='darwin') env.Object( diff --git a/test/LINK/applelink_image/foo.c b/test/LINK/applelink_image/foo.c index a441953..5a53f5e 100644 --- a/test/LINK/applelink_image/foo.c +++ b/test/LINK/applelink_image/foo.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include int @@ -6,4 +10,4 @@ main(int argc, char *argv[]) argv[argc++] = "--"; printf("foo.c\n"); exit (0); -} \ No newline at end of file +} diff --git a/test/Libs/bug2903/SConstruct b/test/Libs/bug2903/SConstruct index 12919ce..4f701a4 100644 --- a/test/Libs/bug2903/SConstruct +++ b/test/Libs/bug2903/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# # SConstruct for testing but #2903. # The test changes the lib name to make sure it rebuilds # when the name changes, even if the content of the lib is the same. @@ -5,9 +9,15 @@ # when other linker options change, and not when they don't. # (This doesn't specifically test LIBPATH, but there's a test for # that already.) -env=Environment() -libname=ARGUMENTS.get('libname', 'foo') +DefaultEnvironment(tools=[]) +env = Environment() +libname = ARGUMENTS.get('libname', 'foo') env.Append(SHLINKFLAGS=' $EXTRA_SHLINKFLAGS') -shlinkflags=ARGUMENTS.get('shlinkflags', '') -env.SharedLibrary('myshared', ['main.c'], - LIBS=[libname], LIBPATH='.', EXTRA_SHLINKFLAGS=shlinkflags) +shlinkflags = ARGUMENTS.get('shlinkflags', '') +env.SharedLibrary( + 'myshared', + ['main.c'], + LIBS=[libname], + LIBPATH='.', + EXTRA_SHLINKFLAGS=shlinkflags, +) diff --git a/test/Libs/bug2903/SConstruct-libs b/test/Libs/bug2903/SConstruct-libs index 1590062..6f57e13 100644 --- a/test/Libs/bug2903/SConstruct-libs +++ b/test/Libs/bug2903/SConstruct-libs @@ -1,5 +1,11 @@ -env=Environment() +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) +env = Environment() libfoo = env.SharedLibrary('foo', 'lib.c') env.InstallAs('${SHLIBPREFIX}bar${SHLIBSUFFIX}', libfoo[0]) -if len(libfoo) > 1: # on Windows, there's an import lib (also a .exp, but we don't want that) - env.InstallAs('${LIBPREFIX}bar${LIBSUFFIX}', libfoo[1]) +if len(libfoo) > 1: + # on Windows, there's an import lib (also a .exp, but we don't want that) + env.InstallAs('${LIBPREFIX}bar${LIBSUFFIX}', libfoo[1]) diff --git a/test/Libs/bug2903/lib.c b/test/Libs/bug2903/lib.c index 65f4cd2..2425c46 100644 --- a/test/Libs/bug2903/lib.c +++ b/test/Libs/bug2903/lib.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/test/Libs/bug2903/main.c b/test/Libs/bug2903/main.c index a4b1ecc..e44ebd5 100644 --- a/test/Libs/bug2903/main.c +++ b/test/Libs/bug2903/main.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #ifdef _WIN32 __declspec(dllexport) #endif diff --git a/test/MSVC/MSVC_BATCH-spaces-targetdir.py b/test/MSVC/MSVC_BATCH-spaces-targetdir.py index 298e10e..9b11872 100644 --- a/test/MSVC/MSVC_BATCH-spaces-targetdir.py +++ b/test/MSVC/MSVC_BATCH-spaces-targetdir.py @@ -1,11 +1,11 @@ -import TestSCons - +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +import TestSCons test = TestSCons.TestSCons() test.skip_if_not_msvc() - - test.dir_fixture('MSVC_BATCH-spaces-targetdir') -test.run() \ No newline at end of file +test.run() diff --git a/test/MSVC/MSVC_BATCH-spaces-targetdir/SConstruct b/test/MSVC/MSVC_BATCH-spaces-targetdir/SConstruct index da8002b..025f9ee 100644 --- a/test/MSVC/MSVC_BATCH-spaces-targetdir/SConstruct +++ b/test/MSVC/MSVC_BATCH-spaces-targetdir/SConstruct @@ -1,8 +1,15 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os.path -env=Environment(MSVC_BATCH=True) +DefaultEnvironment(tools=[]) +env = Environment(MSVC_BATCH=True) -td='tar ge tdir' -VariantDir(td,'src') -env.Program(os.path.join(td,'test_program'), - [os.path.join(td,a) for a in ['a.c','b.c','c.c']]) +td = 'tar ge tdir' +VariantDir(td, 'src') +env.Program( + os.path.join(td, 'test_program'), + [os.path.join(td, a) for a in ['a.c', 'b.c', 'c.c']], +) diff --git a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/a.c b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/a.c index 1741de8..9164729 100644 --- a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/a.c +++ b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/a.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include extern void myfuncb(); @@ -12,4 +16,4 @@ int main(int argc, char *argv[]) { myfunca(); myfuncb(); myfuncc(); -} \ No newline at end of file +} diff --git a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/b.c b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/b.c index e03c5d0..51e92dd 100644 --- a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/b.c +++ b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/b.c @@ -1,5 +1,9 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include void myfuncb() { printf("myfuncb\n"); -} \ No newline at end of file +} diff --git a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/c.c b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/c.c index 1c262d3..fe9f203 100644 --- a/test/MSVC/MSVC_BATCH-spaces-targetdir/src/c.c +++ b/test/MSVC/MSVC_BATCH-spaces-targetdir/src/c.c @@ -1,5 +1,9 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include void myfuncc() { printf("myfuncc\n"); -} \ No newline at end of file +} diff --git a/test/MSVC/MSVC_USE_SCRIPT_ARGS-fixture/SConstruct b/test/MSVC/MSVC_USE_SCRIPT_ARGS-fixture/SConstruct index 54d140e..cbdd8aa 100644 --- a/test/MSVC/MSVC_USE_SCRIPT_ARGS-fixture/SConstruct +++ b/test/MSVC/MSVC_USE_SCRIPT_ARGS-fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os if 'SCONS_CACHE_MSVC_CONFIG' in os.environ: diff --git a/test/MSVC/VSWHERE-fixture/SConstruct b/test/MSVC/VSWHERE-fixture/SConstruct index 38dfb0b..c80693e 100644 --- a/test/MSVC/VSWHERE-fixture/SConstruct +++ b/test/MSVC/VSWHERE-fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import os.path @@ -9,6 +13,7 @@ for vw_path in VSWHERE_PATHS: # Allow normal detection logic to find vswhere.exe +DefaultEnvironment(tools=[]) env1=Environment() print("VSWHERE-detect=%s" % env1['VSWHERE']) diff --git a/test/MSVC/msvc_fixture/SConstruct b/test/MSVC/msvc_fixture/SConstruct index af916dc..dd499ae 100644 --- a/test/MSVC/msvc_fixture/SConstruct +++ b/test/MSVC/msvc_fixture/SConstruct @@ -1,4 +1,8 @@ -# msvc_fixture's SConstruct +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +"""msvc_fixture's SConstruct""" DefaultEnvironment(tools=[]) # TODO: this is order-dependent (putting 'mssdk' second or third breaks), diff --git a/test/MSVC/msvc_fixture/StdAfx.cpp b/test/MSVC/msvc_fixture/StdAfx.cpp index a6a290b..caba43c 100644 --- a/test/MSVC/msvc_fixture/StdAfx.cpp +++ b/test/MSVC/msvc_fixture/StdAfx.cpp @@ -1,4 +1,8 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "StdAfx.h" #ifndef PCHDEF this line generates an error if PCHDEF is not defined! -#endif \ No newline at end of file +#endif diff --git a/test/MSVC/msvc_fixture/StdAfx.h b/test/MSVC/msvc_fixture/StdAfx.h index a92d7df..9e0a9a1 100644 --- a/test/MSVC/msvc_fixture/StdAfx.h +++ b/test/MSVC/msvc_fixture/StdAfx.h @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include -#include "resource.h" \ No newline at end of file +#include "resource.h" diff --git a/test/MSVC/msvc_fixture/foo.cpp b/test/MSVC/msvc_fixture/foo.cpp index 09f15b6..6b92848 100644 --- a/test/MSVC/msvc_fixture/foo.cpp +++ b/test/MSVC/msvc_fixture/foo.cpp @@ -1 +1,5 @@ -#include "StdAfx.h" \ No newline at end of file +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + +#include "StdAfx.h" diff --git a/test/MSVC/msvc_fixture/resource.h b/test/MSVC/msvc_fixture/resource.h index 089e932..fef9b5b 100644 --- a/test/MSVC/msvc_fixture/resource.h +++ b/test/MSVC/msvc_fixture/resource.h @@ -1 +1,5 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #define IDS_TEST 2001 diff --git a/test/MSVC/msvc_fixture/test.cpp b/test/MSVC/msvc_fixture/test.cpp index 354b5f1..edb2ef5 100644 --- a/test/MSVC/msvc_fixture/test.cpp +++ b/test/MSVC/msvc_fixture/test.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "StdAfx.h" #include "resource.h" @@ -7,4 +11,4 @@ int main(void) LoadString(GetModuleHandle(NULL), IDS_TEST, test, sizeof(test)); printf("%d %s\n", IDS_TEST, test); return 0; -} \ No newline at end of file +} diff --git a/test/MSVC/pch_gen/fixture/SConstruct b/test/MSVC/pch_gen/fixture/SConstruct index ab63cd6..2d91925 100644 --- a/test/MSVC/pch_gen/fixture/SConstruct +++ b/test/MSVC/pch_gen/fixture/SConstruct @@ -1,43 +1,45 @@ -# pch_gen fixture's SConstruct +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +"""pch_gen fixture's SConstruct""" DefaultEnvironment(tools=[]) # TODO: this is order-dependent (putting 'mssdk' second or third breaks), # and ideally we shouldn't need to specify the tools= list anyway. - -VariantDir('output1','src') -VariantDir('output2','src') - +VariantDir('output1', 'src') +VariantDir('output2', 'src') # Add flag to cause pch_gen to return empty string # This will enable testing that PCH if subst'd yields empty string will stop # PCH from being enabled. vars = Variables(None, ARGUMENTS) -vars.AddVariables(BoolVariable("DISABLE_PCH", help="Disable PCH functionality", default=False)) - +vars.AddVariables( + BoolVariable("DISABLE_PCH", help="Disable PCH functionality", default=False) +) env = Environment(variables=vars, tools=["mssdk", "msvc", "mslink"]) env.Append(CCFLAGS="/DPCHDEF") env["PDB"] = File("output1/test.pdb") env["PCHSTOP"] = "StdAfx.h" - def pch_gen(env, target, source, for_signature): if env['DISABLE_PCH']: return "" else: return "StdAfx-1.pch" - env["PCH"] = pch_gen env.PCH("output1/StdAfx-1.pch", "output1/StdAfx.cpp") -env.Program("output1/test", ["output1/test.cpp", env.RES("output1/test.rc")], LIBS=["user32"]) +env.Program( + "output1/test", + ["output1/test.cpp", env.RES("output1/test.rc")], + LIBS=["user32"], +) env.Object("output1/fast", "output1/foo.cpp") env.Object("output1/slow", "output1/foo.cpp", PCH=0) - - - env2 = env.Clone() def pch_gen2(env, target, source, for_signature): @@ -45,9 +47,13 @@ def pch_gen2(env, target, source, for_signature): return "" else: return env.get('PCH_NODE') + env2["PDB"] = File("output2/test.pdb") env2["PCHSTOP"] = "StdAfx.h" env2["PCH"] = pch_gen2 env2['PCH_NODE'] = env2.PCH("output2/StdAfx-1.pch", "output2/StdAfx.cpp")[0] -env2.Program("output2/test", ["output2/test.cpp", env.RES("output2/test.rc")], LIBS=["user32"]) - +env2.Program( + "output2/test", + ["output2/test.cpp", env.RES("output2/test.rc")], + LIBS=["user32"], +) diff --git a/test/MinGW/bug_2799/SConstruct b/test/MinGW/bug_2799/SConstruct index f22cacc..00606ee 100644 --- a/test/MinGW/bug_2799/SConstruct +++ b/test/MinGW/bug_2799/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment( tools=['mingw'], SHCCCOMSTR='SHCC $TARGET', @@ -8,7 +13,5 @@ env = Environment( SHLIBPREFIX='lib', LDMODULESUFFIX='.so', ) - env.SharedLibrary('testlib', 'shlib.c') - env.LoadableModule('testmodule', 'module.c') diff --git a/test/MinGW/bug_2799/module.c b/test/MinGW/bug_2799/module.c index 3cf5ace..31703f0 100644 --- a/test/MinGW/bug_2799/module.c +++ b/test/MinGW/bug_2799/module.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + extern void bar(void) { } diff --git a/test/MinGW/bug_2799/shlib.c b/test/MinGW/bug_2799/shlib.c index efe6b3f..f942e9f 100644 --- a/test/MinGW/bug_2799/shlib.c +++ b/test/MinGW/bug_2799/shlib.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + extern int foo(void) { return 0; diff --git a/test/Parallel/failed-build/fixture/SConstruct b/test/Parallel/failed-build/fixture/SConstruct index 21109fe..6236aa6 100644 --- a/test/Parallel/failed-build/fixture/SConstruct +++ b/test/Parallel/failed-build/fixture/SConstruct @@ -1,12 +1,19 @@ -import sys +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os +import random +import sys import threading -import random +from teststate import server_thread + PORT = random.randint(10000, 60000) sys.path.append(os.getcwd()) -from teststate import server_thread + +DefaultEnvironment(tools=[]) # this thread will setup a sever for the different tasks to talk to # and act as a manager of IPC and the different tasks progressing @@ -21,4 +28,4 @@ env = Environment(BUILDERS={'MyCopy' : MyCopy, 'Fail' : Fail}) env.Fail(target='f3', source='f3.in') env.MyCopy(target='f4', source='f4.in') env.MyCopy(target='f5', source='f5.in') -env.MyCopy(target='f6', source='f6.in') \ No newline at end of file +env.MyCopy(target='f6', source='f6.in') diff --git a/test/Parallel/failed-build/fixture/mycopy.py b/test/Parallel/failed-build/fixture/mycopy.py index 97c8e88..3826d87 100644 --- a/test/Parallel/failed-build/fixture/mycopy.py +++ b/test/Parallel/failed-build/fixture/mycopy.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import sys import time @@ -32,4 +36,4 @@ if count >= WAIT: sys.exit(99) conn.close() -sys.exit(0) \ No newline at end of file +sys.exit(0) diff --git a/test/Parallel/failed-build/fixture/myfail.py b/test/Parallel/failed-build/fixture/myfail.py index bd54d44..4c6a8ab 100644 --- a/test/Parallel/failed-build/fixture/myfail.py +++ b/test/Parallel/failed-build/fixture/myfail.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import sys import time @@ -28,4 +32,4 @@ if count >= WAIT: conn.request("GET", "/?set_myfail_done=1&pid=" + str(os.getpid())) conn.close() -sys.exit(1) \ No newline at end of file +sys.exit(1) diff --git a/test/Parallel/failed-build/fixture/teststate.py b/test/Parallel/failed-build/fixture/teststate.py index d02957e..8499720 100644 --- a/test/Parallel/failed-build/fixture/teststate.py +++ b/test/Parallel/failed-build/fixture/teststate.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import http.server import socketserver import time @@ -87,4 +91,4 @@ def server_thread(PORT): return httpd = socketserver.TCPServer(("127.0.0.1", PORT), S) - httpd.serve_forever() \ No newline at end of file + httpd.serve_forever() diff --git a/test/Progress/multi_target_fixture/SConstruct b/test/Progress/multi_target_fixture/SConstruct index 5a16f05..9a5ed11 100644 --- a/test/Progress/multi_target_fixture/SConstruct +++ b/test/Progress/multi_target_fixture/SConstruct @@ -1,15 +1,20 @@ -import SCons +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +import SCons class ProgressTest: - def __call__(self, node): if node.get_state() == SCons.Node.executing: print(node) - +DefaultEnvironment(tools=[]) env = Environment(tools=[]) -env.Command(target=['out1.txt', 'out2.txt'], source=['in.txt'], action=Action( - 'echo $SOURCE > ${TARGETS[0]};echo $SOURCE > ${TARGETS[1]}', None)) +env.Command( + target=['out1.txt', 'out2.txt'], + source=['in.txt'], + action=Action('echo $SOURCE > ${TARGETS[0]};echo $SOURCE > ${TARGETS[1]}', None), +) Progress(ProgressTest()) diff --git a/test/SConscript/fixture/SConstruct b/test/SConscript/fixture/SConstruct index a955efc..aec868e 100644 --- a/test/SConscript/fixture/SConstruct +++ b/test/SConscript/fixture/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons from SCons.Warnings import _warningOut import sys diff --git a/test/SConscript/must_exist_deprecation.py b/test/SConscript/must_exist_deprecation.py index eaa0c42..4c1db12 100644 --- a/test/SConscript/must_exist_deprecation.py +++ b/test/SConscript/must_exist_deprecation.py @@ -44,7 +44,7 @@ warnmsg = """ scons: warning: Calling missing SConscript without error is deprecated. Transition by adding must_exist=False to SConscript calls. Missing SConscript '{}' -""".format(missing) + test.python_file_line(SConstruct_path, 14) +""".format(missing) + test.python_file_line(SConstruct_path, 18) expect_stderr = warnmsg test.run(arguments=".", stderr=expect_stderr) diff --git a/test/Scanner/Python/SConstruct b/test/Scanner/Python/SConstruct index 988cf60..6a3fd05 100644 --- a/test/Scanner/Python/SConstruct +++ b/test/Scanner/Python/SConstruct @@ -1,5 +1,10 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys +DefaultEnvironment(tools=[]) env = Environment(tools=['python']) # Copy each file individually instead of copying the dir. This has the benefit @@ -13,4 +18,4 @@ for srcNode in srcDir.glob('*'): # Don't set a dependency on the copy actions on purpose. Scanner should find # the dependencies automatically. -env.Command('a.out', 'script.py', '$PYTHON $SOURCE $TARGET', PYTHON=sys.executable) \ No newline at end of file +env.Command('a.out', 'script.py', '$PYTHON $SOURCE $TARGET', PYTHON=sys.executable) diff --git a/test/Scanner/Python/script.py b/test/Scanner/Python/script.py index 105a575..e51ec41 100644 --- a/test/Scanner/Python/script.py +++ b/test/Scanner/Python/script.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import package1 # noqa: F401 import package2 # noqa: F401 import sys diff --git a/test/Scanner/Python/to_be_copied/__init__.py b/test/Scanner/Python/to_be_copied/__init__.py index 3c1c05b..bd9464c 100644 --- a/test/Scanner/Python/to_be_copied/__init__.py +++ b/test/Scanner/Python/to_be_copied/__init__.py @@ -1 +1,5 @@ -from . import helper # noqa: F401 \ No newline at end of file +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +from . import helper # noqa: F401 diff --git a/test/SideEffect/Issues/3013/files/SConscript b/test/SideEffect/Issues/3013/files/SConscript index 27da7bb..53cfcdc 100644 --- a/test/SideEffect/Issues/3013/files/SConscript +++ b/test/SideEffect/Issues/3013/files/SConscript @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + Import('env') primary = env.make_file('output', 'test.cpp') diff --git a/test/SideEffect/Issues/3013/files/SConstruct b/test/SideEffect/Issues/3013/files/SConstruct index d01a4b7..9294cb0 100644 --- a/test/SideEffect/Issues/3013/files/SConstruct +++ b/test/SideEffect/Issues/3013/files/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment() def make_file(target, source, env): diff --git a/test/SideEffect/Issues/3013/files/test.cpp b/test/SideEffect/Issues/3013/files/test.cpp index 27424b0..94e2cad 100644 --- a/test/SideEffect/Issues/3013/files/test.cpp +++ b/test/SideEffect/Issues/3013/files/test.cpp @@ -1,2 +1,6 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + void some_function() {} diff --git a/test/Subst/fixture/SConstruct.callable_exception b/test/Subst/fixture/SConstruct.callable_exception index 3f1b337..1c1b952 100644 --- a/test/Subst/fixture/SConstruct.callable_exception +++ b/test/Subst/fixture/SConstruct.callable_exception @@ -1,11 +1,17 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + class TestCallable(object): def __init__(self, thing, makePathsRelative = True, debug = False): pass + def __call__(self, target, source, env, for_signature): raise TypeError("User callable exception") +DefaultEnvironment(tools=[]) env = Environment() env["TESTCLASS"] = TestCallable env["CCCOM"] = "$CC $_CCCOMCOM $CCFLAGS -o ${TESTCLASS('$TARGET')} -c ${TESTCLASS('$SOURCES')}" -env.Program(target='test_main', source='test_main.c') \ No newline at end of file +env.Program(target='test_main', source='test_main.c') diff --git a/test/TEMPFILE/fixture/SConstruct-tempfile-actionlist b/test/TEMPFILE/fixture/SConstruct-tempfile-actionlist index 07b6345..8d2069b 100644 --- a/test/TEMPFILE/fixture/SConstruct-tempfile-actionlist +++ b/test/TEMPFILE/fixture/SConstruct-tempfile-actionlist @@ -1,6 +1,14 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) -env = Environment(tools=[], - BUILDCOM=['${TEMPFILE("xxx.py -otempfile $SOURCE")}', - '${TEMPFILE("yyy.py -o$TARGET tempfile")}'], - MAXLINELENGTH=1) +env = Environment( + tools=[], + BUILDCOM=[ + '${TEMPFILE("xxx.py -otempfile $SOURCE")}', + '${TEMPFILE("yyy.py -o$TARGET tempfile")}', + ], + MAXLINELENGTH=1, +) env.Command('file.output', 'file.input', '$BUILDCOM') diff --git a/test/TEMPFILE/fixture/SConstruct.tempfiledir b/test/TEMPFILE/fixture/SConstruct.tempfiledir index ea26c27..0e45b7f 100644 --- a/test/TEMPFILE/fixture/SConstruct.tempfiledir +++ b/test/TEMPFILE/fixture/SConstruct.tempfiledir @@ -1,7 +1,12 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os my_temp_dir = os.path.join(os.getcwd(), 'my_temp_files') +DefaultEnvironment(tools=[]) env = Environment( BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}', MAXLINELENGTH=16, diff --git a/test/TaskMaster/bug_2811/fixture_dir/SConstruct b/test/TaskMaster/bug_2811/fixture_dir/SConstruct index d453368..1f8c364 100644 --- a/test/TaskMaster/bug_2811/fixture_dir/SConstruct +++ b/test/TaskMaster/bug_2811/fixture_dir/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ This issue requires the following. 1. Generated source file which outputs 2 (or more) files @@ -29,17 +33,12 @@ def _dwo_emitter(target, source, env): return (targets, source) build_string = '$MYCOPY $SOURCE $TARGET' - - bld = Builder(action=build_string) +DefaultEnvironment(tools=[]) env = Environment(BUILDERS={'Foo': bld}, MYCOPY="%s mycopy.py"%sys.executable) - env['SHCCCOM'] = '$MYCOPY $SOURCE $TARGET && $MYCOPY $SOURCE ${TARGETS[1]}' - env['SHCCCOMSTR'] = env['SHCCCOM'] - - suffixes = ['.c'] for object_builder in SCons.Tool.createObjBuilders(env): @@ -63,4 +62,4 @@ env.Foo('b','b.in') # seems like processing is always alphabetical.. -# code: language=python insertSpaces=4 tabSize=4 \ No newline at end of file +# code: language=python insertSpaces=4 tabSize=4 diff --git a/test/TaskMaster/bug_2811/fixture_dir/mycopy.py b/test/TaskMaster/bug_2811/fixture_dir/mycopy.py index c1a57f5..3e4f7c0 100644 --- a/test/TaskMaster/bug_2811/fixture_dir/mycopy.py +++ b/test/TaskMaster/bug_2811/fixture_dir/mycopy.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys import shutil diff --git a/test/YACC/YACC-fixture/SConstruct_YACC_before b/test/YACC/YACC-fixture/SConstruct_YACC_before index 94f7adf..78ca5db 100644 --- a/test/YACC/YACC-fixture/SConstruct_YACC_before +++ b/test/YACC/YACC-fixture/SConstruct_YACC_before @@ -1,4 +1,9 @@ -env=Environment(tools=[]) -env2=env.Clone(YACC="SOMETHING_DUMB") +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) +env = Environment(tools=[]) +env2 = env.Clone(YACC="SOMETHING_DUMB") env2.Tool('yacc') env2.CFile('aaa.y') diff --git a/test/YACC/YACC-fixture/myyacc.py b/test/YACC/YACC-fixture/myyacc.py index 77f80ea..5027122 100644 --- a/test/YACC/YACC-fixture/myyacc.py +++ b/test/YACC/YACC-fixture/myyacc.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import getopt import sys diff --git a/test/YACC/YACCFLAGS-fixture/myyacc.py b/test/YACC/YACCFLAGS-fixture/myyacc.py index 3bc1375..6558f07 100644 --- a/test/YACC/YACCFLAGS-fixture/myyacc.py +++ b/test/YACC/YACCFLAGS-fixture/myyacc.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import getopt import sys from pathlib import Path diff --git a/test/fixture/SConstruct-check-valid-options b/test/fixture/SConstruct-check-valid-options index 53bdf89..9e7c990 100644 --- a/test/fixture/SConstruct-check-valid-options +++ b/test/fixture/SConstruct-check-valid-options @@ -5,6 +5,8 @@ import sys from SCons.Script.SConsOptions import SConsOptionParser, SConsBadOptionError +DefaultEnvironment(tools=[]) + AddOption( '--testing', help='Test arg', diff --git a/test/fixture/SConstruct_test_main.py b/test/fixture/SConstruct_test_main.py index 8d2d2b0..aa4284d 100644 --- a/test/fixture/SConstruct_test_main.py +++ b/test/fixture/SConstruct_test_main.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) env = Environment() env.Program('main.exe', ['main.c']) diff --git a/test/fixture/echo.py b/test/fixture/echo.py index a13f2ca..3f685c2 100755 --- a/test/fixture/echo.py +++ b/test/fixture/echo.py @@ -1,2 +1,6 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys print(sys.argv) diff --git a/test/fixture/mycompile.py b/test/fixture/mycompile.py index 15a1c6f..d858f6a 100644 --- a/test/fixture/mycompile.py +++ b/test/fixture/mycompile.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony compiler for testing SCons. diff --git a/test/fixture/mygcc.py b/test/fixture/mygcc.py index 91ca386..146e596 100644 --- a/test/fixture/mygcc.py +++ b/test/fixture/mygcc.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony compiler for testing SCons. diff --git a/test/fixture/mylex.py b/test/fixture/mylex.py index b5e94b1..9c9417e 100644 --- a/test/fixture/mylex.py +++ b/test/fixture/mylex.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony lex for testing SCons. diff --git a/test/fixture/mylink.py b/test/fixture/mylink.py index f462655..abe22ae 100644 --- a/test/fixture/mylink.py +++ b/test/fixture/mylink.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Phony linker for testing SCons. diff --git a/test/fixture/myrewrite.py b/test/fixture/myrewrite.py index eb83cac..f331558 100644 --- a/test/fixture/myrewrite.py +++ b/test/fixture/myrewrite.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + r""" Phony tool to modify a file in place for testing SCons. diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct.py b/test/fixture/no_msvc/no_msvcs_sconstruct.py index 18366d8..1aed9ec 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct.py @@ -1,15 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - env = SCons.Environment.Environment() - -print('MSVC_VERSION='+str(env.get('MSVC_VERSION'))) \ No newline at end of file +print('MSVC_VERSION=' + str(env.get('MSVC_VERSION'))) diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_query_toolset_version.py b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_query_toolset_version.py index 8e3c65f..fc5558b 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_query_toolset_version.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_query_toolset_version.py @@ -1,15 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - msvc_version, msvc_toolset_version = SCons.Tool.MSCommon.msvc_query_version_toolset() - -print('msvc_version={}, msvc_toolset_version={}'.format(repr(msvc_version), repr(msvc_toolset_version))) \ No newline at end of file +print(f'msvc_version={msvc_version!r}, msvc_toolset_version={msvc_toolset_version!r}') diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_sdk_versions.py b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_sdk_versions.py index 7953ce6..6e7562d 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_sdk_versions.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_sdk_versions.py @@ -1,15 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - sdk_version_list = SCons.Tool.MSCommon.msvc_sdk_versions() - -print('sdk_version_list='+repr(sdk_version_list)) +print('sdk_version_list=' + repr(sdk_version_list)) diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_toolset_versions.py b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_toolset_versions.py index fd209fd..c2208cd 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_toolset_versions.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct_msvc_toolset_versions.py @@ -1,15 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - toolset_version_list = SCons.Tool.MSCommon.msvc_toolset_versions() - -print('toolset_version_list='+repr(toolset_version_list)) +print('toolset_version_list=' + repr(toolset_version_list)) diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct_tools.py b/test/fixture/no_msvc/no_msvcs_sconstruct_tools.py index 9aa924b..2f2f07a 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct_tools.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct_tools.py @@ -1,14 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - env = SCons.Environment.Environment(tools=['myignoredefaultmsvctool']) diff --git a/test/fixture/no_msvc/no_msvcs_sconstruct_version.py b/test/fixture/no_msvc/no_msvcs_sconstruct_version.py index b586d6c..bd81688 100644 --- a/test/fixture/no_msvc/no_msvcs_sconstruct_version.py +++ b/test/fixture/no_msvc/no_msvcs_sconstruct_version.py @@ -1,19 +1,21 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) def DummyVsWhere(msvc_version, env): # not testing versions with vswhere, so return none return None - for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] SCons.Tool.MSCommon.vc.find_vc_pdir_vswhere = DummyVsWhere - SCons.Tool.MSCommon.msvc_set_notfound_policy('error') - env = SCons.Environment.Environment(MSVC_VERSION='14.3') - - diff --git a/test/fixture/no_msvc/no_regs_sconstruct.py b/test/fixture/no_msvc/no_regs_sconstruct.py index 3eeca94..9dcc7a8 100644 --- a/test/fixture/no_msvc/no_regs_sconstruct.py +++ b/test/fixture/no_msvc/no_regs_sconstruct.py @@ -1,7 +1,15 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons import SCons.Tool.MSCommon +DefaultEnvironment(tools=[]) + for key in SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR: - SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key]=[(SCons.Util.HKEY_LOCAL_MACHINE, r'')] + SCons.Tool.MSCommon.vc._VCVER_TO_PRODUCT_DIR[key] = [ + (SCons.Util.HKEY_LOCAL_MACHINE, r'') + ] -env = SCons.Environment.Environment() \ No newline at end of file +env = SCons.Environment.Environment() diff --git a/test/fixture/python_scanner/curdir_reference/script.py b/test/fixture/python_scanner/curdir_reference/script.py index d533863..280e41a 100644 --- a/test/fixture/python_scanner/curdir_reference/script.py +++ b/test/fixture/python_scanner/curdir_reference/script.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from . import helper diff --git a/test/fixture/python_scanner/from_import_simple_package_module1.py b/test/fixture/python_scanner/from_import_simple_package_module1.py index dcc86de..ab03709 100644 --- a/test/fixture/python_scanner/from_import_simple_package_module1.py +++ b/test/fixture/python_scanner/from_import_simple_package_module1.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from simple_package import module1 diff --git a/test/fixture/python_scanner/from_import_simple_package_module1_as.py b/test/fixture/python_scanner/from_import_simple_package_module1_as.py index 51061c6..ee97737 100644 --- a/test/fixture/python_scanner/from_import_simple_package_module1_as.py +++ b/test/fixture/python_scanner/from_import_simple_package_module1_as.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from simple_package import module1 as m1 diff --git a/test/fixture/python_scanner/from_import_simple_package_module1_func.py b/test/fixture/python_scanner/from_import_simple_package_module1_func.py index e9877fb..5ee6920 100644 --- a/test/fixture/python_scanner/from_import_simple_package_module1_func.py +++ b/test/fixture/python_scanner/from_import_simple_package_module1_func.py @@ -1 +1,5 @@ -from simple_package.module1 import somefunc # noqa: F401 \ No newline at end of file +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +from simple_package.module1 import somefunc # noqa: F401 diff --git a/test/fixture/python_scanner/from_import_simple_package_modules_no_space.py b/test/fixture/python_scanner/from_import_simple_package_modules_no_space.py index 17b82f8..5560dc8 100644 --- a/test/fixture/python_scanner/from_import_simple_package_modules_no_space.py +++ b/test/fixture/python_scanner/from_import_simple_package_modules_no_space.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from simple_package import module1,module2 diff --git a/test/fixture/python_scanner/from_import_simple_package_modules_with_space.py b/test/fixture/python_scanner/from_import_simple_package_modules_with_space.py index 169e6f7..7c13d22 100644 --- a/test/fixture/python_scanner/from_import_simple_package_modules_with_space.py +++ b/test/fixture/python_scanner/from_import_simple_package_modules_with_space.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from simple_package import module1, module2 diff --git a/test/fixture/python_scanner/from_nested1_import_multiple.py b/test/fixture/python_scanner/from_nested1_import_multiple.py index 2cdd47f..0a75bd8 100644 --- a/test/fixture/python_scanner/from_nested1_import_multiple.py +++ b/test/fixture/python_scanner/from_nested1_import_multiple.py @@ -1 +1,5 @@ -from nested1 import module, nested2 # noqa: F401 \ No newline at end of file +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +from nested1 import module, nested2 # noqa: F401 diff --git a/test/fixture/python_scanner/import_simple_package_module1.py b/test/fixture/python_scanner/import_simple_package_module1.py index bd85010..1bd2fca 100644 --- a/test/fixture/python_scanner/import_simple_package_module1.py +++ b/test/fixture/python_scanner/import_simple_package_module1.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import simple_package.module1 diff --git a/test/fixture/python_scanner/import_simple_package_module1_as.py b/test/fixture/python_scanner/import_simple_package_module1_as.py index a706672..25da8a9 100644 --- a/test/fixture/python_scanner/import_simple_package_module1_as.py +++ b/test/fixture/python_scanner/import_simple_package_module1_as.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import simple_package.module1 as m1 diff --git a/test/fixture/python_scanner/imports_nested3.py b/test/fixture/python_scanner/imports_nested3.py index c2929d0..4929cbd 100644 --- a/test/fixture/python_scanner/imports_nested3.py +++ b/test/fixture/python_scanner/imports_nested3.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import nested1.nested2.nested3 diff --git a/test/fixture/python_scanner/imports_simple_package.py b/test/fixture/python_scanner/imports_simple_package.py index d974128..059dd6e 100644 --- a/test/fixture/python_scanner/imports_simple_package.py +++ b/test/fixture/python_scanner/imports_simple_package.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import simple_package diff --git a/test/fixture/python_scanner/imports_unknown_files.py b/test/fixture/python_scanner/imports_unknown_files.py index 5582e7b..0bfc401 100644 --- a/test/fixture/python_scanner/imports_unknown_files.py +++ b/test/fixture/python_scanner/imports_unknown_files.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import doesntexist # noqa: F401 import notthere.something # noqa: F401 -from notthere import a, few, things # noqa: F401 \ No newline at end of file +from notthere import a, few, things # noqa: F401 diff --git a/test/fixture/python_scanner/nested1/nested2/nested3/imports_grandparent_module.py b/test/fixture/python_scanner/nested1/nested2/nested3/imports_grandparent_module.py index 06bb7f5..e952aef 100644 --- a/test/fixture/python_scanner/nested1/nested2/nested3/imports_grandparent_module.py +++ b/test/fixture/python_scanner/nested1/nested2/nested3/imports_grandparent_module.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from ... import module diff --git a/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_module.py b/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_module.py index be10279..9701e4d 100644 --- a/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_module.py +++ b/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_module.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from .. import module diff --git a/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_then_submodule.py b/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_then_submodule.py index 39f1a1a..cc629c0 100644 --- a/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_then_submodule.py +++ b/test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_then_submodule.py @@ -1 +1,5 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from ...nested2a import module diff --git a/test/fixture/python_scanner/simple_package/module1.py b/test/fixture/python_scanner/simple_package/module1.py index 6880c47..1991088 100644 --- a/test/fixture/python_scanner/simple_package/module1.py +++ b/test/fixture/python_scanner/simple_package/module1.py @@ -1,2 +1,6 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def somefunc(): - return \ No newline at end of file + return diff --git a/test/fixture/test_main.c b/test/fixture/test_main.c index adbe919..e81a58b 100644 --- a/test/fixture/test_main.c +++ b/test/fixture/test_main.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int main( int argc, char* argv[] ) { return 0; diff --git a/test/fixture/wrapper.py b/test/fixture/wrapper.py index c266cfa..05cea02 100644 --- a/test/fixture/wrapper.py +++ b/test/fixture/wrapper.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Command wrapper, for testing SCons. diff --git a/test/fixture/wrapper_with_args.py b/test/fixture/wrapper_with_args.py index 769aea4..6621077 100644 --- a/test/fixture/wrapper_with_args.py +++ b/test/fixture/wrapper_with_args.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Command wrapper taking arguments, for testing SCons. diff --git a/test/ninja/ninja-fixture/bar.c b/test/ninja/ninja-fixture/bar.c index 15b2ecc..cc7b901 100644 --- a/test/ninja/ninja-fixture/bar.c +++ b/test/ninja/ninja-fixture/bar.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/ninja/ninja-fixture/foo.c b/test/ninja/ninja-fixture/foo.c index ba35c68..8389085 100644 --- a/test/ninja/ninja-fixture/foo.c +++ b/test/ninja/ninja-fixture/foo.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/ninja/ninja-fixture/gen_source.c b/test/ninja/ninja-fixture/gen_source.c index 38ac3fe..dffaecc 100644 --- a/test/ninja/ninja-fixture/gen_source.c +++ b/test/ninja/ninja-fixture/gen_source.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/ninja/ninja-fixture/test1.c b/test/ninja/ninja-fixture/test1.c index 678461f..f2c28f7 100644 --- a/test/ninja/ninja-fixture/test1.c +++ b/test/ninja/ninja-fixture/test1.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/ninja/ninja-fixture/test2.cpp b/test/ninja/ninja-fixture/test2.cpp index 69b54c9..504956e 100644 --- a/test/ninja/ninja-fixture/test2.cpp +++ b/test/ninja/ninja-fixture/test2.cpp @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include "test2.hpp" int @@ -13,4 +17,4 @@ int Foo::print_function() { std::cout << "print_function"; return 0; -} \ No newline at end of file +} diff --git a/test/ninja/ninja-fixture/test_impl.c b/test/ninja/ninja-fixture/test_impl.c index ac3fd88..5f12306 100644 --- a/test/ninja/ninja-fixture/test_impl.c +++ b/test/ninja/ninja-fixture/test_impl.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + #include #include diff --git a/test/ninja/ninja_test_sconscripts/ninja_conftest b/test/ninja/ninja_test_sconscripts/ninja_conftest index 993972a..7549880 100644 --- a/test/ninja/ninja_test_sconscripts/ninja_conftest +++ b/test/ninja/ninja_test_sconscripts/ninja_conftest @@ -1,10 +1,13 @@ -SetOption('experimental','ninja') -DefaultEnvironment(tools=[]) +# MIT License +# +# Copyright The SCons Foundation import sys -env = Environment() +SetOption('experimental','ninja') +DefaultEnvironment(tools=[]) +env = Environment() conf = Configure(env) env.Tool('ninja') diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_control_c_ninja b/test/ninja/ninja_test_sconscripts/sconstruct_control_c_ninja index 34d7872..7fdcf29 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_control_c_ninja +++ b/test/ninja/ninja_test_sconscripts/sconstruct_control_c_ninja @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import os import signal diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_default_targets b/test/ninja/ninja_test_sconscripts/sconstruct_default_targets index 8963270..1a92be3 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_default_targets +++ b/test/ninja/ninja_test_sconscripts/sconstruct_default_targets @@ -1,12 +1,14 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons SetOption('experimental','ninja') DefaultEnvironment(tools=[]) env = Environment(tools=[]) - env.Tool('ninja') - env.Command('out1.txt', 'foo.c', 'echo test > $TARGET' ) out2_node = env.Command('out2.txt', 'foo.c', 'echo test > $TARGET', NINJA_FORCE_SCONS_BUILD=True) alias = env.Alias('def', out2_node) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback b/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback index ef3562b..75a6dae 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback +++ b/test/ninja/ninja_test_sconscripts/sconstruct_force_scons_callback @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption("experimental", "ninja") DefaultEnvironment(tools=[]) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build b/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build index 81a4366..9769e15 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build +++ b/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build_cxx b/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build_cxx index f7137df..c306b21 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build_cxx +++ b/test/ninja/ninja_test_sconscripts/sconstruct_generate_and_build_cxx @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) env = Environment() diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_generated_sources_alias b/test/ninja/ninja_test_sconscripts/sconstruct_generated_sources_alias index 3661bcc..d8fcf09 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_generated_sources_alias +++ b/test/ninja/ninja_test_sconscripts/sconstruct_generated_sources_alias @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons SetOption('experimental','ninja') @@ -38,4 +42,4 @@ my_gen_alias, env.Textfile('generated_header2.c', [ 'int func2(){return func1();}' ]) -env.Program(target='gen_source', source=['gen_source.c', 'generated_header2.c']) \ No newline at end of file +env.Program(target='gen_source', source=['gen_source.c', 'generated_header2.c']) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_mingw_command_generator_action b/test/ninja/ninja_test_sconscripts/sconstruct_mingw_command_generator_action index e3fcfe2..475fca7 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_mingw_command_generator_action +++ b/test/ninja/ninja_test_sconscripts/sconstruct_mingw_command_generator_action @@ -1,7 +1,11 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) env = Environment(tools=['mingw']) env.Tool('ninja') dll = env.SharedLibrary(target='test_impl', source='test_impl.c') -env.Program(target='test', source='test1.c', LIBS=[dll]) \ No newline at end of file +env.Program(target='test', source='test1.c', LIBS=[dll]) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_mingw_depfile_format b/test/ninja/ninja_test_sconscripts/sconstruct_mingw_depfile_format index b765db5..4a48ca6 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_mingw_depfile_format +++ b/test/ninja/ninja_test_sconscripts/sconstruct_mingw_depfile_format @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_command_line b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_command_line index 4967912..ffd0d03 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_command_line +++ b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_command_line @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism index 3d3eecb..a7982d4 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism +++ b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import random SetOption('experimental', 'ninja') diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_no_for_sig_subst b/test/ninja/ninja_test_sconscripts/sconstruct_no_for_sig_subst index 69f72b6..dda8d0d 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_no_for_sig_subst +++ b/test/ninja/ninja_test_sconscripts/sconstruct_no_for_sig_subst @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import SCons SetOption('experimental','ninja') diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_response_file b/test/ninja/ninja_test_sconscripts/sconstruct_response_file index 6b7eb5d..c384054 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_response_file +++ b/test/ninja/ninja_test_sconscripts/sconstruct_response_file @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + SetOption('experimental','ninja') DefaultEnvironment(tools=[]) @@ -12,4 +16,4 @@ env.Program(target='foo', source='foo.c', OBJSUFFIX=env['OBJSUFFIX'] + "1") env2 = env.Clone() env2.Append(CPPPATH='very/long/and/very/fake/path/for/testing') -env2.Program(target='foo2', source='foo.c', OBJSUFFIX=env['OBJSUFFIX'] + "2") \ No newline at end of file +env2.Program(target='foo2', source='foo.c', OBJSUFFIX=env['OBJSUFFIX'] + "2") diff --git a/test/option/fixture/SConstruct__experimental b/test/option/fixture/SConstruct__experimental index 2348b9a..d1e8fc7 100644 --- a/test/option/fixture/SConstruct__experimental +++ b/test/option/fixture/SConstruct__experimental @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from SCons.Script.SConsOptions import experimental_features print("All Features=%s" % ','.join(sorted(experimental_features))) diff --git a/test/option/fixture/SConstruct__taskmastertrace b/test/option/fixture/SConstruct__taskmastertrace index 91e8c91..eedd6fb 100644 --- a/test/option/fixture/SConstruct__taskmastertrace +++ b/test/option/fixture/SConstruct__taskmastertrace @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +# DefaultEnvironment(tools=[]) env = Environment(tools=[]) diff --git a/test/option/hash-format/SConstruct b/test/option/hash-format/SConstruct index de76e1b..44cab5a 100644 --- a/test/option/hash-format/SConstruct +++ b/test/option/hash-format/SConstruct @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import atexit import sys diff --git a/test/option/hash-format/build.py b/test/option/hash-format/build.py index 6b6baad..1d14042 100644 --- a/test/option/hash-format/build.py +++ b/test/option/hash-format/build.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys with open(sys.argv[1], 'wb') as f, open(sys.argv[2], 'rb') as infp: - f.write(infp.read()) \ No newline at end of file + f.write(infp.read()) diff --git a/test/packaging/convenience-functions/image/SConstruct b/test/packaging/convenience-functions/image/SConstruct index a424fd9..e11bff5 100644 --- a/test/packaging/convenience-functions/image/SConstruct +++ b/test/packaging/convenience-functions/image/SConstruct @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['default', 'packaging']) prog = env.Install( 'bin/', ["f1", "f2"] ) env.File( "f3" ) diff --git a/test/packaging/rpm/src/main.c b/test/packaging/rpm/src/main.c index 49e8969..cff3239 100644 --- a/test/packaging/rpm/src/main.c +++ b/test/packaging/rpm/src/main.c @@ -1,3 +1,7 @@ +// SPDX-License-Identifier: MIT +// +// Copyright The SCons Foundation + int main( int argc, char* argv[] ) { diff --git a/test/packaging/sandbox-test/SConstruct b/test/packaging/sandbox-test/SConstruct index f44a471..c286d80 100644 --- a/test/packaging/sandbox-test/SConstruct +++ b/test/packaging/sandbox-test/SConstruct @@ -1,19 +1,27 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation from glob import glob -src_files = glob( 'src/*.c' ) -include_files = glob( 'src/*.h' ) +src_files = glob('src/*.c') +include_files = glob('src/*.h') -SharedLibrary( 'foobar', src_files ) +SharedLibrary('foobar', src_files) +DefaultEnvironment(tools=[]) env = Environment(tools=['default', 'packaging']) -env.Package( NAME = 'libfoobar', - VERSION = '1.2.3', - PACKAGETYPE = 'targz', - source = src_files + include_files ) +env.Package( + NAME='libfoobar', + VERSION='1.2.3', + PACKAGETYPE='targz', + source=src_files + include_files, +) -env.Package( NAME = 'libfoobar', - VERSION = '1.2.3', - PACKAGETYPE = 'zip', - source = src_files + include_files ) +env.Package( + NAME='libfoobar', + VERSION='1.2.3', + PACKAGETYPE='zip', + source=src_files + include_files, +) diff --git a/test/textfile/fixture/SConstruct b/test/textfile/fixture/SConstruct index b246687..8c3dc3b 100644 --- a/test/textfile/fixture/SConstruct +++ b/test/textfile/fixture/SConstruct @@ -1,5 +1,8 @@ -DefaultEnvironment(tools=[]) +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation +DefaultEnvironment(tools=[]) env = Environment(tools=['textfile']) data0 = ['Goethe', 'Schiller'] data = ['lalala', 42, data0, 'tanteratei', @@ -11,9 +14,11 @@ env.Textfile('foo1a.txt', data + ['']) env.Textfile('foo2a.txt', data + [''], LINESEPARATOR='|*') issue_4021_textfile = r'..\..\..\@HINT_PATH@\Datalogics.PDFL.dll' -env.Textfile('issue-4021.txt', issue_4021_textfile, - SUBST_DICT={'@HINT_PATH@': r'NETCore\bin\$$(Platform)\$$(Configuration)'}) - +env.Textfile( + 'issue-4021.txt', + issue_4021_textfile, + SUBST_DICT={'@HINT_PATH@': r'NETCore\bin\$$(Platform)\$$(Configuration)'}, +) # recreate the list with the data wrapped in Value() data0 = list(map(Value, data0)) data = list(map(Value, data)) diff --git a/test/textfile/fixture/SConstruct.2 b/test/textfile/fixture/SConstruct.2 index b7e63a1..6b5f02e 100644 --- a/test/textfile/fixture/SConstruct.2 +++ b/test/textfile/fixture/SConstruct.2 @@ -1,9 +1,14 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) -textlist = ['This line has no substitutions', - 'This line has @subst@ substitutions', - 'This line has %subst% substitutions', - ] +textlist = [ + 'This line has no substitutions', + 'This line has @subst@ substitutions', + 'This line has %subst% substitutions', +] sub1 = {'@subst@': 'most'} sub2 = {'%subst%': 'many'} diff --git a/test/textfile/fixture/SConstruct.issue-3540 b/test/textfile/fixture/SConstruct.issue-3540 index 021689a..04cccca 100644 --- a/test/textfile/fixture/SConstruct.issue-3540 +++ b/test/textfile/fixture/SConstruct.issue-3540 @@ -1,17 +1,16 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + """ Test for GH Issue 3540 textfile()'s action is not sensitive to changes in TEXTFILESUFFIX (rather was sensitive to SUBSTFILESUFFIX) - """ -DefaultEnvironment(tools=[]) - text_file_suffix = ARGUMENTS.get('text_file_suffix', 'DEFAULTSUFFIX') - -env = Environment(tools=['textfile'], - TEXTFILESUFFIX=text_file_suffix) - +DefaultEnvironment(tools=[]) +env = Environment(tools=['textfile'], TEXTFILESUFFIX=text_file_suffix) env['FOO_PATH'] = "test-value-1" foo = env.Substfile( @@ -19,5 +18,5 @@ foo = env.Substfile( source="substfile.in", SUBST_DICT={ "@foo_path@": "$FOO_PATH", - } + }, ) diff --git a/test/textfile/fixture/SConstruct.issue-3550 b/test/textfile/fixture/SConstruct.issue-3550 index 0239ade..b2708d4 100644 --- a/test/textfile/fixture/SConstruct.issue-3550 +++ b/test/textfile/fixture/SConstruct.issue-3550 @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + DefaultEnvironment(tools=[]) env = Environment(tools=['textfile']) diff --git a/test/textfile/fixture/SConstruct.issue-4037 b/test/textfile/fixture/SConstruct.issue-4037 index d5c8f96..44cc3ff 100644 --- a/test/textfile/fixture/SConstruct.issue-4037 +++ b/test/textfile/fixture/SConstruct.issue-4037 @@ -1,3 +1,8 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment() def generator(source, target, env, for_signature): @@ -9,10 +14,6 @@ env['GENERATOR'] = generator env.Textfile( target="target", - source=[ - "@generated@", - ], - SUBST_DICT={ - '@generated@' : '$GENERATOR', - }, + source=["@generated@"], + SUBST_DICT={'@generated@' : '$GENERATOR'}, ) diff --git a/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py index 1c024e1..670c942 100644 --- a/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py +++ b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py index 225b9aa..1a8d052 100644 --- a/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py index c266f89..96e681b 100644 --- a/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py index f203260..e34618d 100644 --- a/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1_2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py index b1b47a2..047ae78 100644 --- a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py index 407df86..d99e6c5 100644 --- a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2_2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/SConstruct b/test/toolpath/nested/image/SConstruct index 7fac870..89f1041 100644 --- a/test/toolpath/nested/image/SConstruct +++ b/test/toolpath/nested/image/SConstruct @@ -1,39 +1,47 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + import sys, os -toollist = ['Toolpath_TestTool1', - 'Toolpath_TestTool2', - 'subdir1.Toolpath_TestTool1_1', - 'subdir1.Toolpath_TestTool1_2', - 'subdir1.subdir2.Toolpath_TestTool2_1', - 'subdir1.subdir2.Toolpath_TestTool2_2', - ] +DefaultEnvironment(tools=[]) + +toollist = [ + 'Toolpath_TestTool1', + 'Toolpath_TestTool2', + 'subdir1.Toolpath_TestTool1_1', + 'subdir1.Toolpath_TestTool1_2', + 'subdir1.subdir2.Toolpath_TestTool2_1', + 'subdir1.subdir2.Toolpath_TestTool2_2', +] print('Test where tools are located under site_scons/site_tools') env1 = Environment(tools=toollist) -print("env1['Toolpath_TestTool1'] = %s"%env1.get('Toolpath_TestTool1')) -print("env1['Toolpath_TestTool2'] = %s"%env1.get('Toolpath_TestTool2')) -print("env1['Toolpath_TestTool1_1'] = %s"%env1.get('Toolpath_TestTool1_1')) -print("env1['Toolpath_TestTool1_2'] = %s"%env1.get('Toolpath_TestTool1_2')) -print("env1['Toolpath_TestTool2_1'] = %s"%env1.get('Toolpath_TestTool2_1')) -print("env1['Toolpath_TestTool2_2'] = %s"%env1.get('Toolpath_TestTool2_2')) +print("env1['Toolpath_TestTool1'] = %s" % env1.get('Toolpath_TestTool1')) +print("env1['Toolpath_TestTool2'] = %s" % env1.get('Toolpath_TestTool2')) +print("env1['Toolpath_TestTool1_1'] = %s" % env1.get('Toolpath_TestTool1_1')) +print("env1['Toolpath_TestTool1_2'] = %s" % env1.get('Toolpath_TestTool1_2')) +print("env1['Toolpath_TestTool2_1'] = %s" % env1.get('Toolpath_TestTool2_1')) +print("env1['Toolpath_TestTool2_2'] = %s" % env1.get('Toolpath_TestTool2_2')) print('Test where toolpath is set in the env constructor') env2 = Environment(tools=toollist, toolpath=['Libs/tools_example']) -print("env2['Toolpath_TestTool1'] = %s"%env2.get('Toolpath_TestTool1')) -print("env2['Toolpath_TestTool2'] = %s"%env2.get('Toolpath_TestTool2')) -print("env2['Toolpath_TestTool1_1'] = %s"%env2.get('Toolpath_TestTool1_1')) -print("env2['Toolpath_TestTool1_2'] = %s"%env2.get('Toolpath_TestTool1_2')) -print("env2['Toolpath_TestTool2_1'] = %s"%env2.get('Toolpath_TestTool2_1')) -print("env2['Toolpath_TestTool2_2'] = %s"%env2.get('Toolpath_TestTool2_2')) +print("env2['Toolpath_TestTool1'] = %s" % env2.get('Toolpath_TestTool1')) +print("env2['Toolpath_TestTool2'] = %s" % env2.get('Toolpath_TestTool2')) +print("env2['Toolpath_TestTool1_1'] = %s" % env2.get('Toolpath_TestTool1_1')) +print("env2['Toolpath_TestTool1_2'] = %s" % env2.get('Toolpath_TestTool1_2')) +print("env2['Toolpath_TestTool2_1'] = %s" % env2.get('Toolpath_TestTool2_1')) +print("env2['Toolpath_TestTool2_2'] = %s" % env2.get('Toolpath_TestTool2_2')) print('Test a Clone') base = Environment(tools=[], toolpath=['Libs/tools_example']) derived = base.Clone(tools=['subdir1.Toolpath_TestTool1_1']) -print("derived['Toolpath_TestTool1_1'] = %s"%derived.get('Toolpath_TestTool1_1')) - - +print("derived['Toolpath_TestTool1_1'] = %s" % derived.get('Toolpath_TestTool1_1')) print('Test using syspath as the toolpath') -print('Lets pretend that tools_example within Libs is actually a module installed via pip') +print( + 'Lets pretend that tools_example within Libs ' + 'is actually a module installed via pip' +) oldsyspath = sys.path dir_path = Dir('.').srcnode().abspath dir_path = os.path.join(dir_path, 'Libs') @@ -43,27 +51,29 @@ searchpaths = [] for item in sys.path: if os.path.isdir(item): searchpaths.append(item) -toollist = ['tools_example.Toolpath_TestTool1', - 'tools_example.Toolpath_TestTool2', - 'tools_example.subdir1.Toolpath_TestTool1_1', - 'tools_example.subdir1.Toolpath_TestTool1_2', - 'tools_example.subdir1.subdir2.Toolpath_TestTool2_1', - 'tools_example.subdir1.subdir2.Toolpath_TestTool2_2', - ] +toollist = [ + 'tools_example.Toolpath_TestTool1', + 'tools_example.Toolpath_TestTool2', + 'tools_example.subdir1.Toolpath_TestTool1_1', + 'tools_example.subdir1.Toolpath_TestTool1_2', + 'tools_example.subdir1.subdir2.Toolpath_TestTool2_1', + 'tools_example.subdir1.subdir2.Toolpath_TestTool2_2', +] env3 = Environment(tools=toollist, toolpath=searchpaths) -print("env3['Toolpath_TestTool1'] = %s"%env3.get('Toolpath_TestTool1')) -print("env3['Toolpath_TestTool2'] = %s"%env3.get('Toolpath_TestTool2')) -print("env3['Toolpath_TestTool1_1'] = %s"%env3.get('Toolpath_TestTool1_1')) -print("env3['Toolpath_TestTool1_2'] = %s"%env3.get('Toolpath_TestTool1_2')) -print("env3['Toolpath_TestTool2_1'] = %s"%env3.get('Toolpath_TestTool2_1')) -print("env3['Toolpath_TestTool2_2'] = %s"%env3.get('Toolpath_TestTool2_2')) - +print("env3['Toolpath_TestTool1'] = %s" % env3.get('Toolpath_TestTool1')) +print("env3['Toolpath_TestTool2'] = %s" % env3.get('Toolpath_TestTool2')) +print("env3['Toolpath_TestTool1_1'] = %s" % env3.get('Toolpath_TestTool1_1')) +print("env3['Toolpath_TestTool1_2'] = %s" % env3.get('Toolpath_TestTool1_2')) +print("env3['Toolpath_TestTool2_1'] = %s" % env3.get('Toolpath_TestTool2_1')) +print("env3['Toolpath_TestTool2_2'] = %s" % env3.get('Toolpath_TestTool2_2')) print('Test using PyPackageDir') toollist = ['Toolpath_TestTool2_1', 'Toolpath_TestTool2_2'] -env4 = Environment(tools = toollist, toolpath = [PyPackageDir('tools_example.subdir1.subdir2')]) -print("env4['Toolpath_TestTool2_1'] = %s"%env4.get('Toolpath_TestTool2_1')) -print("env4['Toolpath_TestTool2_2'] = %s"%env4.get('Toolpath_TestTool2_2')) +env4 = Environment( + tools=toollist, toolpath=[PyPackageDir('tools_example.subdir1.subdir2')] +) +print("env4['Toolpath_TestTool2_1'] = %s" % env4.get('Toolpath_TestTool2_1')) +print("env4['Toolpath_TestTool2_2'] = %s" % env4.get('Toolpath_TestTool2_2')) sys.path = oldsyspath diff --git a/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py index 1c024e1..670c942 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py +++ b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py index 225b9aa..1a8d052 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py +++ b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py index c266f89..96e681b 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py index f203260..e34618d 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool1_2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py index b1b47a2..047ae78 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py index 407df86..d99e6c5 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['Toolpath_TestTool2_2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/relative_import/image/SConstruct b/test/toolpath/relative_import/image/SConstruct index cf607d1..0f720e8 100644 --- a/test/toolpath/relative_import/image/SConstruct +++ b/test/toolpath/relative_import/image/SConstruct @@ -1,10 +1,15 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + +DefaultEnvironment(tools=[]) env = Environment(tools=['TestTool1', 'TestTool1.TestTool1_2'], toolpath=['tools']) # Test a relative import within the root of the tools directory -print("env['TestTool1'] = %s"%env.get('TestTool1')) -print("env['TestTool1_1'] = %s"%env.get('TestTool1_1')) +print("env['TestTool1'] = %s" % env.get('TestTool1')) +print("env['TestTool1_1'] = %s" % env.get('TestTool1_1')) # Test a relative import within a sub dir -print("env['TestTool1_2'] = %s"%env.get('TestTool1_2')) -print("env['TestTool1_2_1'] = %s"%env.get('TestTool1_2_1')) -print("env['TestTool1_2_2'] = %s"%env.get('TestTool1_2_2')) +print("env['TestTool1_2'] = %s" % env.get('TestTool1_2')) +print("env['TestTool1_2_1'] = %s" % env.get('TestTool1_2_1')) +print("env['TestTool1_2_2'] = %s" % env.get('TestTool1_2_2')) diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py index 584d353..0c11a8c 100644 --- a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py +++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['TestTool1_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py index 62d754b..100c05f 100644 --- a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py +++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['TestTool1_2_1'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py index 12c6018..ba65226 100644 --- a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py +++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py @@ -1,4 +1,9 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + def generate(env): env['TestTool1_2_2'] = 1 + def exists(env): return 1 diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py index 58fdc93..74b05b3 100644 --- a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py +++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py @@ -1,3 +1,7 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from . import TestTool1_2_1 from . import TestTool1_2_2 @@ -5,6 +9,7 @@ def generate(env): env['TestTool1_2'] = 1 TestTool1_2_1.generate(env) TestTool1_2_2.generate(env) + def exists(env): TestTool1_2_1.exists(env) TestTool1_2_2.exists(env) diff --git a/test/toolpath/relative_import/image/tools/TestTool1/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/__init__.py index c479560..8a7f81b 100644 --- a/test/toolpath/relative_import/image/tools/TestTool1/__init__.py +++ b/test/toolpath/relative_import/image/tools/TestTool1/__init__.py @@ -1,9 +1,14 @@ +# SPDX-License-Identifier: MIT +# +# Copyright The SCons Foundation + from . import TestTool1_1 def generate(env): env['TestTool1'] = 1 # Include another tool within the same directory TestTool1_1.generate(env) + def exists(env): TestTool1_1.exists(env) return 1 -- cgit v0.12 From a28f56e5dd9b6ae384e50eb47ce35333d8ee5e91 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 22 May 2023 12:22:28 -0600 Subject: Changes for Python 3.12 support With Python 3.12 now in feature freeze, we can do a "final update" to sweep up issues. - new bytecodes for ActionTests.py - adapt to changes to pathlib module in runtest.py (PosixPath no longer converts slashes if given a Windows-style path). Neither of these are "user visible", only on the testing side, so no doc impacts. Signed-off-by: Mats Wichmann --- CHANGES.txt | 7 ++ SCons/ActionTests.py | 237 ++++++++++++++++++++++++--------------------------- runtest.py | 10 ++- 3 files changed, 125 insertions(+), 129 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6e8e677..2e37f0c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -32,6 +32,13 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER that if arg was a list, a ListAction was *always* returned; mention default Decider and sort the names of available decider functions, and add a version marking. Minor fiddling with Alias.py docstrings. + - Python 3.12 support: new bytecodes for ActionTests.py, adapt to + changes to pathlib module in runtest.py (PosixPath no longer + converts slashes if given a Windows-style path). Also switch to + using `subTest` in `ActionTests`, so that we can see all 21 fails + due to bytecode changes (previously testcases aborted on the first + assert fail so we only saw seven), and use unittest asserts to + simplify complex printing stanzas. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/SCons/ActionTests.py b/SCons/ActionTests.py index 2e6204e..533a007 100644 --- a/SCons/ActionTests.py +++ b/SCons/ActionTests.py @@ -1367,7 +1367,7 @@ class CommandActionTestCase(unittest.TestCase): class SpecialEnvironment(Environment): def WhereIs(self, prog): return prog - + class fs: def File(name): return name @@ -1541,7 +1541,7 @@ class CommandGeneratorActionTestCase(unittest.TestCase): (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 11): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), - (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), + (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00y\x00),(),()'), } meth_matches = [ @@ -1557,15 +1557,15 @@ class CommandGeneratorActionTestCase(unittest.TestCase): env = Environment(XYZ='foo') - a = self.factory(f_global) - c = a.get_contents(target=[], source=[], env=env) - assert c == func_matches[sys.version_info[:2]], f"Got\n{c!r}\nExpected\n" + repr( - func_matches[sys.version_info[:2]]) + with self.subTest(): + a = self.factory(f_global) + c = a.get_contents(target=[], source=[], env=env) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - a = self.factory(f_local) - c = a.get_contents(target=[], source=[], env=env) - assert c == func_matches[sys.version_info[:2]], f"Got\n{c!r}\nExpected\n" + repr( - func_matches[sys.version_info[:2]]) + with self.subTest(): + a = self.factory(f_local) + c = a.get_contents(target=[], source=[], env=env) + self.assertEqual(c, func_matches[sys.version_info[:2]]) def f_global2(target, source, env, for_signature): return SCons.Action.Action(GlobalFunc, varlist=['XYZ']) @@ -1575,13 +1575,15 @@ class CommandGeneratorActionTestCase(unittest.TestCase): matches_foo = func_matches[sys.version_info[:2]] + b'foo' - a = self.factory(f_global2) - c = a.get_contents(target=[], source=[], env=env) - assert c in matches_foo, repr(c) + with self.subTest(): + a = self.factory(f_global2) + c = a.get_contents(target=[], source=[], env=env) + self.assertIn(c, matches_foo) - a = self.factory(f_local2) - c = a.get_contents(target=[], source=[], env=env) - assert c in matches_foo, repr(c) + with self.subTest(): + a = self.factory(f_local2) + c = a.get_contents(target=[], source=[], env=env) + self.assertIn(c, matches_foo) class FunctionActionTestCase(unittest.TestCase): @@ -1720,7 +1722,7 @@ class FunctionActionTestCase(unittest.TestCase): (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 11): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), - (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), + (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00y\x00),(),()'), } @@ -1732,66 +1734,62 @@ class FunctionActionTestCase(unittest.TestCase): (3, 9): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 10): bytearray(b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 11): bytearray(b'1, 1, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), - (3, 12): bytearray(b'1, 1, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), + (3, 12): bytearray(b'1, 1, 0, 0,(),(),(\x97\x00y\x00),(),()'), } def factory(act, **kw): return SCons.Action.FunctionAction(act, kw) - a = factory(GlobalFunc) - c = a.get_contents(target=[], source=[], env=Environment()) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + a = factory(GlobalFunc) + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - a = factory(LocalFunc) - c = a.get_contents(target=[], source=[], env=Environment()) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + a = factory(LocalFunc) + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, func_matches[sys.version_info[:2]]) matches_foo = func_matches[sys.version_info[:2]] + b'foo' - a = factory(GlobalFunc, varlist=['XYZ']) - c = a.get_contents(target=[], source=[], env=Environment()) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) - # assert c in func_matches, repr(c) + with self.subTest(): + a = factory(GlobalFunc, varlist=['XYZ']) + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - c = a.get_contents(target=[], source=[], env=Environment(XYZ='foo')) - assert c == matches_foo, repr(c) + with self.subTest(): + c = a.get_contents(target=[], source=[], env=Environment(XYZ='foo')) + self.assertEqual(c, matches_foo) ##TODO: is this set of tests still needed? # Make sure a bare string varlist works - a = factory(GlobalFunc, varlist='XYZ') - c = a.get_contents(target=[], source=[], env=Environment()) - # assert c in func_matches, repr(c) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + a = factory(GlobalFunc, varlist='XYZ') + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - c = a.get_contents(target=[], source=[], env=Environment(XYZ='foo')) - assert c in matches_foo, repr(c) + with self.subTest(): + c = a.get_contents(target=[], source=[], env=Environment(XYZ='foo')) + self.assertIn(c, matches_foo) class Foo: def get_contents(self, target, source, env) -> bytes: return b'xyzzy' - a = factory(Foo()) - c = a.get_contents(target=[], source=[], env=Environment()) - assert c == b'xyzzy', repr(c) + with self.subTest(): + a = factory(Foo()) + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, b'xyzzy') class LocalClass: def LocalMethod(self) -> None: pass - lc = LocalClass() - a = factory(lc.LocalMethod) - c = a.get_contents(target=[], source=[], env=Environment()) - assert ( - c == meth_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(meth_matches[sys.version_info[:2]]) + with self.subTest(): + lc = LocalClass() + a = factory(lc.LocalMethod) + c = a.get_contents(target=[], source=[], env=Environment()) + self.assertEqual(c, meth_matches[sys.version_info[:2]]) def test_strfunction(self) -> None: """Test the FunctionAction.strfunction() method.""" @@ -1977,7 +1975,7 @@ class LazyActionTestCase(unittest.TestCase): (3, 9): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 10): bytearray(b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()'), (3, 11): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), - (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()'), + (3, 12): bytearray(b'0, 0, 0, 0,(),(),(\x97\x00y\x00),(),()'), } meth_matches = [ @@ -1990,31 +1988,28 @@ class LazyActionTestCase(unittest.TestCase): a = SCons.Action.Action("${FOO}") - env = Environment(FOO=factory(GlobalFunc)) - c = a.get_contents(target=[], source=[], env=env) - # assert c in func_matches, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(f) for f in func_matches]) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + env = Environment(FOO=factory(GlobalFunc)) + c = a.get_contents(target=[], source=[], env=env) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - env = Environment(FOO=factory(LocalFunc)) - c = a.get_contents(target=[], source=[], env=env) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + env = Environment(FOO=factory(LocalFunc)) + c = a.get_contents(target=[], source=[], env=env) + self.assertEqual(c, func_matches[sys.version_info[:2]]) # matches_foo = [x + b"foo" for x in func_matches] matches_foo = func_matches[sys.version_info[:2]] + b'foo' - env = Environment(FOO=factory(GlobalFunc, varlist=['XYZ'])) - c = a.get_contents(target=[], source=[], env=env) - assert ( - c == func_matches[sys.version_info[:2]] - ), f"Got\n{c!r}\nExpected one of \n" + repr(func_matches[sys.version_info[:2]]) + with self.subTest(): + env = Environment(FOO=factory(GlobalFunc, varlist=['XYZ'])) + c = a.get_contents(target=[], source=[], env=env) + self.assertEqual(c, func_matches[sys.version_info[:2]]) - env['XYZ'] = 'foo' - c = a.get_contents(target=[], source=[], env=env) - assert c in matches_foo, repr(c) + with self.subTest(): + env['XYZ'] = 'foo' + c = a.get_contents(target=[], source=[], env=env) + self.assertIn(c, matches_foo) class ActionCallerTestCase(unittest.TestCase): @@ -2043,55 +2038,48 @@ class ActionCallerTestCase(unittest.TestCase): (3, 9): b'd\x00S\x00', (3, 10): b'd\x00S\x00', (3, 11): b'\x97\x00d\x00S\x00', - (3, 12): b'\x97\x00d\x00S\x00', + (3, 12): b'\x97\x00y\x00', } - af = SCons.Action.ActionFactory(GlobalFunc, strfunc) - ac = SCons.Action.ActionCaller(af, [], {}) - c = ac.get_contents([], [], Environment()) - assert c == matches[sys.version_info[:2]], ( - f"Got\n{c!r}\nExpected one of \n" - + repr(matches[sys.version_info[:2]]) - ) + with self.subTest(): + af = SCons.Action.ActionFactory(GlobalFunc, strfunc) + ac = SCons.Action.ActionCaller(af, [], {}) + c = ac.get_contents([], [], Environment()) + self.assertEqual(c, matches[sys.version_info[:2]]) - af = SCons.Action.ActionFactory(LocalFunc, strfunc) - ac = SCons.Action.ActionCaller(af, [], {}) - c = ac.get_contents([], [], Environment()) - assert c == matches[sys.version_info[:2]], ( - f"Got\n{c!r}\nExpected one of \n" - + repr(matches[sys.version_info[:2]]) - ) + with self.subTest(): + af = SCons.Action.ActionFactory(LocalFunc, strfunc) + ac = SCons.Action.ActionCaller(af, [], {}) + c = ac.get_contents([], [], Environment()) + self.assertEqual(c, matches[sys.version_info[:2]]) class LocalActFunc: def __call__(self) -> None: pass - af = SCons.Action.ActionFactory(GlobalActFunc(), strfunc) - ac = SCons.Action.ActionCaller(af, [], {}) - c = ac.get_contents([], [], Environment()) - assert c == matches[sys.version_info[:2]], ( - f"Got\n{c!r}\nExpected one of \n" - + repr(matches[sys.version_info[:2]]) - ) + with self.subTest(): + af = SCons.Action.ActionFactory(GlobalActFunc(), strfunc) + ac = SCons.Action.ActionCaller(af, [], {}) + c = ac.get_contents([], [], Environment()) + self.assertEqual(c, matches[sys.version_info[:2]]) - af = SCons.Action.ActionFactory(LocalActFunc(), strfunc) - ac = SCons.Action.ActionCaller(af, [], {}) - c = ac.get_contents([], [], Environment()) - assert c == matches[sys.version_info[:2]], ( - f"Got\n{c!r}\nExpected one of \n" - + repr(matches[sys.version_info[:2]]) - ) + with self.subTest(): + af = SCons.Action.ActionFactory(LocalActFunc(), strfunc) + ac = SCons.Action.ActionCaller(af, [], {}) + c = ac.get_contents([], [], Environment()) + self.assertEqual(c, matches[sys.version_info[:2]]) matches = [ b"", b"", ] - af = SCons.Action.ActionFactory(str, strfunc) - ac = SCons.Action.ActionCaller(af, [], {}) - c = ac.get_contents([], [], Environment()) - assert c in ("", "", ""), repr(c) - # ^^ class str for python3 + with self.subTest(): + af = SCons.Action.ActionFactory(str, strfunc) + ac = SCons.Action.ActionCaller(af, [], {}) + c = ac.get_contents([], [], Environment()) + self.assertIn(c, ("", "", "")) + # ^^ class str for python3 def test___call__(self) -> None: """Test calling an ActionCaller""" @@ -2244,24 +2232,23 @@ class ObjectContentsTestCase(unittest.TestCase): # Since the python bytecode has per version differences, # we need different expected results per version + # Note unlike the others, this result is a tuple, use assertIn expected = { - (3, 5): (bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()')), - (3, 6): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()')), - (3, 7): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()')), - (3, 8): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()')), - (3, 9): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()')), - (3, 10): ( + (3, 5): (bytearray(b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()'),), + (3, 6): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),), + (3, 7): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),), + (3, 8): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),), + (3, 9): (bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'),), + (3, 10): ( # 3.10.1, 3.10.2 bytearray(b'3, 3, 0, 0,(N.),(),(|\x00S\x00),(),()'), bytearray(b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()'), - ), # 3.10.1, 3.10.2 - (3, 11): bytearray(b'3, 3, 0, 0,(),(),(\x97\x00|\x00S\x00),(),()'), - (3, 12): bytearray(b'3, 3, 0, 0,(),(),(\x97\x00|\x00S\x00),(),()'), + ), + (3, 11): (bytearray(b'3, 3, 0, 0,(),(),(\x97\x00|\x00S\x00),(),()'),), + (3, 12): (bytearray(b'3, 3, 0, 0,(),(),(\x97\x00|\x00S\x00),(),()'),), } c = SCons.Action._function_contents(func1) - assert c in expected[sys.version_info[:2]], f"Got\n{c!r}\nExpected\n" + repr( - expected[sys.version_info[:2]] - ) + self.assertIn(c, expected[sys.version_info[:2]]) def test_object_contents(self) -> None: """Test that Action._object_contents works""" @@ -2297,13 +2284,11 @@ class ObjectContentsTestCase(unittest.TestCase): b"{TestClass:__main__}[[[(, ()), [(, (,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(\x97\x00d\x01|\x00_\x00\x00\x00\x00\x00\x00\x00\x00\x00d\x02|\x00_\x01\x00\x00\x00\x00\x00\x00\x00\x00d\x00S\x00),(),(),2, 2, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()}}{{{a=a,b=b}}}" ), (3, 12): bytearray( - b"{TestClass:__main__}[[[(, ()), [(, (,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(\x97\x00d\x01|\x00_\x00\x00\x00\x00\x00\x00\x00\x00\x00d\x02|\x00_\x01\x00\x00\x00\x00\x00\x00\x00\x00d\x00S\x00),(),(),2, 2, 0, 0,(),(),(\x97\x00d\x00S\x00),(),()}}{{{a=a,b=b}}}" + b"{TestClass:__main__}[[[(, ()), [(, (,))]]]]{{1, 1, 0, 0,(a,b),(a,b),(\x97\x00d\x01|\x00_\x00\x00\x00\x00\x00\x00\x00\x00\x00d\x02|\x00_\x01\x00\x00\x00\x00\x00\x00\x00\x00y\x00),(),(),2, 2, 0, 0,(),(),(\x97\x00y\x00),(),()}}{{{a=a,b=b}}}" ), } - assert c == expected[sys.version_info[:2]], f"Got\n{c!r}\nExpected\n" + repr( - expected[sys.version_info[:2]] - ) + self.assertEqual(c, expected[sys.version_info[:2]]) def test_code_contents(self) -> None: """Test that Action._code_contents works""" @@ -2335,13 +2320,11 @@ class ObjectContentsTestCase(unittest.TestCase): b'0, 0, 0, 0,(Hello, World!),(print),(\x97\x00\x02\x00e\x00d\x00\xa6\x01\x00\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00d\x01S\x00)' ), (3, 12): bytearray( - b'0, 0, 0, 0,(Hello, World!),(print),(\x97\x00\x02\x00e\x00d\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00d\x01S\x00)' + b'0, 0, 0, 0,(Hello, World!),(print),(\x97\x00\x02\x00e\x00d\x00\xab\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00y\x01)' ), } - assert c == expected[sys.version_info[:2]], f"Got\n{c!r}\nExpected\n" + repr( - expected[sys.version_info[:2]] - ) + self.assertEqual(c, expected[sys.version_info[:2]]) def test_uncaught_exception_bubbles(self): """Test that _subproc bubbles uncaught exceptions""" diff --git a/runtest.py b/runtest.py index 46cdc7b..07d9f33 100755 --- a/runtest.py +++ b/runtest.py @@ -592,7 +592,10 @@ def scanlist(testfile): # backward slashes, first create the object as a PureWindowsPath which # accepts either, then use that to make a Path object to use for # comparisons like "file in scanned_list". - return [Path(PureWindowsPath(t)) for t in tests if t] + if sys.platform == 'win32': + return [Path(t) for t in tests if t] + else: + return [Path(PureWindowsPath(t).as_posix()) for t in tests if t] def find_unit_tests(directory): @@ -641,7 +644,10 @@ else: if args.all: # -a flag testpaths = [Path('SCons'), Path('test')] elif args.testlist: # paths given on cmdline - testpaths = [Path(PureWindowsPath(t)) for t in args.testlist] + if sys.platform == 'win32': + testpaths = [Path(t) for t in args.testlist] + else: + testpaths = [Path(PureWindowsPath(t).as_posix()) for t in args.testlist] for path in testpaths: # Clean up path removing leading ./ or .\ -- cgit v0.12 From ddbcf3c686e7e16f2b57b3b5e3676371b728a964 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 22 May 2023 09:04:51 -0600 Subject: Drop unused environment methods Drop three unused methods from the Environment Base class: get_src_sig_type and get_tgt_sig_type, as well as "private" _changed_source which no longer was mapped to any decider. These were orphaned when the long-deprecated Source Signatures and Target Signatures were removed in #9c4e6c7a3 - missing this change. Signed-off-by: Mats Wichmann --- CHANGES.txt | 6 ++++++ RELEASE.txt | 6 ++++-- SCons/Environment.py | 25 ------------------------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6e8e677..625ff95 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -32,6 +32,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER that if arg was a list, a ListAction was *always* returned; mention default Decider and sort the names of available decider functions, and add a version marking. Minor fiddling with Alias.py docstrings. + - Added copyright headers to files in test/ that didn't have them. + - Drop three unused methods from the Environment Base class: + get_src_sig_type and get_tgt_sig_type, as well as "private" + _changed_source. These were orphaned when the long-deprecated + Source Signatures and Target Signatures were removed, these were + missed at that time. RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/RELEASE.txt b/RELEASE.txt index 5cef731..abaef36 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -26,8 +26,10 @@ DEPRECATED FUNCTIONALITY CHANGED/ENHANCED EXISTING FUNCTIONALITY --------------------------------------- -- List modifications to existing features, where the previous behavior - wouldn't actually be considered a bug +- Three unused non-public methods of the Environment Base class + were dropped: get_src_sig_type, get_tgt_sig_type, _changed_source. + These were unused remnants of the previously removed SourceSignatures + and TargetSignatures features (dropped in 3.1.2). FIXES ----- diff --git a/SCons/Environment.py b/SCons/Environment.py index b074af7..2f1dcaf 100644 --- a/SCons/Environment.py +++ b/SCons/Environment.py @@ -1399,23 +1399,6 @@ class Base(SubstitutionEnvironment): if k not in self._dict: self._dict[k] = v - - def get_src_sig_type(self): - try: - return self.src_sig_type - except AttributeError: - t = SCons.Defaults.DefaultEnvironment().src_sig_type - self.src_sig_type = t - return t - - def get_tgt_sig_type(self): - try: - return self.tgt_sig_type - except AttributeError: - t = SCons.Defaults.DefaultEnvironment().tgt_sig_type - self.tgt_sig_type = t - return t - ####################################################################### # Public methods for manipulating an Environment. These begin with # upper-case letters. The essential characteristic of methods in @@ -1627,14 +1610,6 @@ class Base(SubstitutionEnvironment): def _changed_content(self, dependency, target, prev_ni, repo_node=None): return dependency.changed_content(target, prev_ni, repo_node) - def _changed_source(self, dependency, target, prev_ni, repo_node=None): - target_env = dependency.get_build_env() - type = target_env.get_tgt_sig_type() - if type == 'source': - return target_env.decide_source(dependency, target, prev_ni, repo_node) - else: - return target_env.decide_target(dependency, target, prev_ni, repo_node) - def _changed_timestamp_then_content(self, dependency, target, prev_ni, repo_node=None): return dependency.changed_timestamp_then_content(target, prev_ni, repo_node) -- cgit v0.12 From a910451a1f5e729e24ede5bfccbab032b6d4a5a6 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Mon, 22 May 2023 14:03:08 -0600 Subject: Drop dead code from unit tests Remove dead code: some mocked classes in unit tests had methods which have been removed from the Node class they're mocking, there's no need to shadow those any more as there are no callers. The methods are depends_on (base functionality removed in 2005 ) and is_pseudeo_derived (base functionality removed in 2006). Signed-off-by: Mats Wichmann --- CHANGES.txt | 6 ++++++ SCons/SConfTests.py | 2 -- SCons/Taskmaster/TaskmasterTests.py | 9 --------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6e8e677..569c5a0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -32,6 +32,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER that if arg was a list, a ListAction was *always* returned; mention default Decider and sort the names of available decider functions, and add a version marking. Minor fiddling with Alias.py docstrings. + - Remove dead code: some mocked classes in unit tests had methods + which have been removed from the Node class they're mocking, + there's no need to shadow those any more as there are no callers. + The methods are depends_on (base functionality removed in 2005) + and is_pseudeo_derived (base functionality removed in 2006). There + may well be more! RELEASE 4.5.2 - Sun, 21 Mar 2023 14:08:29 -0700 diff --git a/SCons/SConfTests.py b/SCons/SConfTests.py index e8e0fc7..96ba926 100644 --- a/SCons/SConfTests.py +++ b/SCons/SConfTests.py @@ -199,8 +199,6 @@ class SConfTestCase(unittest.TestCase): self.state = state def alter_targets(self): return [], None - def depends_on(self, nodes): - return None def postprocess(self) -> None: pass def clear(self) -> None: diff --git a/SCons/Taskmaster/TaskmasterTests.py b/SCons/Taskmaster/TaskmasterTests.py index 32959fb..83b7ea9 100644 --- a/SCons/Taskmaster/TaskmasterTests.py +++ b/SCons/Taskmaster/TaskmasterTests.py @@ -197,18 +197,9 @@ class Node: def store_bsig(self) -> None: pass - def is_pseudo_derived(self) -> None: - pass - def is_up_to_date(self): return self._current_val - def depends_on(self, nodes) -> int: - for node in nodes: - if node in self.kids: - return 1 - return 0 - def __str__(self) -> str: return self.name -- cgit v0.12