diff options
author | William Deegan <bill@baddogconsulting.com> | 2024-06-28 00:00:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-28 00:00:15 (GMT) |
commit | ed251e7178125fd3e62381fd26062745edd529ad (patch) | |
tree | 3d7ab73a78734cfe58793bf1caf4640a62e2fe4d | |
parent | 112118151dc8e555f06e573380523dbc78a14a1b (diff) | |
parent | 9e8161a8f56bdc66f7490f9012e1ea7bd80d775f (diff) | |
download | SCons-ed251e7178125fd3e62381fd26062745edd529ad.zip SCons-ed251e7178125fd3e62381fd26062745edd529ad.tar.gz SCons-ed251e7178125fd3e62381fd26062745edd529ad.tar.bz2 |
Merge branch 'master' into ruff
200 files changed, 1310 insertions, 812 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index 07b6fe1..1674bad 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,7 +8,7 @@ image: # linux builds done in Travis CI for now - Visual Studio 2017 - Visual Studio 2019 - - Visual Studio 2022 + #- Visual Studio 2022 # Temporary disable while failing on 14.40 build tools cache: - downloads -> appveyor.yml @@ -37,38 +37,38 @@ environment: # Test oldest and newest supported Pythons, and a subset in between. # Skipping 3.7 and 3.9 at this time - WINPYTHON: "Python312" - - WINPYTHON: "Python310" - - WINPYTHON: "Python38" - - WINPYTHON: "Python36" # remove sets of build jobs based on criteria below # to fine tune the number and platforms tested matrix: exclude: - # test python 3.6 on Visual Studio 2017 image + # XXX test python 3.6 on Visual Studio 2017 image + # test python 3.8 on Visual Studio 2017 image - image: Visual Studio 2017 WINPYTHON: "Python312" - image: Visual Studio 2017 WINPYTHON: "Python310" - image: Visual Studio 2017 - WINPYTHON: "Python38" + WINPYTHON: "Python36" - # test python 3.8 on Visual Studio 2019 image + # test python 3.10 on Visual Studio 2019 image - image: Visual Studio 2019 WINPYTHON: "Python312" - image: Visual Studio 2019 - WINPYTHON: "Python310" + WINPYTHON: "Python38" - image: Visual Studio 2019 WINPYTHON: "Python36" - # test python 3.10 and 3.11 on Visual Studio 2022 image + # test python 3.12 on Visual Studio 2022 image - image: Visual Studio 2022 - WINPYTHON: "Python36" + WINPYTHON: "Python310" - image: Visual Studio 2022 WINPYTHON: "Python38" + - image: Visual Studio 2022 + WINPYTHON: "Python36" # Remove some binaries we don't want to be found # Note this is no longer needed, git-windows bin/ is quite minimal now. diff --git a/CHANGES.txt b/CHANGES.txt index 889a7ae..2730f0c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,8 +4,11 @@ Change Log -NOTE: The 4.0.0 Release of SCons dropped Python 2.7 Support -NOTE: 4.3.0 now requires Python 3.6.0 and above. Python 3.5.x is no longer supported +NOTE: The 4.0.0 release of SCons dropped Python 2.7 support. Use 3.1.2 if + Python 2.7 support is required (but note old SCons releases are unsupported). +NOTE: Since SCons 4.3.0, Python 3.6.0 or above is required. +NOTE: Python 3.6 support is deprecated and will be dropped in a future reease. + python.org no longer supports 3.6 or 3.7, and will drop 3.8 in Oct. 2024. RELEASE VERSION/DATE TO BE FILLED IN LATER @@ -77,6 +80,40 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Framework for scons-time tests adjusted so a path with a long username Windows has squashed doesn't get re-expanded. Fixes a problem seen on GitHub Windows runner which uses a name "runneradmin". + - SCons.Environment.is_valid_construction_var() now returns a boolean to + match the convention that functions beginning with "is" have yes/no + answers (previously returned either None or an re.match object). + Now matches the annotation and docstring (which were prematurely + updated in 4.6). All SCons usage except unit test was already fully + consistent with a bool. + - When a variable is added to a Variables object, it can now be flagged + as "don't perform substitution" by setting the argument subst. + This allows variables to contain characters which would otherwise + cause expansion. Fixes #4241. + - The test runner now recognizes the unittest module's return code of 5, + which means no tests were run. SCons/Script/MainTests.py currently + has no tests, so this particular error code is expected - should not + cause runtest to give up with an "unknown error code". + - Updated the notes about reproducible builds with SCons and the example. + - The Clone() method now respects the variables argument (fixes #3590) + - is_valid_construction_var() (not part of the public API) moved from + SCons.Environment to SCons.Util to avoid the chance of import loops. Variables + and Environment both use the routine and Environment() uses a Variables() + object so better to move to a safer location. + - AddOption and the internal add_local_option which AddOption calls now + recognize a "settable" keyword argument to indicate a project-added + option can also be modified using SetOption. Fixes #3983. + NOTE: If you were using ninja and using SetOption() for ninja options + in your SConscripts prior to loading the ninja tool, you will now + see an error. The fix is to move the SetOption() to after you've loaded + the ninja tool. + - ListVariable now has a separate validator, with the functionality + that was previously part of the converter. The main effect is to + allow a developer to supply a custom validator, which previously + could be inhibited by the converter failing before the validator + is reached. + - Regularized header (copyright, licens) at top of documentation files + using SPDX. RELEASE 4.7.0 - Sun, 17 Mar 2024 17:22:20 -0700 @@ -249,6 +249,19 @@ notifications and other GitHub events (``#github-update``), if those are of interest. See the website for more contact information: https://scons.org/contact.html. +Reproducible Builds +=================== +SCons itself is set up to do "reproducible builds" +(see (https://reproducible-builds.org/specs/source-date-epoch/) +if environment variables ``SOURCE_DATE_EPOCH`` is set - that is, +fields in the package which could change each time the package is +constructed are forced to constant values. + +To support other projects which wish to do the same, a sample script +is provided which can be placed in a site directory, which imports +``SOURCE_DATE_EPOCH`` and sets it in the execution environment of +every created construction envirionment. There's also an installer +script (POSIX shell only). See packaging/etc/README.txt for more details. Donations ========= @@ -258,15 +271,6 @@ software, or hardware) to support continued work on the project. Information is available at https://www.scons.org/donate.html or the GitHub Sponsors button on https://github.com/scons/scons. -Reproducible Builds -=================== -In order to suppor those users who which to produce reproducible builds -(https://reproducible-builds.org/specs/source-date-epoch/) we're now including -logic to force SCons to propagate SOURCE_DATE_EPOCH from your shell environment for -all SCons builds to support reproducible builds we're now providing an example -site_init.py and a script to install it in your ~/.scons. See packaging/etc/README.txt -for more info - For More Information ==================== diff --git a/RELEASE.txt b/RELEASE.txt index 5d5c2eb..7742072 100644 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -44,6 +44,27 @@ CHANGED/ENHANCED EXISTING FUNCTIONALITY of CCFLAGS; the latter variable could cause a compiler warning. - The implementation of Variables was slightly refactored, there should not be user-visible changes. +- SCons.Environment.is_valid_construction_var() now returns a boolean to + match the convention that functions beginning with "is" have yes/no + answers (previously returned either None or an re.match object). + Now matches the annotation and docstring (which were prematurely + updated in 4.6). All SCons usage except unit test was already fully + consistent with a bool. +- The Variables object Add method now accepts a subst keyword argument + (defaults to True) which can be set to inhibit substitution prior to + calling the variable's converter and validator. +- AddOption and the internal add_local_option which AddOption calls now + recognize a "settable" keyword argument to indicate a project-added + option can also be modified using SetOption. + NOTE: If you were using ninja and using SetOption() for ninja options + in your SConscripts prior to loading the ninja tool, you will now + see an error. The fix is to move the SetOption() to after you've loaded + the ninja tool. +- ListVariable now has a separate validator, with the functionality + that was previously part of the converter. The main effect is to + allow a developer to supply a custom validator, which previously + could be inhibited by the converter failing before the validator + is reached. FIXES ----- @@ -52,6 +73,7 @@ FIXES - Improved the conversion of a "foreign" exception from an action into BuildError by making sure our defaults get applied even in corner cases. Fixes Issue #4530 +- The Clone() method now respects the variables argument (fixes #3590) IMPROVEMENTS ------------ @@ -76,6 +98,8 @@ DOCUMENTATION - Restructured API Docs build so main package contents are listed before contents of package submodules. - Updated manpage description of Command "builder" and function. +- Updated the notes about reproducible builds with SCons and the example. +- Regularized header (copyright, licens) at top of documentation files using SPDX. @@ -95,7 +119,14 @@ DEVELOPMENT - Repository linter/formatter changed from flake8/black to ruff, as the latter grants an insane speed boost without compromising functionality. Existing settings were migrated 1-to-1 where possible. - +- The test runner now recognizes the unittest module's return code of 5, + which means no tests were run. SCons/Script/MainTests.py currently + has no tests, so this particular error code is expected - should not + cause runtest to give up with an "unknown error code". +- is_valid_construction_var() (not part of the public API) moved from + SCons.Environment to SCons.Util to avoid the chance of import loops. Variables + and Environment both use the routine and Environment() uses a Variables() + object so better to move to a safer location. Thanks to the following contributors listed below for their contributions to this release. ========================================================================================== diff --git a/SCons/Action.xml b/SCons/Action.xml index becd30f..c71c305 100644 --- a/SCons/Action.xml +++ b/SCons/Action.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Defaults.xml b/SCons/Defaults.xml index c7b8643..c896f69 100644 --- a/SCons/Defaults.xml +++ b/SCons/Defaults.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Environment.py b/SCons/Environment.py index 5bf763d..6669bf8 100644 --- a/SCons/Environment.py +++ b/SCons/Environment.py @@ -76,6 +76,7 @@ from SCons.Util import ( to_String_for_subst, uniquer_hashables, ) +from SCons.Util.envs import is_valid_construction_var from SCons.Util.sctyping import ExecutorType class _Null: @@ -510,13 +511,6 @@ class BuilderDict(UserDict): self.__setitem__(i, v) -_is_valid_var = re.compile(r'[_a-zA-Z]\w*$') - -def is_valid_construction_var(varstr) -> bool: - """Return True if *varstr* is a legitimate construction variable.""" - return _is_valid_var.match(varstr) - - class SubstitutionEnvironment: """Base class for different flavors of construction environments. @@ -605,7 +599,7 @@ class SubstitutionEnvironment: # key and we don't need to check. If we do check, using a # global, pre-compiled regular expression directly is more # efficient than calling another function or a method. - if key not in self._dict and not _is_valid_var.match(key): + if key not in self._dict and not is_valid_construction_var(key): raise UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -1568,16 +1562,28 @@ class Base(SubstitutionEnvironment): self._dict[key] = dk + val self.scanner_map_delete(kw) - def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw): + def Clone(self, tools=[], toolpath=None, variables=None, parse_flags=None, **kw): """Return a copy of a construction Environment. - The copy is like a Python "deep copy"--that is, independent - copies are made recursively of each objects--except that - a reference is copied when an object is not deep-copyable - (like a function). There are no references to any mutable - objects in the original Environment. - """ + The copy is like a Python "deep copy": independent copies are made + recursively of each object, except that a reference is copied when + an object is not deep-copyable (like a function). There are no + references to any mutable objects in the original environment. + Unrecognized keyword arguments are taken as construction variable + assignments. + + Arguments: + tools: list of tools to initialize. + toolpath: list of paths to search for tools. + variables: a :class:`~SCons.Variables.Variables` object to + use to populate construction variables from command-line + variables. + parse_flags: option strings to parse into construction variables. + + .. versionadded:: 4.8.0 + The optional *variables* parameter was added. + """ builders = self._dict.get('BUILDERS', {}) clone = copy.copy(self) @@ -1603,6 +1609,8 @@ class Base(SubstitutionEnvironment): for key, value in kw.items(): new[key] = SCons.Subst.scons_subst_once(value, self, key) clone.Replace(**new) + if variables: + variables.Update(clone) apply_tools(clone, tools, toolpath) diff --git a/SCons/Environment.xml b/SCons/Environment.xml index 5f152f2..f489ca1 100644 --- a/SCons/Environment.xml +++ b/SCons/Environment.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -1079,11 +1080,12 @@ Clean(docdir, os.path.join(docdir, projectname)) </arguments> <summary> <para> -Returns a separate copy of a construction environment. -If there are any keyword arguments specified, -they are added to the returned copy, +Returns an independent copy of a &consenv;. +If there are any unrecognized keyword arguments specified, +they are added as &consvars; in the copy, overwriting any existing values -for the keywords. +for those keywords. +See the manpage section "Construction Environments" for more details. </para> <para> @@ -1096,8 +1098,9 @@ env3 = env.Clone(CCFLAGS='-g') </example_commands> <para> -Additionally, a list of tools and a toolpath may be specified, as in -the &f-link-Environment; constructor: +A list of <parameter>tools</parameter> +and a <parameter>toolpath</parameter> may be specified, +as in the &f-link-Environment; constructor: </para> <example_commands> @@ -1110,7 +1113,7 @@ env4 = env.Clone(tools=['msvc', MyTool]) <para> The <parameter>parse_flags</parameter> -keyword argument is also recognized to allow merging command-line +keyword argument is also recognized, to allow merging command-line style arguments into the appropriate construction variables (see &f-link-env-MergeFlags;). </para> @@ -1119,6 +1122,17 @@ variables (see &f-link-env-MergeFlags;). # create an environment for compiling programs that use wxWidgets wx_env = env.Clone(parse_flags='!wx-config --cflags --cxxflags') </example_commands> + +<para> +The <parameter>variables</parameter> +keyword argument is also recognized, to allow (re)initializing +&consvars; from a <literal>Variables</literal> object. +</para> + +<para> +<emphasis>Changed in version 4.8.0:</emphasis> +the <parameter>variables</parameter> parameter was added. +</para> </summary> </scons_function> @@ -1760,7 +1774,7 @@ will print: </arguments> <summary> <para> -Return a new construction environment +Return a new &consenv; initialized with the specified <parameter>key</parameter>=<replaceable>value</replaceable> pairs. @@ -1770,7 +1784,8 @@ The keyword arguments <parameter>toolpath</parameter>, <parameter>tools</parameter> and <parameter>variables</parameter> -are also specially recognized. +are specially recognized and do not lead to +&consvar; creation. See the manpage section "Construction Environments" for more details. </para> </summary> diff --git a/SCons/EnvironmentTests.py b/SCons/EnvironmentTests.py index 9d1229c..8d90d4d 100644 --- a/SCons/EnvironmentTests.py +++ b/SCons/EnvironmentTests.py @@ -38,7 +38,6 @@ from SCons.Environment import ( NoSubstitutionProxy, OverrideEnvironment, SubstitutionEnvironment, - is_valid_construction_var, ) from SCons.Util import CLVar from SCons.SConsign import current_sconsign_filename @@ -2306,7 +2305,7 @@ f5: \ exc_caught = None try: - env.ParseDepends(test.workpath('does_not_exist'), must_exist=1) + env.ParseDepends(test.workpath('does_not_exist'), must_exist=True) except IOError: exc_caught = 1 assert exc_caught, "did not catch expected IOError" @@ -2314,7 +2313,7 @@ f5: \ del tlist[:] del dlist[:] - env.ParseDepends('$SINGLE', only_one=1) + env.ParseDepends('$SINGLE', only_one=True) t = list(map(str, tlist)) d = list(map(str, dlist)) assert t == ['f0'], t @@ -2331,7 +2330,7 @@ f5: \ exc_caught = None try: - env.ParseDepends(test.workpath('multiple'), only_one=1) + env.ParseDepends(test.workpath('multiple'), only_one=True) except SCons.Errors.UserError: exc_caught = 1 assert exc_caught, "did not catch expected UserError" @@ -4142,40 +4141,6 @@ class NoSubstitutionProxyTestCase(unittest.TestCase,TestEnvironmentFixture): x = proxy.subst_target_source(*args, **kw) assert x == ' ttt sss ', x -class EnvironmentVariableTestCase(unittest.TestCase): - - def test_is_valid_construction_var(self) -> None: - """Testing is_valid_construction_var()""" - r = is_valid_construction_var("_a") - assert r is not None, r - r = is_valid_construction_var("z_") - assert r is not None, r - r = is_valid_construction_var("X_") - assert r is not None, r - r = is_valid_construction_var("2a") - assert r is None, r - r = is_valid_construction_var("a2_") - assert r is not None, r - r = is_valid_construction_var("/") - assert r is None, r - r = is_valid_construction_var("_/") - assert r is None, r - r = is_valid_construction_var("a/") - assert r is None, r - r = is_valid_construction_var(".b") - assert r is None, r - r = is_valid_construction_var("_.b") - assert r is None, r - r = is_valid_construction_var("b1._") - assert r is None, r - r = is_valid_construction_var("-b") - assert r is None, r - r = is_valid_construction_var("_-b") - assert r is None, r - r = is_valid_construction_var("b1-_") - assert r is None, r - - if __name__ == "__main__": unittest.main() diff --git a/SCons/Platform/Platform.xml b/SCons/Platform/Platform.xml index 5d31f6b..0beafd1 100644 --- a/SCons/Platform/Platform.xml +++ b/SCons/Platform/Platform.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Platform/posix.xml b/SCons/Platform/posix.xml index e90e159..dcf05e0 100644 --- a/SCons/Platform/posix.xml +++ b/SCons/Platform/posix.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Platform/sunos.xml b/SCons/Platform/sunos.xml index ffeae96..20172cb 100644 --- a/SCons/Platform/sunos.xml +++ b/SCons/Platform/sunos.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Platform/win32.xml b/SCons/Platform/win32.xml index 3000e33..41c64ee 100644 --- a/SCons/Platform/win32.xml +++ b/SCons/Platform/win32.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Scanner/Scanner.xml b/SCons/Scanner/Scanner.xml index c9b7f32..e3dffe5 100644 --- a/SCons/Scanner/Scanner.xml +++ b/SCons/Scanner/Scanner.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Script/Main.py b/SCons/Script/Main.py index d00da42..a5f8f42 100644 --- a/SCons/Script/Main.py +++ b/SCons/Script/Main.py @@ -41,7 +41,7 @@ import time import traceback import platform import threading -from typing import Optional, List +from typing import Optional, List, TYPE_CHECKING import SCons.CacheDir import SCons.Debug @@ -59,6 +59,8 @@ import SCons.Taskmaster import SCons.Util import SCons.Warnings import SCons.Script.Interactive +if TYPE_CHECKING: + from SCons.Script import SConsOption from SCons.Util.stats import count_stats, memory_stats, time_stats, ENABLE_JSON, write_scons_stats_file, JSON_OUTPUT_FILE from SCons import __version__ as SConsVersion @@ -174,6 +176,7 @@ class Progressor: ProgressObject = SCons.Util.Null() def Progress(*args, **kw) -> None: + """Show progress during building - Public API.""" global ProgressObject ProgressObject = Progressor(*args, **kw) @@ -501,29 +504,47 @@ class FakeOptionParser: # TODO: to quiet checkers, FakeOptionParser should also define # raise_exception_on_error, preserve_unknown_options, largs and parse_args - def add_local_option(self, *args, **kw) -> None: + def add_local_option(self, *args, **kw) -> "SConsOption": pass OptionsParser = FakeOptionParser() -def AddOption(*args, **kw): +def AddOption(*args, settable: bool = False, **kw) -> "SConsOption": + """Add a local option to the option parser - Public API. + + If the *settable* parameter is true, the option will be included in the + list of settable options; all other keyword arguments are passed on to + :meth:`~SCons.Script.SConsOptions.SConsOptionParser.add_local_option`. + + .. versionchanged:: 4.8.0 + The *settable* parameter added to allow including the new option + to the table of options eligible to use :func:`SetOption`. + + """ if 'default' not in kw: kw['default'] = None + kw['settable'] = settable result = OptionsParser.add_local_option(*args, **kw) return result -def GetOption(name): +def GetOption(name: str): + """Get the value from an option - Public API.""" return getattr(OptionsParser.values, name) -def SetOption(name, value): +def SetOption(name: str, value): + """Set the value of an option - Public API.""" return OptionsParser.values.set_option(name, value) -def DebugOptions(json=None): - """ - API to allow specifying options to SCons debug logic - Currently only json is supported which changes the - json file written by --debug=json from the default +def DebugOptions(json: Optional[str] = None) -> None: + """Specify options to SCons debug logic - Public API. + + Currently only *json* is supported, which changes the JSON file + written to if the ``--debug=json`` command-line option is specified + to the value supplied. + + .. versionadded:: 4.6.0 + """ if json is not None: json_node = SCons.Defaults.DefaultEnvironment().arg2nodes(json) @@ -540,7 +561,7 @@ def DebugOptions(json=None): raise SCons.Errors.UserError(f"Unable to create directory for JSON debug output file: {SCons.Util.stats.JSON_OUTPUT_FILE}") -def ValidateOptions(throw_exception: bool=False) -> None: +def ValidateOptions(throw_exception: bool = False) -> None: """Validate options passed to SCons on the command line. Checks that all options given on the command line are known to this diff --git a/SCons/Script/Main.xml b/SCons/Script/Main.xml index 36e7d30..7b5d0ef 100644 --- a/SCons/Script/Main.xml +++ b/SCons/Script/Main.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -93,21 +94,25 @@ the option value may be accessed using &f-link-GetOption; or &f-link-env-GetOption;. -&f-link-SetOption; is not currently supported for -options added with &f-AddOption;. -<!-- was: -The value may also be set using -&f-SetOption; +If the <parameter>settable=True</parameter> argument +was supplied in the &AddOption; call, +the value may also be set later using +&f-link-SetOption; or -&f-env.SetOption;, -if conditions in a -&SConscript; +&f-link-env-SetOption;, +if conditions in an +&SConscript; file require overriding any default value. Note however that a value specified on the command line will <emphasis>always</emphasis> -override a value set by any SConscript file. ---> +override a value set in an SConscript file. +</para> + +<para> +<emphasis>Changed in 4.8.0</emphasis>: added the +<parameter>settable</parameter> keyword argument +to enable an added option to be settable via &SetOption;. </para> <para> @@ -196,6 +201,7 @@ Allows setting options for SCons debug options. Currently the only supported val <example_commands> DebugOptions(json='#/build/output/scons_stats.json') </example_commands> +<para><emphasis>New in version 4.6.0.</emphasis></para> </summary> </scons_function> @@ -334,9 +340,10 @@ atexit.register(print_build_failures) <summary> <para> Query the value of settable options which may have been set -on the command line, or by using the &f-link-SetOption; function. +on the command line, via option defaults, +or by using the &f-link-SetOption; function. The value of the option is returned in a type matching how the -option was declared - see the documentation for the +option was declared - see the documentation of the corresponding command line option for information about each specific option. </para> @@ -802,6 +809,16 @@ be read in order to find the &f-SetOption; call in the first place. </para> <para> +For project-specific options (sometimes called +<firstterm>local options</firstterm>) +added via an &f-link-AddOption; call, +&f-SetOption; is available only after the +&f-AddOption; call has completed successfully, +and only if that call included the +<parameter>settable=True</parameter> argument. +</para> + +<para> The settable variables with their associated command-line options are: </para> diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index e8e5cbf..d4cc992 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -66,17 +66,14 @@ def diskcheck_convert(value): class SConsValues(optparse.Values): - """ - Holder class for uniform access to SCons options, regardless - of whether they can be set on the command line or in the - SConscript files (using the SetOption() function). + """Holder class for uniform access to SCons options. A SCons option value can originate three different ways: - 1) set on the command line; - 2) set in an SConscript file; - 3) the default setting (from the the op.add_option() - calls in the Parser() function, below). + 1. set on the command line. + 2. set in an SConscript file via :func:`~SCons.Script.Main.SetOption`. + 3. the default setting (from the the ``op.add_option()`` + calls in the :func:`Parser` function, below). The command line always overrides a value set in a SConscript file, which in turn always overrides default settings. Because we want @@ -87,15 +84,15 @@ class SConsValues(optparse.Values): The solution implemented in this class is to keep these different sets of settings separate (command line, SConscript file, and default) - and to override the __getattr__() method to check them in turn. - This should allow the rest of the code to just fetch values as - attributes of an instance of this class, without having to worry - about where they came from. + and to override the :meth:`__getattr__` method to check them in turn. + This allows the rest of the code to just fetch values as attributes of + an instance of this class, without having to worry about where they + came from (the scheme is similar to a ``ChainMap``). Note that not all command line options are settable from SConscript files, and the ones that are must be explicitly added to the - "settable" list in this class, and optionally validated and coerced - in the set_option() method. + :attr:`settable` list in this class, and optionally validated and coerced + in the :meth:`set_option` method. """ def __init__(self, defaults) -> None: @@ -103,28 +100,24 @@ class SConsValues(optparse.Values): self.__SConscript_settings__ = {} def __getattr__(self, attr): - """ - Fetches an options value, checking first for explicit settings - from the command line (which are direct attributes), then the - SConscript file settings, then the default values. + """Fetch an options value, respecting priority rules. + + This is a little tricky: since we're answering questions + about outselves, we have avoid lookups that would send us into + into infinite recursion, thus the ``__dict__`` stuff. """ try: - return self.__dict__[attr] + return self.__dict__[attr] except KeyError: try: return self.__dict__['__SConscript_settings__'][attr] except KeyError: try: return getattr(self.__dict__['__defaults__'], attr) - except KeyError: - # Added because with py3 this is a new class, - # not a classic class, and due to the way - # In that case it will create an object without - # __defaults__, and then query for __setstate__ - # which will throw an exception of KeyError - # deepcopy() is expecting AttributeError if __setstate__ - # is not available. - raise AttributeError(attr) + except KeyError as exc: + # Need to respond with AttributeError because + # deepcopy expects that if __setstate__ is not available. + raise AttributeError(attr) from exc # keep this list in sync with the SetOption doc in SCons/Script/Main.xml # search for UPDATE_SETOPTION_DOCS there. @@ -148,26 +141,26 @@ class SConsValues(optparse.Values): 'silent', 'stack_size', 'warn', - - # TODO: Remove these once we update the AddOption() API to allow setting - # added flag as settable. - # Requested settable flag in : https://github.com/SCons/scons/issues/3983 - # From experimental ninja - 'disable_execute_ninja', - 'disable_ninja', - 'skip_ninja_regen' ] - def set_option(self, name, value): - """Sets an option from an SConscript file. + def set_option(self, name: str, value) -> None: + """Sets an option *name* from an SConscript file. + + Vvalidation steps for known (that is, defined in SCons itself) + options are in-line here. Validation should be along the same + lines as for options processed from the command line - + it's kind of a pain to have to duplicate. Project-defined options + can specify callbacks for the command-line version, but will have + no inbuilt validation here. It's up to the build system maintainer + to make sure :func:`~SCons.Script.Main.SetOption` is being used + correctly, we can't really do any better here. Raises: - UserError: invalid or malformed option ("error in your script") + UserError: the option is not settable. """ - if name not in self.settable: raise SCons.Errors.UserError( - "This option is not settable from a SConscript file: %s" % name + f"This option is not settable from an SConscript file: {name!r}" ) # the following are for options that need some extra processing @@ -247,7 +240,6 @@ class SConsOption(optparse.Option): return tuple([self.check_value(opt, v) for v in value]) def process(self, opt, value, values, parser): - # First, convert the value(s) to the right type. Howl if any # value(s) are bogus. value = self.convert_value(opt, value) @@ -313,9 +305,7 @@ class SConsOptionParser(optparse.OptionParser): raise_exception_on_error = False def error(self, msg): - """ - overridden OptionValueError exception handler - """ + """Overridden OptionValueError exception handler.""" if self.raise_exception_on_error: raise SConsBadOptionError(msg, self) else: @@ -397,46 +387,46 @@ class SConsOptionParser(optparse.OptionParser): option.process(opt, value, values, self) def reparse_local_options(self) -> None: - """ Re-parse the leftover command-line options. + """Re-parse the leftover command-line options. - Parse options stored in `self.largs`, so that any value + Leftover options are stored in ``self.largs``, so that any value overridden on the command line is immediately available - if the user turns around and does a :func:`GetOption` right away. + if the user turns around and does a :func:`~SCons.Script.Main.GetOption` + right away. We mimic the processing of the single args in the original OptionParser :func:`_process_args`, but here we allow exact matches for long-opts only (no partial argument names!). - Otherwise there could be problems in :func:`add_local_option` + Otherwise there could be problems in :meth:`add_local_option` below. When called from there, we try to reparse the command-line arguments that 1. haven't been processed so far (`self.largs`), but 2. are possibly not added to the list of options yet. - So, when we only have a value for "--myargument" so far, - a command-line argument of "--myarg=test" would set it, + So, when we only have a value for ``--myargument`` so far, + a command-line argument of ``--myarg=test`` would set it, per the behaviour of :func:`_match_long_opt`, which allows for partial matches of the option name, as long as the common prefix appears to be unique. This would lead to further confusion, because we might want - to add another option "--myarg" later on (see issue #2929). - + to add another option ``--myarg`` later on (see issue #2929). """ rargs = [] largs_restore = [] # Loop over all remaining arguments skip = False - for l in self.largs: + for larg in self.largs: if skip: # Accept all remaining arguments as they are - largs_restore.append(l) + largs_restore.append(larg) else: - if len(l) > 2 and l[0:2] == "--": + if len(larg) > 2 and larg[0:2] == "--": # Check long option - lopt = (l,) - if "=" in l: + lopt = [larg] + if "=" in larg: # Split into option and value - lopt = l.split("=", 1) + lopt = larg.split("=", 1) if lopt[0] in self._long_opt: # Argument is already known @@ -445,26 +435,35 @@ class SConsOptionParser(optparse.OptionParser): # Not known yet, so reject for now largs_restore.append('='.join(lopt)) else: - if l == "--" or l == "-": + if larg in("--", "-"): # Stop normal processing and don't # process the rest of the command-line opts - largs_restore.append(l) + largs_restore.append(larg) skip = True else: - rargs.append(l) + rargs.append(larg) # Parse the filtered list self.parse_args(rargs, self.values) - # Restore the list of remaining arguments for the + # Restore the list of leftover arguments for the # next call of AddOption/add_local_option... self.largs = self.largs + largs_restore - def add_local_option(self, *args, **kw): + def add_local_option(self, *args, **kw) -> SConsOption: """ Adds a local option to the parser. - This is initiated by an :func:`AddOption` call to add a user-defined - command-line option. We add the option to a separate option - group for the local options, creating the group if necessary. + This is initiated by an :func:`~SCons.Script.Main.AddOption` call to + add a user-defined command-line option. Add the option to a separate + option group for the local options, creating the group if necessary. + + The keyword argument *settable* is recognized specially (and + removed from *kw*). If true, the option is marked as modifiable; + by default "local" (project-added) options are not eligible for + for :func:`~SCons.Script.Main.SetOption` calls. + + .. versionchanged:: 4.8.0 + Added special handling of *settable*. + """ try: group = self.local_option_group @@ -473,6 +472,7 @@ class SConsOptionParser(optparse.OptionParser): group = self.add_option_group(group) self.local_option_group = group + settable = kw.pop('settable') result = group.add_option(*args, **kw) if result: # The option was added successfully. We now have to add the @@ -485,6 +485,8 @@ class SConsOptionParser(optparse.OptionParser): # right away. setattr(self.values.__defaults__, result.dest, result.default) self.reparse_local_options() + if settable: + SConsValues.settable.append(result.dest) return result @@ -614,7 +616,8 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter): """Local-only version of store_option_strings. We need to replicate this so the formatter will be set up - properly if we didn't go through the "normal" store_option_strings + properly if we didn't go through the "normal" + :math:`~optparse.HelpFormatter.store_option_strings`. .. versionadded:: 4.6.0 """ @@ -633,15 +636,18 @@ def Parser(version): """Returns a parser object initialized with the standard SCons options. Add options in the order we want them to show up in the ``-H`` help - text, basically alphabetical. Each ``op.add_option()`` call - should have a consistent format:: - - op.add_option("-L", "--long-option-name", - nargs=1, type="string", - dest="long_option_name", default='foo', - action="callback", callback=opt_long_option, - help="help text goes here", - metavar="VAR") + text, basically alphabetical. For readability, Each + :meth:`~optparse.OptionContainer.add_option` call should have a + consistent format:: + + op.add_option( + "-L", "--long-option-name", + nargs=1, type="string", + dest="long_option_name", default='foo', + action="callback", callback=opt_long_option, + help="help text goes here", + metavar="VAR" + ) Even though the :mod:`optparse` module constructs reasonable default destination names from the long option names, we're going to be diff --git a/SCons/Script/SConscript.xml b/SCons/Script/SConscript.xml index a201c96..95bb538 100644 --- a/SCons/Script/SConscript.xml +++ b/SCons/Script/SConscript.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Subst.xml b/SCons/Subst.xml index 0d50bf2..00ed135 100644 --- a/SCons/Subst.xml +++ b/SCons/Subst.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/386asm.xml b/SCons/Tool/386asm.xml index 1661a87..21caf49 100644 --- a/SCons/Tool/386asm.xml +++ b/SCons/Tool/386asm.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/DCommon.xml b/SCons/Tool/DCommon.xml index 80b0b15..c46ed43 100644 --- a/SCons/Tool/DCommon.xml +++ b/SCons/Tool/DCommon.xml @@ -1,8 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION -Copyright The SCons Foundation +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/Tool.xml b/SCons/Tool/Tool.xml index fd8deb8..5e996c7 100644 --- a/SCons/Tool/Tool.xml +++ b/SCons/Tool/Tool.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/aixc++.xml b/SCons/Tool/aixc++.xml index 91849ed..4e78fb3 100644 --- a/SCons/Tool/aixc++.xml +++ b/SCons/Tool/aixc++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/aixcc.xml b/SCons/Tool/aixcc.xml index a4d2855..fba316e 100644 --- a/SCons/Tool/aixcc.xml +++ b/SCons/Tool/aixcc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/aixf77.xml b/SCons/Tool/aixf77.xml index 89c2caa..4a92eee 100644 --- a/SCons/Tool/aixf77.xml +++ b/SCons/Tool/aixf77.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/aixlink.xml b/SCons/Tool/aixlink.xml index 9032663..d20b393 100644 --- a/SCons/Tool/aixlink.xml +++ b/SCons/Tool/aixlink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/applelink.xml b/SCons/Tool/applelink.xml index c387500..3630c8f 100644 --- a/SCons/Tool/applelink.xml +++ b/SCons/Tool/applelink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ar.xml b/SCons/Tool/ar.xml index 7ad54be..de63e5b 100644 --- a/SCons/Tool/ar.xml +++ b/SCons/Tool/ar.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/as.xml b/SCons/Tool/as.xml index d38c608..2aca3d5 100644 --- a/SCons/Tool/as.xml +++ b/SCons/Tool/as.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/bcc32.xml b/SCons/Tool/bcc32.xml index e2f1b46..fb7f269 100644 --- a/SCons/Tool/bcc32.xml +++ b/SCons/Tool/bcc32.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/c++.xml b/SCons/Tool/c++.xml index 6220e43..af1e9e1 100644 --- a/SCons/Tool/c++.xml +++ b/SCons/Tool/c++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/cc.xml b/SCons/Tool/cc.xml index 7c8f944..065f608 100644 --- a/SCons/Tool/cc.xml +++ b/SCons/Tool/cc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/clang.xml b/SCons/Tool/clang.xml index 8fdd3c1..aaff490 100644 --- a/SCons/Tool/clang.xml +++ b/SCons/Tool/clang.xml @@ -1,31 +1,10 @@ <?xml version="1.0"?> <!-- - 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. - +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/clangxx.xml b/SCons/Tool/clangxx.xml index 14582ad..b0669a9 100644 --- a/SCons/Tool/clangxx.xml +++ b/SCons/Tool/clangxx.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/compilation_db.xml b/SCons/Tool/compilation_db.xml index bad808f..dfc89a5 100644 --- a/SCons/Tool/compilation_db.xml +++ b/SCons/Tool/compilation_db.xml @@ -1,9 +1,11 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright 2020 MongoDB Inc. +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/cvf.xml b/SCons/Tool/cvf.xml index 201d4af..89062a4 100644 --- a/SCons/Tool/cvf.xml +++ b/SCons/Tool/cvf.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/cyglink.xml b/SCons/Tool/cyglink.xml index a1b4ec3..d9f6ef4 100644 --- a/SCons/Tool/cyglink.xml +++ b/SCons/Tool/cyglink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/default.xml b/SCons/Tool/default.xml index ad1b303..b6d096b 100644 --- a/SCons/Tool/default.xml +++ b/SCons/Tool/default.xml @@ -1,8 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION -Copyright The SCons Foundation +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/dmd.xml b/SCons/Tool/dmd.xml index be9f23d..6dce1a1 100644 --- a/SCons/Tool/dmd.xml +++ b/SCons/Tool/dmd.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/docbook/docbook.xml b/SCons/Tool/docbook/docbook.xml index c367520..79d2aea 100644 --- a/SCons/Tool/docbook/docbook.xml +++ b/SCons/Tool/docbook/docbook.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- SPDX-License-Identifier: MIT +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-FileType: DOCUMENTATION -Copyright The SCons Foundation - -This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. +This file is processed by the bin/SConsDoc.py module --> <!DOCTYPE sconsdoc [ @@ -27,7 +26,7 @@ See its __doc__ string for a discussion of the format. <tool name="docbook"> <summary> -<para>This tool tries to make working with Docbook in SCons a little easier. +<para>This tool tries to make working with Docbook in &SCons; a little easier. It provides several toolchains for creating different output formats, like HTML or PDF. Contained in the package is a distribution of the Docbook XSL stylesheets as of version 1.76.1. diff --git a/SCons/Tool/dvi.xml b/SCons/Tool/dvi.xml index ee67e14..a631c2a 100644 --- a/SCons/Tool/dvi.xml +++ b/SCons/Tool/dvi.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/dvipdf.xml b/SCons/Tool/dvipdf.xml index 51d4030..53b7481 100644 --- a/SCons/Tool/dvipdf.xml +++ b/SCons/Tool/dvipdf.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/dvips.xml b/SCons/Tool/dvips.xml index f8c19c6..4df22ef 100644 --- a/SCons/Tool/dvips.xml +++ b/SCons/Tool/dvips.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/f03.xml b/SCons/Tool/f03.xml index c989385..e5df9eb 100644 --- a/SCons/Tool/f03.xml +++ b/SCons/Tool/f03.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/f08.xml b/SCons/Tool/f08.xml index 8f69b93..e50f857 100644 --- a/SCons/Tool/f08.xml +++ b/SCons/Tool/f08.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/f77.xml b/SCons/Tool/f77.xml index f60d617..a98c110 100644 --- a/SCons/Tool/f77.xml +++ b/SCons/Tool/f77.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/f90.xml b/SCons/Tool/f90.xml index ab76def..0a2f6a0 100644 --- a/SCons/Tool/f90.xml +++ b/SCons/Tool/f90.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/f95.xml b/SCons/Tool/f95.xml index 59cfd78..3e96484 100644 --- a/SCons/Tool/f95.xml +++ b/SCons/Tool/f95.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/fortran.xml b/SCons/Tool/fortran.xml index 4a092ec..944eb3e 100644 --- a/SCons/Tool/fortran.xml +++ b/SCons/Tool/fortran.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/g++.xml b/SCons/Tool/g++.xml index 3bc3ec2..c2625da 100644 --- a/SCons/Tool/g++.xml +++ b/SCons/Tool/g++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/g77.xml b/SCons/Tool/g77.xml index febfeb3..fd20800 100644 --- a/SCons/Tool/g77.xml +++ b/SCons/Tool/g77.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/gas.xml b/SCons/Tool/gas.xml index 9cdcdb2..2fdd477 100644 --- a/SCons/Tool/gas.xml +++ b/SCons/Tool/gas.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/gdc.xml b/SCons/Tool/gdc.xml index fd4cae7..fc33f7b 100644 --- a/SCons/Tool/gdc.xml +++ b/SCons/Tool/gdc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/gettext.xml b/SCons/Tool/gettext.xml index b184e44..1606129 100644 --- a/SCons/Tool/gettext.xml +++ b/SCons/Tool/gettext.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -34,7 +35,7 @@ following tools: <para> <itemizedlist mark='opencircle'> <listitem><para> - &t-link-xgettext; - to extract internationalized messages from source code to + &t-link-xgettext; - to extract internationalized messages from source code to <literal>POT</literal> file(s), </para></listitem> <listitem><para> @@ -59,7 +60,7 @@ so you're encouraged to see their individual documentation. <para> Each of the above tools provides its own builder(s) which may be used to perform particular activities related to software internationalization. You -may be however interested in <emphasis>top-level</emphasis> +may be however interested in <emphasis>top-level</emphasis> &b-link-Translate; builder. </para> @@ -100,7 +101,7 @@ a SCons script when invoking &b-Translate; # SConscript in 'po/' directory env = Environment( tools = ["default", "gettext"] ) env['POAUTOINIT'] = 1 -env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) +env.Translate(['en','pl'], ['../a.cpp','../b.cpp']) </example_commands> <para> @@ -111,7 +112,7 @@ If you wish, you may also stick to conventional style known from </para> <example_commands> # LINGUAS -en pl +en pl #end </example_commands> @@ -127,7 +128,7 @@ b.cpp env = Environment( tools = ["default", "gettext"] ) env['POAUTOINIT'] = 1 env['XGETTEXTPATH'] = ['../'] -env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') +env.Translate(LINGUAS_FILE = 1, XGETTEXTFROM = 'POTFILES.in') </example_commands> <para> @@ -154,7 +155,7 @@ Let's prepare a development tree as below <example_commands> project/ + SConstruct - + build/ + + build/ + src/ + po/ + SConscript diff --git a/SCons/Tool/gfortran.xml b/SCons/Tool/gfortran.xml index 95458fc..fc18327 100644 --- a/SCons/Tool/gfortran.xml +++ b/SCons/Tool/gfortran.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -Copyright The SCons Foundation +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/gnulink.xml b/SCons/Tool/gnulink.xml index c176c25..f0f0274 100644 --- a/SCons/Tool/gnulink.xml +++ b/SCons/Tool/gnulink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/gs.xml b/SCons/Tool/gs.xml index c466c01..b984fd3 100644 --- a/SCons/Tool/gs.xml +++ b/SCons/Tool/gs.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/hpc++.xml b/SCons/Tool/hpc++.xml index 76c0979..96d0d15 100644 --- a/SCons/Tool/hpc++.xml +++ b/SCons/Tool/hpc++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/hpcc.xml b/SCons/Tool/hpcc.xml index a413099..04d8556 100644 --- a/SCons/Tool/hpcc.xml +++ b/SCons/Tool/hpcc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/hplink.xml b/SCons/Tool/hplink.xml index 7cc02c6..4379261 100644 --- a/SCons/Tool/hplink.xml +++ b/SCons/Tool/hplink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/icc.xml b/SCons/Tool/icc.xml index 8945091..95673ac 100644 --- a/SCons/Tool/icc.xml +++ b/SCons/Tool/icc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/icl.xml b/SCons/Tool/icl.xml index 77edb8d..3c2ffc0 100644 --- a/SCons/Tool/icl.xml +++ b/SCons/Tool/icl.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ifl.xml b/SCons/Tool/ifl.xml index 693edcb..d84bdf1 100644 --- a/SCons/Tool/ifl.xml +++ b/SCons/Tool/ifl.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ifort.xml b/SCons/Tool/ifort.xml index 3f2768a..1999d9a 100644 --- a/SCons/Tool/ifort.xml +++ b/SCons/Tool/ifort.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ilink.xml b/SCons/Tool/ilink.xml index 0ffdfd3..93fb6b9 100644 --- a/SCons/Tool/ilink.xml +++ b/SCons/Tool/ilink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ilink32.xml b/SCons/Tool/ilink32.xml index c8ecd26..3178520 100644 --- a/SCons/Tool/ilink32.xml +++ b/SCons/Tool/ilink32.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/install.xml b/SCons/Tool/install.xml index f4295a0..3069cad 100644 --- a/SCons/Tool/install.xml +++ b/SCons/Tool/install.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/intelc.xml b/SCons/Tool/intelc.xml index 87958a5..ea9e1c0 100644 --- a/SCons/Tool/intelc.xml +++ b/SCons/Tool/intelc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/jar.xml b/SCons/Tool/jar.xml index 403aacb..011ce4e 100644 --- a/SCons/Tool/jar.xml +++ b/SCons/Tool/jar.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT - -Copyright The SCons Foundation +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/javac.xml b/SCons/Tool/javac.xml index 6f48356..d3be4f8 100644 --- a/SCons/Tool/javac.xml +++ b/SCons/Tool/javac.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT - -Copyright The SCons Foundation +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -267,7 +266,7 @@ env = Environment(JAVACCOMSTR="Compiling class files $TARGETS from $SOURCES") If &cv-JAVACLASSPATH; is a single string containing search path separator characters (<literal>:</literal> for POSIX systems or - <literal>;</literal> for Windows), + <literal>;</literal> for Windows), it will be split on the separator into a list of individual paths for dependency scanning purposes. It will not be modified for JDK command-line usage, @@ -278,7 +277,7 @@ env = Environment(JAVACCOMSTR="Compiling class files $TARGETS from $SOURCES") <note> <para> &SCons; <emphasis role="bold">always</emphasis> - supplies a <option>-sourcepath</option> + supplies a <option>-sourcepath</option> when invoking the Java compiler &javac;, regardless of the setting of &cv-link-JAVASOURCEPATH;, as it passes the path(s) to the source(s) supplied diff --git a/SCons/Tool/javah.xml b/SCons/Tool/javah.xml index 16e969a..7021753 100644 --- a/SCons/Tool/javah.xml +++ b/SCons/Tool/javah.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT - -Copyright The SCons Foundation +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/latex.xml b/SCons/Tool/latex.xml index 97451ec..0490cb4 100644 --- a/SCons/Tool/latex.xml +++ b/SCons/Tool/latex.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ldc.xml b/SCons/Tool/ldc.xml index d584466..77dd754 100644 --- a/SCons/Tool/ldc.xml +++ b/SCons/Tool/ldc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/lex.xml b/SCons/Tool/lex.xml index 391e429..e1e1190 100644 --- a/SCons/Tool/lex.xml +++ b/SCons/Tool/lex.xml @@ -1,31 +1,10 @@ <?xml version="1.0"?> <!-- - 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. - +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/link.xml b/SCons/Tool/link.xml index 210d946..4bf7969 100644 --- a/SCons/Tool/link.xml +++ b/SCons/Tool/link.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -152,7 +153,7 @@ to <literal>'.dll'</literal>. <cvar name="IMPLIBNOVERSIONSYMLINKS"> <summary> <para> -Used to override &cv-link-SHLIBNOVERSIONSYMLINKS;/&cv-link-LDMODULENOVERSIONSYMLINKS; when +Used to override &cv-link-SHLIBNOVERSIONSYMLINKS;/&cv-link-LDMODULENOVERSIONSYMLINKS; when creating versioned import library for a shared library/loadable module. If not defined, then &cv-link-SHLIBNOVERSIONSYMLINKS;/&cv-link-LDMODULENOVERSIONSYMLINKS; is used to determine whether to disable symlink generation or not. @@ -410,7 +411,7 @@ The variable is used, for example, by &t-link-gnulink; linker tool. <cvar name="SOVERSION"> <summary> <para> -This will construct the <varname>SONAME</varname> using on the base library name +This will construct the <varname>SONAME</varname> using on the base library name (<parameter>test</parameter> in the example below) and use specified <varname>SOVERSION</varname> to create <varname>SONAME</varname>. <example_commands> @@ -419,7 +420,7 @@ env.SharedLibrary('test', 'test.c', SHLIBVERSION='0.1.2', SOVERSION='2') The variable is used, for example, by &t-link-gnulink; linker tool. </para> <para> -In the example above <varname>SONAME</varname> would be <filename>libtest.so.2</filename> +In the example above <varname>SONAME</varname> would be <filename>libtest.so.2</filename> which would be a symlink and point to <filename>libtest.so.0.1.2</filename> </para> </summary> diff --git a/SCons/Tool/linkloc.xml b/SCons/Tool/linkloc.xml index 2b5ba6a..86d80d7 100644 --- a/SCons/Tool/linkloc.xml +++ b/SCons/Tool/linkloc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/m4.xml b/SCons/Tool/m4.xml index 806d5fc..8c25a28 100644 --- a/SCons/Tool/m4.xml +++ b/SCons/Tool/m4.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/masm.xml b/SCons/Tool/masm.xml index 25b9aae..bc62b47 100644 --- a/SCons/Tool/masm.xml +++ b/SCons/Tool/masm.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/midl.xml b/SCons/Tool/midl.xml index 0845a81..a812e82 100644 --- a/SCons/Tool/midl.xml +++ b/SCons/Tool/midl.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/mingw.xml b/SCons/Tool/mingw.xml index 55e38b3..57e015d 100644 --- a/SCons/Tool/mingw.xml +++ b/SCons/Tool/mingw.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/msgfmt.xml b/SCons/Tool/msgfmt.xml index 51424bc..e56c12c 100644 --- a/SCons/Tool/msgfmt.xml +++ b/SCons/Tool/msgfmt.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -84,7 +85,7 @@ languages defined in <filename>LINGUAS</filename> file: <para> <emphasis>Example 4</emphasis>. -Compile files for languages defined in <filename>LINGUAS</filename> file +Compile files for languages defined in <filename>LINGUAS</filename> file (another version): </para> <example_commands> @@ -126,7 +127,7 @@ See &t-link-msgfmt; tool and &b-link-MOFiles; builder. <cvar name="MSGFMTCOMSTR"> <summary> <para> -String to display when <command>msgfmt(1)</command> is invoked +String to display when <command>msgfmt(1)</command> is invoked (default: <literal>''</literal>, which means ``print &cv-link-MSGFMTCOM;''). See &t-link-msgfmt; tool and &b-link-MOFiles; builder. </para> diff --git a/SCons/Tool/msginit.xml b/SCons/Tool/msginit.xml index 7017851..667ed54 100644 --- a/SCons/Tool/msginit.xml +++ b/SCons/Tool/msginit.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -82,7 +83,7 @@ Initialize <filename>en.po</filename> and <filename>pl.po</filename> from </para> <example_commands> # ... - env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po] + env.POInit(['en', 'pl']) # messages.pot --> [en.po, pl.po] </example_commands> <para> @@ -92,7 +93,7 @@ Initialize <filename>en.po</filename> and <filename>pl.po</filename> from </para> <example_commands> # ... - env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po] + env.POInit(['en', 'pl'], ['foo']) # foo.pot --> [en.po, pl.po] </example_commands> <para> @@ -103,7 +104,7 @@ variable: </para> <example_commands> # ... - env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] + env.POInit(['en', 'pl'], POTDOMAIN='foo') # foo.pot --> [en.po, pl.po] </example_commands> <para> @@ -193,7 +194,7 @@ See &t-link-msginit; tool and &b-link-POInit; builder. <cvar name="MSGINITCOMSTR"> <summary> <para> -String to display when <command>msginit(1)</command> is invoked +String to display when <command>msginit(1)</command> is invoked (default: <literal>''</literal>, which means ``print &cv-link-MSGINITCOM;''). See &t-link-msginit; tool and &b-link-POInit; builder. </para> diff --git a/SCons/Tool/msgmerge.xml b/SCons/Tool/msgmerge.xml index 266ccc7..1f0437c 100644 --- a/SCons/Tool/msgmerge.xml +++ b/SCons/Tool/msgmerge.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -28,7 +29,7 @@ See its __doc__ string for a discussion of the format. <para> This scons tool is a part of scons &t-link-gettext; toolset. It provides scons interface to <command>msgmerge(1)</command> command, which merges two -Uniform style <filename>.po</filename> files together. +Uniform style <filename>.po</filename> files together. </para> </summary> <sets> @@ -62,9 +63,9 @@ does. <para> Target nodes defined through &b-POUpdate; are not built by default (they're <literal>Ignore</literal>d from <literal>'.'</literal> node). Instead, -they are added automatically to special <literal>Alias</literal> +they are added automatically to special <literal>Alias</literal> (<literal>'po-update'</literal> by default). The alias name may be changed -through the &cv-link-POUPDATE_ALIAS; construction variable. You can easily +through the &cv-link-POUPDATE_ALIAS; construction variable. You can easily update <literal>PO</literal> files in your project by <command>scons po-update</command>. </para> @@ -128,7 +129,7 @@ from <filename>messages.pot</filename> template: </para> <example_commands> # produce 'en.po', 'pl.po' + files defined in 'LINGUAS': - env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1) + env.POUpdate(['en', 'pl' ], LINGUAS_FILE = 1) </example_commands> <para> diff --git a/SCons/Tool/mslib.xml b/SCons/Tool/mslib.xml index a79ec48..fdd9ea7 100644 --- a/SCons/Tool/mslib.xml +++ b/SCons/Tool/mslib.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/mslink.xml b/SCons/Tool/mslink.xml index a9cd6e0..8b4c22f 100644 --- a/SCons/Tool/mslink.xml +++ b/SCons/Tool/mslink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/mssdk.xml b/SCons/Tool/mssdk.xml index ec3c2ba..3ba17f9 100644 --- a/SCons/Tool/mssdk.xml +++ b/SCons/Tool/mssdk.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -68,7 +69,7 @@ Supported versions include <literal>6.0A</literal>, <literal>6.0</literal>, <literal>2003R2</literal> -and +and <literal>2003R1</literal>. </para> </summary> diff --git a/SCons/Tool/msvc.xml b/SCons/Tool/msvc.xml index a0f6573..9f433a2 100644 --- a/SCons/Tool/msvc.xml +++ b/SCons/Tool/msvc.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT -SPDX-FileCopyrightText: Copyright The SCons Foundation SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. diff --git a/SCons/Tool/msvs.xml b/SCons/Tool/msvs.xml index 5adf025..cc4220c 100644 --- a/SCons/Tool/msvs.xml +++ b/SCons/Tool/msvs.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT -SPDX-FileCopyrightText: Copyright The SCons Foundation SPDX-FileType: DOCUMENTATION -This file is processed by the bin/SConsDoc.py module +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/mwcc.xml b/SCons/Tool/mwcc.xml index a0c6eda..c2a6db4 100644 --- a/SCons/Tool/mwcc.xml +++ b/SCons/Tool/mwcc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/mwld.xml b/SCons/Tool/mwld.xml index 60885b7..6fde1fa 100644 --- a/SCons/Tool/mwld.xml +++ b/SCons/Tool/mwld.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/nasm.xml b/SCons/Tool/nasm.xml index 0170b91..4889b67 100644 --- a/SCons/Tool/nasm.xml +++ b/SCons/Tool/nasm.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/ninja/Utils.py b/SCons/Tool/ninja/Utils.py index 126d5de..cdce928 100644 --- a/SCons/Tool/ninja/Utils.py +++ b/SCons/Tool/ninja/Utils.py @@ -45,6 +45,7 @@ def ninja_add_command_line_options() -> None: metavar='BOOL', action="store_true", default=False, + settable=True, help='Disable automatically running ninja after scons') AddOption('--disable-ninja', @@ -52,6 +53,7 @@ def ninja_add_command_line_options() -> None: metavar='BOOL', action="store_true", default=False, + settable=True, help='Disable ninja generation and build with scons even if tool is loaded. '+ 'Also used by ninja to build targets which only scons can build.') @@ -60,6 +62,7 @@ def ninja_add_command_line_options() -> None: metavar='BOOL', action="store_true", default=False, + settable=True, help='Allow scons to skip regeneration of the ninja file and restarting of the daemon. ' + 'Care should be taken in cases where Glob is in use or SCons generated files are used in ' + 'command lines.') diff --git a/SCons/Tool/ninja/ninja.xml b/SCons/Tool/ninja/ninja.xml index 664d521..3919194 100644 --- a/SCons/Tool/ninja/ninja.xml +++ b/SCons/Tool/ninja/ninja.xml @@ -1,31 +1,10 @@ <?xml version="1.0"?> <!-- - MIT License +SPDX-License-Identifier: MIT +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-FileType: DOCUMENTATION - 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. - - -This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. +This file is processed by the bin/SConsDoc.py module --> <!DOCTYPE sconsdoc [ @@ -227,7 +206,7 @@ python -m pip install ninja <para> Determines the type of format ninja should expect when parsing header include depfiles. Can be <option>msvc</option>, <option>gcc</option>, or <option>clang</option>. - The <option>msvc</option> option corresponds to <option>/showIncludes</option> format, and + The <option>msvc</option> option corresponds to <option>/showIncludes</option> format, and <option>gcc</option> or <option>clang</option> correspond to <option>-MMD -MF</option>. </para> </summary> diff --git a/SCons/Tool/packaging/packaging.xml b/SCons/Tool/packaging/packaging.xml index b248880..62ba558 100644 --- a/SCons/Tool/packaging/packaging.xml +++ b/SCons/Tool/packaging/packaging.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-License-Identifier: MIT +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-FileType: DOCUMENTATION -This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. +This file is processed by the bin/SConsDoc.py module --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/pdf.xml b/SCons/Tool/pdf.xml index 8d73cbb..95c5ac3 100644 --- a/SCons/Tool/pdf.xml +++ b/SCons/Tool/pdf.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/pdflatex.xml b/SCons/Tool/pdflatex.xml index 883ddf4..4f5173a 100644 --- a/SCons/Tool/pdflatex.xml +++ b/SCons/Tool/pdflatex.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/pdftex.xml b/SCons/Tool/pdftex.xml index 7e4941c..c25a59e 100644 --- a/SCons/Tool/pdftex.xml +++ b/SCons/Tool/pdftex.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/python.xml b/SCons/Tool/python.xml index b1783ff..7833514 100644 --- a/SCons/Tool/python.xml +++ b/SCons/Tool/python.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/qt.xml b/SCons/Tool/qt.xml index 3ba71b9..5862179 100644 --- a/SCons/Tool/qt.xml +++ b/SCons/Tool/qt.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/qt3.xml b/SCons/Tool/qt3.xml index 445751b..a2762f7 100644 --- a/SCons/Tool/qt3.xml +++ b/SCons/Tool/qt3.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/rmic.xml b/SCons/Tool/rmic.xml index 28be1f6..792c5f5 100644 --- a/SCons/Tool/rmic.xml +++ b/SCons/Tool/rmic.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT - -Copyright The SCons Foundation +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/rpcgen.xml b/SCons/Tool/rpcgen.xml index 0c314d0..6c5137a 100644 --- a/SCons/Tool/rpcgen.xml +++ b/SCons/Tool/rpcgen.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sgiar.xml b/SCons/Tool/sgiar.xml index 131b5b3..1803291 100644 --- a/SCons/Tool/sgiar.xml +++ b/SCons/Tool/sgiar.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sgic++.xml b/SCons/Tool/sgic++.xml index c9ab946..730c094 100644 --- a/SCons/Tool/sgic++.xml +++ b/SCons/Tool/sgic++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sgicc.xml b/SCons/Tool/sgicc.xml index df978b3..70a189f 100644 --- a/SCons/Tool/sgicc.xml +++ b/SCons/Tool/sgicc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sgilink.xml b/SCons/Tool/sgilink.xml index 54d22fe..42a1e6c 100644 --- a/SCons/Tool/sgilink.xml +++ b/SCons/Tool/sgilink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunar.xml b/SCons/Tool/sunar.xml index dfcf4ff..6b0ab8f 100644 --- a/SCons/Tool/sunar.xml +++ b/SCons/Tool/sunar.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunc++.xml b/SCons/Tool/sunc++.xml index 6eb7ea4..c166c98 100644 --- a/SCons/Tool/sunc++.xml +++ b/SCons/Tool/sunc++.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/suncc.xml b/SCons/Tool/suncc.xml index 39d39f2..48461f4 100644 --- a/SCons/Tool/suncc.xml +++ b/SCons/Tool/suncc.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunf77.xml b/SCons/Tool/sunf77.xml index 7bcf33a..41459df 100644 --- a/SCons/Tool/sunf77.xml +++ b/SCons/Tool/sunf77.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunf90.xml b/SCons/Tool/sunf90.xml index 47544e0..2d8ee4b 100644 --- a/SCons/Tool/sunf90.xml +++ b/SCons/Tool/sunf90.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunf95.xml b/SCons/Tool/sunf95.xml index a08d62d..9b3c93b 100644 --- a/SCons/Tool/sunf95.xml +++ b/SCons/Tool/sunf95.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/sunlink.xml b/SCons/Tool/sunlink.xml index dbcc8c7..d8dae06 100644 --- a/SCons/Tool/sunlink.xml +++ b/SCons/Tool/sunlink.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/swig.xml b/SCons/Tool/swig.xml index a6d85ce..2d35504 100644 --- a/SCons/Tool/swig.xml +++ b/SCons/Tool/swig.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/tar.xml b/SCons/Tool/tar.xml index 7f1011f..98bfbd3 100644 --- a/SCons/Tool/tar.xml +++ b/SCons/Tool/tar.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/tex.xml b/SCons/Tool/tex.xml index eb4305a..0c99563 100644 --- a/SCons/Tool/tex.xml +++ b/SCons/Tool/tex.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/textfile.xml b/SCons/Tool/textfile.xml index c41ee2a..895fbef 100644 --- a/SCons/Tool/textfile.xml +++ b/SCons/Tool/textfile.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/tlib.xml b/SCons/Tool/tlib.xml index 8b1ea89..7274890 100644 --- a/SCons/Tool/tlib.xml +++ b/SCons/Tool/tlib.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Tool/xgettext.xml b/SCons/Tool/xgettext.xml index 78afade..f8b8bb8 100644 --- a/SCons/Tool/xgettext.xml +++ b/SCons/Tool/xgettext.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -30,7 +31,7 @@ This scons tool is a part of scons &t-link-gettext; toolset. It provides scons interface to <command>xgettext(1)</command> program, which extracts internationalized messages from source code. The tool provides &b-POTUpdate; builder to make <literal>PO</literal> -<emphasis>Template</emphasis> files. +<emphasis>Template</emphasis> files. </para> </summary> <sets> @@ -67,7 +68,7 @@ special alias (<literal>pot-update</literal> by default, see &cv-link-POTUPDATE_ALIAS;) so you can update/create them easily with <command>scons pot-update</command>. The file is not written until there is no real change in internationalized messages (or in comments that enter -<literal>POT</literal> file). +<literal>POT</literal> file). </para> <para> @@ -90,7 +91,7 @@ Let's create <filename>po/</filename> directory and place following env = Environment( tools = ['default', 'xgettext'] ) env.POTUpdate(['foo'], ['../a.cpp', '../b.cpp']) env.POTUpdate(['bar'], ['../c.cpp', '../d.cpp']) -</example_commands> +</example_commands> <para> Then invoke scons few times: </para> @@ -111,7 +112,7 @@ case default target <filename>messages.pot</filename> will be used. The default target may also be overridden by setting &cv-link-POTDOMAIN; construction variable or providing it as an override to &b-POTUpdate; builder: </para> -<example_commands> +<example_commands> # SConstruct script env = Environment( tools = ['default', 'xgettext'] ) env['POTDOMAIN'] = "foo" @@ -124,21 +125,21 @@ variable or providing it as an override to &b-POTUpdate; builder: The sources may be specified within separate file, for example <filename>POTFILES.in</filename>: </para> -<example_commands> +<example_commands> # POTFILES.in in 'po/' subdirectory ../a.cpp ../b.cpp # end of file -</example_commands> +</example_commands> <para> The name of the file (<filename>POTFILES.in</filename>) containing the list of sources is provided via &cv-link-XGETTEXTFROM;: </para> -<example_commands> +<example_commands> # SConstruct file in 'po/' subdirectory env = Environment( tools = ['default', 'xgettext'] ) env.POTUpdate(XGETTEXTFROM = 'POTFILES.in') -</example_commands> +</example_commands> <para> <emphasis>Example 4.</emphasis> @@ -209,10 +210,10 @@ message <literal>"Hello from ../a.cpp"</literal>. When you reverse order in # SConstruct file in '0/1/po/' subdirectory env = Environment( tools = ['default', 'xgettext'] ) env.POTUpdate(XGETTEXTFROM = 'POTFILES.in', XGETTEXTPATH=['../../', '../']) -</example_commands> +</example_commands> <para> then the <filename>messages.pot</filename> will contain -<literal>msgid "Hello from ../../a.cpp"</literal> line and not +<literal>msgid "Hello from ../../a.cpp"</literal> line and not <literal>msgid "Hello from ../a.cpp"</literal>. </para> diff --git a/SCons/Tool/yacc.xml b/SCons/Tool/yacc.xml index 82725db..89f45ba 100644 --- a/SCons/Tool/yacc.xml +++ b/SCons/Tool/yacc.xml @@ -1,31 +1,10 @@ <?xml version="1.0"?> <!-- - 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. - +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ @@ -236,7 +215,7 @@ The value is used only if &cv-YACC_GRAPH_FILE_SUFFIX; is not set. The default value is <filename>.gv</filename>. </para> <para> -<emphasis>Changed in version 4.X.Y</emphasis>: deprecated. The default value +<emphasis>Changed in version 4.6.0</emphasis>: deprecated. The default value changed from <filename>.vcg</filename> (&bison; stopped generating <filename>.vcg</filename> output with version 2.4, in 2006). </para> @@ -261,7 +240,7 @@ Various yacc tools have emitted various formats at different times. Set this to match what your parser generator produces. </para> -<para><emphasis>New in version 4.X.Y</emphasis>. </para> +<para><emphasis>New in version 4.6.0</emphasis>. </para> </summary> </cvar> diff --git a/SCons/Tool/zip.xml b/SCons/Tool/zip.xml index f9f01d9..85fe19b 100644 --- a/SCons/Tool/zip.xml +++ b/SCons/Tool/zip.xml @@ -1,9 +1,10 @@ <?xml version="1.0"?> <!-- -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its __doc__ string for a discussion of the format. --> <!DOCTYPE sconsdoc [ diff --git a/SCons/Util/UtilTests.py b/SCons/Util/UtilTests.py index ff32bab..b1c0108 100644 --- a/SCons/Util/UtilTests.py +++ b/SCons/Util/UtilTests.py @@ -73,6 +73,7 @@ from SCons.Util import ( to_bytes, to_str, ) +from SCons.Util.envs import is_valid_construction_var from SCons.Util.hashes import ( _attempt_init_of_python_3_9_hash_object, _attempt_get_hash_function, @@ -1206,6 +1207,41 @@ class get_os_env_boolTestCase(unittest.TestCase): assert var is False, 'var should be False, not %s' % repr(var) +class EnvironmentVariableTestCase(unittest.TestCase): + + def test_is_valid_construction_var(self) -> None: + """Testing is_valid_construction_var()""" + r = is_valid_construction_var("_a") + assert r, r + r = is_valid_construction_var("z_") + assert r, r + r = is_valid_construction_var("X_") + assert r, r + r = is_valid_construction_var("2a") + assert not r, r + r = is_valid_construction_var("a2_") + assert r, r + r = is_valid_construction_var("/") + assert not r, r + r = is_valid_construction_var("_/") + assert not r, r + r = is_valid_construction_var("a/") + assert not r, r + r = is_valid_construction_var(".b") + assert not r, r + r = is_valid_construction_var("_.b") + assert not r, r + r = is_valid_construction_var("b1._") + assert not r, r + r = is_valid_construction_var("-b") + assert not r, r + r = is_valid_construction_var("_-b") + assert not r, r + r = is_valid_construction_var("b1-_") + assert not r, r + + + if __name__ == "__main__": unittest.main() diff --git a/SCons/Util/__init__.py b/SCons/Util/__init__.py index 95c1b99..28565da 100644 --- a/SCons/Util/__init__.py +++ b/SCons/Util/__init__.py @@ -107,6 +107,7 @@ from .envs import ( AppendPath, AddPathIfNotExists, AddMethod, + is_valid_construction_var, ) from .filelock import FileLock, SConsLockFailure diff --git a/SCons/Util/envs.py b/SCons/Util/envs.py index db4d65a..68a4048 100644 --- a/SCons/Util/envs.py +++ b/SCons/Util/envs.py @@ -9,6 +9,7 @@ Routines for working with environments and construction variables that don't need the specifics of the Environment class. """ +import re import os from types import MethodType, FunctionType from typing import Union, Callable, Optional, Any @@ -329,6 +330,12 @@ def AddMethod(obj, function: Callable, name: Optional[str] = None) -> None: setattr(obj, name, method) +_is_valid_var_re = re.compile(r'[_a-zA-Z]\w*$') + +def is_valid_construction_var(varstr: str) -> bool: + """Return True if *varstr* is a legitimate construction variable.""" + return bool(_is_valid_var_re.match(varstr)) + # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/SCons/Variables/ListVariable.py b/SCons/Variables/ListVariable.py index 0c9fa13..bbecbaf 100644 --- a/SCons/Variables/ListVariable.py +++ b/SCons/Variables/ListVariable.py @@ -23,10 +23,11 @@ """Variable type for List Variables. -A list variable may given as 'all', 'none' or a list of names -separated by comma. After the variable has been processed, the variable -value holds either the named list elements, all list elements or no -list elements at all. +A list variable allows selecting one or more from a supplied set of +allowable values, as well as from an optional mapping of alternate names +(such as aliases and abbreviations) and the special names ``'all'`` and +``'none'``. Specified values are converted during processing into values +only from the allowable values set. Usage example:: @@ -63,12 +64,18 @@ __all__ = ['ListVariable',] class _ListVariable(collections.UserList): """Internal class holding the data for a List Variable. - The initializer accepts two arguments, the list of actual values - given, and the list of allowable values. Not normally instantiated - by hand, but rather by the ListVariable converter function. + This is normally not directly instantiated, rather the ListVariable + converter callback "converts" string input (or the default value + if none) into an instance and stores it. + + Args: + initlist: the list of actual values given. + allowedElems: the list of allowable values. """ - def __init__(self, initlist=None, allowedElems=None) -> None: + def __init__( + self, initlist: Optional[list] = None, allowedElems: Optional[list] = None + ) -> None: if initlist is None: initlist = [] if allowedElems is None: @@ -106,7 +113,12 @@ class _ListVariable(collections.UserList): return str(self) def _converter(val, allowedElems, mapdict) -> _ListVariable: - """Convert list variables.""" + """Callback to convert list variables into a suitable form. + + The arguments *allowedElems* and *mapdict* are non-standard + for a :class:`Variables` converter: the lambda in the + :func:`ListVariable` function arranges for us to be called correctly. + """ if val == 'none': val = [] elif val == 'all': @@ -114,18 +126,47 @@ def _converter(val, allowedElems, mapdict) -> _ListVariable: else: val = [_f for _f in val.split(',') if _f] val = [mapdict.get(v, v) for v in val] - notAllowed = [v for v in val if v not in allowedElems] - if notAllowed: - raise ValueError( - f"Invalid value(s) for option: {','.join(notAllowed)}" - ) return _ListVariable(val, allowedElems) -# def _validator(key, val, env) -> None: -# """ """ -# # TODO: write validator for list variable -# pass +def _validator(key, val, env) -> None: + """Callback to validate supplied value(s) for a ListVariable. + + Validation means "is *val* in the allowed list"? *val* has + been subject to substitution before the validator is called. The + converter created a :class:`_ListVariable` container which is stored + in *env* after it runs; this includes the allowable elements list. + Substitution makes a string made out of the values (only), + so we need to fish the allowed elements list out of the environment + to complete the validation. + + Note that since 18b45e456, whether or not ``subst`` has been + called is conditional on the value of the *subst* argument to + :meth:`~SCons.Variables.Variables.Add`, so we have to account for + possible different types of *val*. + + Raises: + UserError: if validation failed. + + .. versionadded:: 4.8.0 + ``_validator`` split off from :func:`_converter` with an additional + check for whether *val* has been substituted before the call. + """ + allowedElems = env[key].allowedElems + if isinstance(val, _ListVariable): # not substituted, use .data + notAllowed = [v for v in val.data if v not in allowedElems] + else: # val will be a string + notAllowed = [v for v in val.split() if v not in allowedElems] + if notAllowed: + # Converter only synthesized 'all' and 'none', they are never + # in the allowed list, so we need to add those to the error message + # (as is done for the help msg). + valid = ','.join(allowedElems + ['all', 'none']) + msg = ( + f"Invalid value(s) for variable {key!r}: {','.join(notAllowed)!r}. " + f"Valid values are: {valid}" + ) + raise SCons.Errors.UserError(msg) from None # lint: W0622: Redefining built-in 'help' (redefined-builtin) @@ -136,6 +177,7 @@ def ListVariable( default: Union[str, List[str]], names: List[str], map: Optional[dict] = None, + validator: Optional[Callable] = None, ) -> Tuple[str, str, str, None, Callable]: """Return a tuple describing a list variable. @@ -149,25 +191,35 @@ def ListVariable( the allowable values (not including any extra names from *map*). default: the default value(s) for the list variable. Can be given as string (possibly comma-separated), or as a list of strings. - ``all`` or ``none`` are allowed as *default*. + ``all`` or ``none`` are allowed as *default*. You can also simulate + a must-specify ListVariable by giving a *default* that is not part + of *names*, it will fail validation if not supplied. names: the allowable values. Must be a list of strings. map: optional dictionary to map alternative names to the ones in *names*, providing a form of alias. The converter will make the replacement, names from *map* are not stored and will not appear in the help message. + validator: optional callback to validate supplied values. + The default validator is used if not specified. Returns: A tuple including the correct converter and validator. The result is usable as input to :meth:`~SCons.Variables.Variables.Add`. + + .. versionchanged:: 4.8.0 + The validation step was split from the converter to allow for + custom validators. The *validator* keyword argument was added. """ if map is None: map = {} + if validator is None: + validator = _validator names_str = f"allowed names: {' '.join(names)}" if SCons.Util.is_List(default): default = ','.join(default) help = '\n '.join( (help, '(all|none|comma-separated list of names)', names_str)) - return key, help, default, None, lambda val: _converter(val, names, map) + return key, help, default, validator, lambda val: _converter(val, names, map) # Local Variables: # tab-width:4 diff --git a/SCons/Variables/ListVariableTests.py b/SCons/Variables/ListVariableTests.py index 54aad05..62ce879 100644 --- a/SCons/Variables/ListVariableTests.py +++ b/SCons/Variables/ListVariableTests.py @@ -38,7 +38,7 @@ class ListVariableTestCase(unittest.TestCase): assert o.key == 'test', o.key assert o.help == 'test option help\n (all|none|comma-separated list of names)\n allowed names: one two three', repr(o.help) assert o.default == 'all', o.default - assert o.validator is None, o.validator + assert o.validator is not None, o.validator assert o.converter is not None, o.converter opts = SCons.Variables.Variables() @@ -52,9 +52,15 @@ class ListVariableTestCase(unittest.TestCase): def test_converter(self) -> None: """Test the ListVariable converter""" opts = SCons.Variables.Variables() - opts.Add(SCons.Variables.ListVariable('test', 'test option help', 'all', - ['one', 'two', 'three'], - {'ONE':'one', 'TWO':'two'})) + opts.Add( + SCons.Variables.ListVariable( + 'test', + 'test option help', + 'all', + ['one', 'two', 'three'], + {'ONE': 'one', 'TWO': 'two'}, + ) + ) o = opts.options[0] @@ -101,8 +107,12 @@ class ListVariableTestCase(unittest.TestCase): x = o.converter('three,ONE,TWO') assert str(x) == 'all', x - with self.assertRaises(ValueError): - x = o.converter('no_match') + # invalid value should convert (no change) without error + x = o.converter('no_match') + assert str(x) == 'no_match', x + # ... and fail to validate + with self.assertRaises(SCons.Errors.UserError): + z = o.validator('test', 'no_match', {"test": x}) def test_copy(self) -> None: """Test copying a ListVariable like an Environment would""" diff --git a/SCons/Variables/PathVariable.py b/SCons/Variables/PathVariable.py index 6ea4e6b..4a827c5 100644 --- a/SCons/Variables/PathVariable.py +++ b/SCons/Variables/PathVariable.py @@ -141,7 +141,7 @@ class _PathVariableClass: # lint: W0622: Redefining built-in 'help' (redefined-builtin) def __call__( - self, key, help: str, default, validator: Optional[Callable] = None + self, key: str, help: str, default, validator: Optional[Callable] = None ) -> Tuple[str, str, str, Callable, None]: """Return a tuple describing a path list SCons Variable. diff --git a/SCons/Variables/VariablesTests.py b/SCons/Variables/VariablesTests.py index 145bee3..7c6eaab 100644 --- a/SCons/Variables/VariablesTests.py +++ b/SCons/Variables/VariablesTests.py @@ -150,6 +150,48 @@ class VariablesTestCase(unittest.TestCase): opts.Update(env, {}) assert env['ANSWER'] == 54 + # Test that the value is not substituted if 'subst' is False + # and that it is if 'subst' is True. + def check_no_subst(key, value, env) -> None: + """Check that variable was not substituted before we get called.""" + assert value == "$ORIGIN", \ + f"Validator: '$ORIGIN' was substituted to {value!r}" + + def conv_no_subst(value) -> None: + """Check that variable was not substituted before we get called.""" + assert value == "$ORIGIN", \ + f"Converter: '$ORIGIN' was substituted to {value!r}" + return value + + def check_subst(key, value, env) -> None: + """Check that variable was substituted before we get called.""" + assert value == "Value", \ + f"Validator: '$SUB' was not substituted {value!r} instead of 'Value'" + + def conv_subst(value) -> None: + """Check that variable was not substituted before we get called.""" + assert value == "Value", \ + f"Converter: '$SUB' was substituted to {value!r} instead of 'Value'" + return value + + opts.Add('NOSUB', + help='Variable whose value will not be substituted', + default='$ORIGIN', + validator=check_no_subst, + converter=conv_no_subst, + subst=False) + opts.Add('SUB', + help='Variable whose value will be substituted', + default='$VAR', + validator=check_subst, + converter=conv_subst, + subst=True) + env = Environment() + env['VAR'] = "Value" + opts.Update(env) + assert env['NOSUB'] == "$ORIGIN", env['NOSUB'] + assert env['SUB'] == env['VAR'], env['SUB'] + # Test that a bad value from the file is used and # validation fails correctly. test = TestSCons.TestSCons() diff --git a/SCons/Variables/__init__.py b/SCons/Variables/__init__.py index 867493d..1c41130 100644 --- a/SCons/Variables/__init__.py +++ b/SCons/Variables/__init__.py @@ -28,7 +28,6 @@ import sys from functools import cmp_to_key from typing import Callable, Dict, List, Optional, Sequence, Union -import SCons.Environment import SCons.Errors import SCons.Util import SCons.Warnings @@ -49,7 +48,7 @@ __all__ = [ class Variable: """A Build Variable.""" - __slots__ = ('key', 'aliases', 'help', 'default', 'validator', 'converter') + __slots__ = ('key', 'aliases', 'help', 'default', 'validator', 'converter', 'do_subst') def __lt__(self, other): """Comparison fuction so Variable instances sort.""" @@ -70,13 +69,15 @@ class Variables: files: string or list of strings naming variable config scripts (default ``None``) args: dictionary to override values set from *files*. (default ``None``) - is_global: if true, return a global singleton Variables object instead - of a fresh instance. Currently inoperable (default ``False``) + is_global: if true, return a global singleton :class:`Variables` object + instead of a fresh instance. Currently inoperable (default ``False``) .. versionchanged:: 4.8.0 - The default for *is_global* changed to ``False`` (previously - ``True`` but it had no effect due to an implementation error). - *is_global* is deprecated. + The default for *is_global* changed to ``False`` (previously + ``True`` but it had no effect due to an implementation error). + + .. deprecated:: 4.8.0 + *is_global* is deprecated. """ def __init__( @@ -87,9 +88,9 @@ class Variables: ) -> None: self.options: List[Variable] = [] self.args = args if args is not None else {} - if not SCons.Util.is_List(files): + if not SCons.Util.is_Sequence(files): files = [files] if files else [] - self.files = files + self.files: Sequence[str] = files self.unknown: Dict[str, str] = {} def __str__(self) -> str: @@ -113,7 +114,11 @@ class Variables: ) -> None: """Create a Variable and add it to the list. - Internal routine, not public API. + This is the internal implementation for :meth:`Add` and + :meth:`AddVariables`. Not part of the public API. + + .. versionadded:: 4.8.0 + *subst* keyword argument is now recognized. """ option = Variable() @@ -126,12 +131,14 @@ class Variables: option.key = key # TODO: normalize to not include key in aliases. Currently breaks tests. option.aliases = [key,] - if not SCons.Environment.is_valid_construction_var(option.key): + if not SCons.Util.is_valid_construction_var(option.key): raise SCons.Errors.UserError(f"Illegal Variables key {option.key!r}") option.help = help option.default = default option.validator = validator option.converter = converter + option.do_subst = kwargs.pop("subst", True) + # TODO should any remaining kwargs be saved in the Variable? self.options.append(option) @@ -152,27 +159,36 @@ class Variables: """Add a Build Variable. Arguments: - key: the name of the variable, or a 5-tuple (or list). - If *key* is a tuple, and there are no additional positional - arguments, it is unpacked into the variable name plus the four - listed keyword arguments from below. - If *key* is a tuple and there are additional positional arguments, - the first word of the tuple is taken as the variable name, - and the remainder as aliases. - args: optional positional arguments, corresponding to the four - listed keyword arguments. + key: the name of the variable, or a 5-tuple (or other sequence). + If *key* is a tuple, and there are no additional arguments + except the *help*, *default*, *validator* and *converter* + keyword arguments, *key* is unpacked into the variable name + plus the *help*, *default*, *validator* and *converter* + arguments; if there are additional arguments, the first + elements of *key* is taken as the variable name, and the + remainder as aliases. + args: optional positional arguments, corresponding to the + *help*, *default*, *validator* and *converter* keyword args. kwargs: arbitrary keyword arguments used by the variable itself. Keyword Args: - help: help text for the variable (default: ``""``) + help: help text for the variable (default: empty string) default: default value for variable (default: ``None``) validator: function called to validate the value (default: ``None``) converter: function to be called to convert the variable's value before putting it in the environment. (default: ``None``) + subst: perform substitution on the value before the converter + and validator functions (if any) are called (default: ``True``) + + .. versionadded:: 4.8.0 + The *subst* keyword argument is now specially recognized. """ if SCons.Util.is_Sequence(key): - if not (len(args) or len(kwargs)): - return self._do_add(*key) + # If no other positional args (and no fundamental kwargs), + # unpack key, and pass the kwargs on: + known_kw = {'help', 'default', 'validator', 'converter'} + if not args and not known_kw.intersection(kwargs.keys()): + return self._do_add(*key, **kwargs) return self._do_add(key, *args, **kwargs) @@ -247,7 +263,10 @@ class Variables: # apply converters for option in self.options: if option.converter and option.key in values: - value = env.subst(f'${option.key}') + if option.do_subst: + value = env.subst('${%s}' % option.key) + else: + value = env[option.key] try: try: env[option.key] = option.converter(value) @@ -262,7 +281,11 @@ class Variables: # apply validators for option in self.options: if option.validator and option.key in values: - option.validator(option.key, env.subst(f'${option.key}'), env) + if option.do_subst: + value = env.subst('${%s}' % option.key) + else: + value = env[option.key] + option.validator(option.key, value, env) def UnknownVariables(self) -> dict: """Return dict of unknown variables. @@ -340,7 +363,6 @@ class Variables: # removed so now we have to convert to a key. if callable(sort): options = sorted(self.options, key=cmp_to_key(lambda x, y: sort(x.key, y.key))) - elif sort is True: options = sorted(self.options) else: diff --git a/bench/env.__setitem__.py b/bench/env.__setitem__.py index f9fe0c0..2cd0da8 100644 --- a/bench/env.__setitem__.py +++ b/bench/env.__setitem__.py @@ -1,8 +1,7 @@ # __COPYRIGHT__ # # Benchmarks for testing various possible implementations of the -# env.__setitem__() method(s) in the src/engine/SCons/Environment.py -# module. +# env.__setitem__() method(s) in the SCons/Environment.py module. from __future__ import print_function @@ -25,10 +24,10 @@ class Timing: self.name = name self.statement = statement self.__result = None - + def timeit(self): self.__result = self.__timer.timeit(self.__num) - + def getResult(self): return self.__result @@ -62,8 +61,9 @@ sys.path = [os.path.abspath(script_dir + '../src/engine')] + sys.path import SCons.Errors import SCons.Environment +import SCons.Util -is_valid_construction_var = SCons.Environment.is_valid_construction_var +is_valid_construction_var = SCons.Util.is_valid_construction_var global_valid_var = re.compile(r'[_a-zA-Z]\w*$') # The classes with different __setitem__() implementations that we're @@ -80,7 +80,7 @@ global_valid_var = re.compile(r'[_a-zA-Z]\w*$') # # The env_Original subclass contains the original implementation (which # actually had the is_valid_construction_var() function in SCons.Util -# originally). +# originally). Update: it has moved back, to avoid import loop with Variables. # # The other subclasses (except for env_Best) each contain *one* # significant change from the env_Original implementation. The doc string @@ -116,7 +116,7 @@ class env_Original(Environment): if special: special(self, key, value) else: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -176,7 +176,7 @@ class env_special_set_has_key(Environment): if key in self._special_set: self._special_set[key](self, key, value) else: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -186,7 +186,7 @@ class env_key_in_tuple(Environment): if key in ('BUILDERS', 'SCANNERS', 'TARGET', 'TARGETS', 'SOURCE', 'SOURCES'): self._special_set[key](self, key, value) else: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -196,7 +196,7 @@ class env_key_in_list(Environment): if key in ['BUILDERS', 'SCANNERS', 'TARGET', 'TARGETS', 'SOURCE', 'SOURCES']: self._special_set[key](self, key, value) else: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -206,7 +206,7 @@ class env_key_in_attribute(Environment): if key in self._special_set_keys: self._special_set[key](self, key, value) else: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -220,7 +220,7 @@ class env_try_except(Environment): try: self._dict[key] except KeyError: - if not SCons.Environment.is_valid_construction_var(key): + if not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value @@ -232,7 +232,7 @@ class env_not_has_key(Environment): special(self, key, value) else: if key not in self._dict \ - and not SCons.Environment.is_valid_construction_var(key): + and not SCons.Util.is_valid_construction_var(key): raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) self._dict[key] = value diff --git a/bin/SConsDoc.py b/bin/SConsDoc.py index 82e2c72..5e4c4e7 100644 --- a/bin/SConsDoc.py +++ b/bin/SConsDoc.py @@ -1,34 +1,16 @@ #!/usr/bin/env python # -# Copyright (c) 2010 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. -# -# -# Module for handling SCons documentation processing. -# +# SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +# SPDX-License-Identifier: MIT + +"""Module for handling SCons documentation processing. -__doc__ = r""" -This module parses home-brew XML files that document various things -in SCons. Right now, it handles Builders, functions, construction -variables, and Tools, but we expect it to get extended in the future. +This module parses home-brew XML files that document important SCons +components. Currently it handles Builders, Environment functions/methods, +Construction Variables, and Tools (further expansion is possible). These +documentation snippets are turned into files with content and reference +tags that can be included into the manpage and/or user guide, which +prevents a lot of duplication. In general, you can use any DocBook tag in the input, and this module just adds processing various home-brew tags to try to make life a @@ -156,12 +138,13 @@ dbxid = "dbx" # Namespace for schema instances xsi = "http://www.w3.org/2001/XMLSchema-instance" -# Header comment with copyright +# Header comment with copyright (unused at present) copyright_comment = """ -__COPYRIGHT__ +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION This file is processed by the bin/SConsDoc.py module. -See its docstring for a discussion of the format. """ def isSConsXml(fpath): @@ -292,7 +275,7 @@ class TreeFactory: @staticmethod def getText(root): return root.text - + @staticmethod def appendCvLink(root, key, lntail): linknode = etree.Entity('cv-link-' + key) @@ -328,9 +311,9 @@ class TreeFactory: def prettyPrintFile(fpath): with open(fpath,'rb') as fin: tree = etree.parse(fin) - pretty_content = etree.tostring(tree, encoding="utf-8", + pretty_content = etree.tostring(tree, encoding="utf-8", pretty_print=True) - + with open(fpath,'wb') as fout: fout.write(pretty_content) diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 8c89616..fad7d5d 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -10668,7 +10668,7 @@ Various yacc tools have emitted various formats at different times. Set this to match what your parser generator produces. </para> -<para><emphasis>New in version 4.X.Y</emphasis>. </para> +<para><emphasis>New in version 4.6.0</emphasis>. </para> </listitem> </varlistentry> <varlistentry id="cv-YACC_HEADER_FILE"> @@ -10826,7 +10826,7 @@ The value is used only if &cv-YACC_GRAPH_FILE_SUFFIX; is not set. The default value is <filename>.gv</filename>. </para> <para> -<emphasis>Changed in version 4.X.Y</emphasis>: deprecated. The default value +<emphasis>Changed in version 4.6.0</emphasis>: deprecated. The default value changed from <filename>.vcg</filename> (&bison; stopped generating <filename>.vcg</filename> output with version 2.4, in 2006). </para> diff --git a/doc/man/scons.xml b/doc/man/scons.xml index cdaaa44..cc81f64 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -1,29 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION -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. - +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE reference [ @@ -4835,7 +4816,7 @@ not to any stored-values files. <variablelist> <varlistentry id="v-Add"> - <term><replaceable>vars</replaceable>.<function>Add</function>(<parameter>key, [help, default, validator, converter]</parameter>)</term> + <term><replaceable>vars</replaceable>.<function>Add</function>(<parameter>key, [help, default, validator, converter, subst]</parameter>)</term> <listitem> <para>Add a customizable &consvar; to the &Variables; object. <parameter>key</parameter> @@ -4888,6 +4869,16 @@ it can raise a <exceptionname>ValueError</exceptionname>. </para> <para> +Substitution will be performed on the variable value +before the converter and validator are called, +unless the optional <parameter>subst</parameter> parameter +is false (default <literal>True</literal>). +Suppressing substitution may be useful if the variable value +looks like a &consvar; reference (e.g. <literal>$VAR</literal>) +and the validator and/or converter should see it unexpanded. +</para> + +<para> As a special case, if <parameter>key</parameter> is a sequence and is the <emphasis>only</emphasis> argument to &Add;, it is unpacked into the five parameters @@ -4919,6 +4910,11 @@ def valid_color(key, val, env): vars.Add('COLOR', validator=valid_color) </programlisting> + +<para> +<emphasis>Changed in version 4.8.0:</emphasis> +added the <parameter>subst</parameter> parameter. +</para> </listitem> </varlistentry> @@ -5188,7 +5184,7 @@ converted to lower case.</para> </varlistentry> <varlistentry id="v-ListVariable"> - <term><function>ListVariable</function>(<parameter>key, help, default, names, [map]</parameter>)</term> + <term><function>ListVariable</function>(<parameter>key, help, default, names, [map, validator]</parameter>)</term> <listitem> <para> Set up a variable @@ -5210,6 +5206,8 @@ separated by commas. <parameter>default</parameter> may be specified either as a string of comma-separated value, or as a list of values. +</para> +<para> The optional <parameter>map</parameter> argument is a dictionary @@ -5221,6 +5219,14 @@ list. (Note that the additional values accepted through the use of a <parameter>map</parameter> are not reflected in the generated help message). </para> +<para> +The optional <parameter>validator</parameter> argument +can be used to specify a custom validator callback function, +as described for <link linkend='v-Add'><function>Add</function></link>. +The default is to use an internal validator routine. +</para> +<para><emphasis>New in 4.8.0: <parameter>validator</parameter>. +</emphasis></para> </listitem> </varlistentry> diff --git a/doc/scons.mod b/doc/scons.mod index 938886b..76d82df 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -1,39 +1,21 @@ <!-- +SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) +SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION - 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. - +This file is processed by the bin/SConsDoc.py module. +--> +<!-- An SCons-specific DTD module, for use with SCons DocBook documentation, that contains names, phrases, acronyms, etc. used throughout the SCons documentation. These are not just abbreviations - defining these entities means there's a single place to control the markup for those entities, rather than having to change something many places in multiple documentation files. - --> -<!-- Us, and our command names +<!-- Our own names Convention: use &SCons; to refer to the project as a concept, use &scons; to refer to a command as you would invoke it. @@ -96,6 +78,7 @@ <!-- Concepts: these are key SCons things, which may *also* be classes, etc. but are marked here for inclusion in a glossary --> + <!ENTITY Action "<glossterm linkend='gls-action' xmlns='http://www.scons.org/dbxsd/v1.0'>Action</glossterm>"> <!ENTITY Builder "<glossterm linkend='gls-builder' xmlns='http://www.scons.org/dbxsd/v1.0'>Builder</glossterm>"> <!ENTITY Builders "<glossterm linkend='gls-builder' xmlns='http://www.scons.org/dbxsd/v1.0'>Builders</glossterm>"> @@ -171,9 +154,11 @@ <!-- Methods and functions. - This includes functions from both - the Build Engine and the Native Python Interface. - + Many of these also have generated entities (plain, and with link) + from the SCons XML, thus there's &Clone; plus &f-Clone; and &f-env-Clone; + as well as link versions &f-link-Clone; and &f-link-env-Clone;. + Use the ones from here if the "geenerated files" aren't in use, + but they nearly always are. Otherwise - your choice. --> <!ENTITY Add "<function xmlns='http://www.scons.org/dbxsd/v1.0'>Add</function>"> diff --git a/doc/user/actions.xml b/doc/user/actions.xml index d357eb6..ed2eeb7 100644 --- a/doc/user/actions.xml +++ b/doc/user/actions.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index 9c70dd1..071d654 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/alias.xml b/doc/user/alias.xml index 0482b4b..20c60a8 100644 --- a/doc/user/alias.xml +++ b/doc/user/alias.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/ant.xml b/doc/user/ant.xml index 17f44fc..0e7cbc9 100644 --- a/doc/user/ant.xml +++ b/doc/user/ant.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/build-install.xml b/doc/user/build-install.xml index f2b7241..d34512e 100644 --- a/doc/user/build-install.xml +++ b/doc/user/build-install.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/builders-built-in.xml b/doc/user/builders-built-in.xml index be3eed7..3160223 100644 --- a/doc/user/builders-built-in.xml +++ b/doc/user/builders-built-in.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/builders-commands.xml b/doc/user/builders-commands.xml index ba01e0c..d7e8c34 100644 --- a/doc/user/builders-commands.xml +++ b/doc/user/builders-commands.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index eb7d974..b094537 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/builders.xml b/doc/user/builders.xml index 9383424..7ae5fab 100644 --- a/doc/user/builders.xml +++ b/doc/user/builders.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/caching.xml b/doc/user/caching.xml index b79cd62..85a54f0 100644 --- a/doc/user/caching.xml +++ b/doc/user/caching.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index fea1af1..0bdb9c5 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ @@ -417,8 +420,10 @@ foo.in <para> - &SetOption; is not currently supported for - options added with &AddOption;. + &SetOption; works for options added with &AddOption;, + but only if they were created with + <parameter>settable=True</parameter> in the call to &AddOption; + (only available in SCons 4.8.0 and later). </para> @@ -660,14 +665,12 @@ foo.in </para> <para> - &SetOption; is not currently supported for - options added with &AddOption;. - <!-- - (The value can also be set using &SetOption;, - although that's not very useful in practice - because a default value can be specified in - directly in the &AddOption; call.) - --> + + &f-link-SetOption; works for options added with &AddOption;, + but only if they were created with + <parameter>settable=True</parameter> in the call to &AddOption; + (only available in SCons 4.8.0 and later). + </para> <para> diff --git a/doc/user/depends.xml b/doc/user/depends.xml index 961edb2..0950806 100644 --- a/doc/user/depends.xml +++ b/doc/user/depends.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/environments.xml b/doc/user/environments.xml index b4f8689..eeaa23f 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/errors.xml b/doc/user/errors.xml index 8b88bb3..7d833e9 100644 --- a/doc/user/errors.xml +++ b/doc/user/errors.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/example.xml b/doc/user/example.xml index 18783de..eb33832 100644 --- a/doc/user/example.xml +++ b/doc/user/example.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/external.xml b/doc/user/external.xml index 46314c4..71eb849 100644 --- a/doc/user/external.xml +++ b/doc/user/external.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/factories.xml b/doc/user/factories.xml index 905b959..529e93f 100644 --- a/doc/user/factories.xml +++ b/doc/user/factories.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/file-removal.xml b/doc/user/file-removal.xml index 4f93b20..7e5df66 100644 --- a/doc/user/file-removal.xml +++ b/doc/user/file-removal.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/functions.xml b/doc/user/functions.xml index 9185f4a..88dddc7 100644 --- a/doc/user/functions.xml +++ b/doc/user/functions.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/gettext.xml b/doc/user/gettext.xml index b9ebbbd..cabf883 100644 --- a/doc/user/gettext.xml +++ b/doc/user/gettext.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/hierarchy.xml b/doc/user/hierarchy.xml index c501e53..84b0824 100644 --- a/doc/user/hierarchy.xml +++ b/doc/user/hierarchy.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/install.xml b/doc/user/install.xml index b1ae1f6..16e1a72 100644 --- a/doc/user/install.xml +++ b/doc/user/install.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/java.xml b/doc/user/java.xml index 1a51621..a08b406 100644 --- a/doc/user/java.xml +++ b/doc/user/java.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml index 56d4f49..f59a905 100644 --- a/doc/user/less-simple.xml +++ b/doc/user/less-simple.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/libraries.xml b/doc/user/libraries.xml index 67e8a52..bb4b454 100644 --- a/doc/user/libraries.xml +++ b/doc/user/libraries.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/main.xml b/doc/user/main.xml index 0bbabc4..0cdaa70 100644 --- a/doc/user/main.xml +++ b/doc/user/main.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/make.xml b/doc/user/make.xml index f7ca40e..442dc15 100644 --- a/doc/user/make.xml +++ b/doc/user/make.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/mergeflags.xml b/doc/user/mergeflags.xml index 15fa828..d67700d 100644 --- a/doc/user/mergeflags.xml +++ b/doc/user/mergeflags.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 7d1448d..df507df 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml index 83514ec..be0f9f6 100644 --- a/doc/user/nodes.xml +++ b/doc/user/nodes.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/output.xml b/doc/user/output.xml index 9fc00aa..4072e7f 100644 --- a/doc/user/output.xml +++ b/doc/user/output.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/parse_flags_arg.xml b/doc/user/parse_flags_arg.xml index 9e3ad85..d821f6f 100644 --- a/doc/user/parse_flags_arg.xml +++ b/doc/user/parse_flags_arg.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/parseconfig.xml b/doc/user/parseconfig.xml index c7fcdd6..aac3cf3 100644 --- a/doc/user/parseconfig.xml +++ b/doc/user/parseconfig.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml index a007f9b..90e166a 100644 --- a/doc/user/parseflags.xml +++ b/doc/user/parseflags.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/preface.xml b/doc/user/preface.xml index 3a47b63..bccad50 100644 --- a/doc/user/preface.xml +++ b/doc/user/preface.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/python.xml b/doc/user/python.xml index dc10a7b..c5d9cc5 100644 --- a/doc/user/python.xml +++ b/doc/user/python.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/repositories.xml b/doc/user/repositories.xml index 261ec0a..c59df78 100644 --- a/doc/user/repositories.xml +++ b/doc/user/repositories.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/run.xml b/doc/user/run.xml index acedd4b..b096331 100644 --- a/doc/user/run.xml +++ b/doc/user/run.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index c3f3294..6785771 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml index 7acacc3..e257092 100644 --- a/doc/user/sconf.xml +++ b/doc/user/sconf.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/separate.xml b/doc/user/separate.xml index 897a126..4ba5558 100644 --- a/doc/user/separate.xml +++ b/doc/user/separate.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/sideeffect.xml b/doc/user/sideeffect.xml index 863bb71..07d619f 100644 --- a/doc/user/sideeffect.xml +++ b/doc/user/sideeffect.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/simple.xml b/doc/user/simple.xml index 34a3761..7a06513 100644 --- a/doc/user/simple.xml +++ b/doc/user/simple.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/tasks.xml b/doc/user/tasks.xml index 2c10e0b..f239d0b 100644 --- a/doc/user/tasks.xml +++ b/doc/user/tasks.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/tools.xml b/doc/user/tools.xml index ac46bab..d9cec89 100644 --- a/doc/user/tools.xml +++ b/doc/user/tools.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index e7ee81e..72c6fd6 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/variables.xml b/doc/user/variables.xml index 27e3323..ac03e9e 100644 --- a/doc/user/variables.xml +++ b/doc/user/variables.xml @@ -3,6 +3,9 @@ <!-- SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/doc/user/variants.xml b/doc/user/variants.xml index 498d82c..84a93bf 100644 --- a/doc/user/variants.xml +++ b/doc/user/variants.xml @@ -1,9 +1,11 @@ <?xml version='1.0'?> <!-- -Copyright The SCons Foundation SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org) SPDX-License-Identifier: MIT +SPDX-FileType: DOCUMENTATION + +This file is processed by the bin/SConsDoc.py module. --> <!DOCTYPE sconsdoc [ diff --git a/packaging/etc/README.txt b/packaging/etc/README.txt index ffb9cc1..11f1eab 100644 --- a/packaging/etc/README.txt +++ b/packaging/etc/README.txt @@ -1,10 +1,18 @@ -This directory contains a number of scripts/files useful when building/packageing SCons +This directory contains helpers for doing reproducible builds with SCons. + +To force SCons to propagate SOURCE_DATE_EPOCH from the shell running SCons, +the reproducible_site_init.py file can be installed (as site_init.py) +in any site directory - either in the project itself, or more globally. +See the manpage for default site directories or how to set your own path: +https://scons.org/doc/production/HTML/scons-man.html#opt-site-dir. +This code will make sure SOURCE_DATE_EPOCH is set in the execution +environment, meaning any external commands run by SCons will have it +in their environment. Any logic in your build system itself will still +need to examine this variable. + +The shell script reproducible_install.sh can be used to install the +Python site file in your user site directory ($HOME/.scons/site_scons). +It is careful to not overwrite any existing site_init.py there. This +only works for a POSIX shell. -To force SCons to propagate SOURCE_DATE_EPOCH from the shell running SCons we're providing -a script to create a ~/.scons/site_scons/site_init.py. -Note that reproducible_install.sh will NOT overwite an existing ~/.scons/site_scons/site_init.py This supports https://reproducible-builds.org/specs/source-date-epoch/ -If you wanted to include this in your build tree you would place in site_scons/site_init.py relative -to your SConstruct. -* reproducible_install.sh -* reproducible_site_init.py
\ No newline at end of file diff --git a/packaging/etc/reproducible_site_init.py b/packaging/etc/reproducible_site_init.py index 2b6b42a..5f7513b 100644 --- a/packaging/etc/reproducible_site_init.py +++ b/packaging/etc/reproducible_site_init.py @@ -1,5 +1,6 @@ """ -Use this file as your ~/.site_scons/scons_init.py to enable reprodicble builds as described at +Use this file as your site_init.py in a site directory, +to enable reprodicble builds as described at https://reproducible-builds.org/specs/source-date-epoch/ """ @@ -8,17 +9,22 @@ import SCons.Environment old_init = SCons.Environment.Base.__init__ -print("Adding logic to propagate SOURCE_DATE_EPOCH from the shell environment when building with SCons") +print( + "Adding logic to propagate SOURCE_DATE_EPOCH from the shell environment when building with SCons" +) def new_init(self, **kw): - """ - This logic will add SOURCE_DATE_EPOCH to the execution environment used to run - all the build commands. + """Replacement Environment initializer. + + When this is monkey-patched into :class:`SCons.Environment.Base` it adds + ``SOURCE_DATE_EPOCH`` to the execution environment used to run + all external build commands; the original iinitializer is called first. """ old_init(self, **kw) - if 'SOURCE_DATE_EPOCH' in os.environ: - self._dict['ENV']['SOURCE_DATE_EPOCH'] = os.environ['SOURCE_DATE_EPOCH'] + epoch = os.environ.get("SOURCE_DATE_EPOCH") + if epoch is not None: + self._dict["ENV"]["SOURCE_DATE_EPOCH"] = epoch SCons.Environment.Base.__init__ = new_init diff --git a/pyproject.toml b/pyproject.toml index 94f62a4..0cdbc7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,4 +92,4 @@ quote-style = "preserve" # Equivalent to black's "skip-string-normalization" ] [tool.mypy] -python_version = "3.6" # Lowest python version supported (v0.971 and below) +python_version = "3.8" @@ -417,7 +417,7 @@ class SystemExecutor(RuntestBase): def execute(self, env): self.stderr, self.stdout, s = spawn_it(self.command_args, env) self.status = s - if s < 0 or s > 2: + if s < 0 or s > 2 and s != 5: sys.stdout.write("Unexpected exit status %d\n" % s) diff --git a/test/AddOption/basic.py b/test/AddOption/basic.py index 64fb7ba..9fc3c4d 100644 --- a/test/AddOption/basic.py +++ b/test/AddOption/basic.py @@ -24,8 +24,8 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -Verify the help text when the AddOption() function is used (and when -it's not). +Verify added options give the expected default/command line values +when fetched with GetOption. """ import TestSCons @@ -35,35 +35,44 @@ test = TestSCons.TestSCons() test.write('SConstruct', """\ DefaultEnvironment(tools=[]) env = Environment(tools=[]) -AddOption('--force', - action="store_true", - help='force installation (overwrite any existing files)') -AddOption('--prefix', - nargs=1, - dest='prefix', - action='store', - type='string', - metavar='DIR', - help='installation prefix') +AddOption( + '--force', + action="store_true", + help='force installation (overwrite any existing files)', +) +AddOption( + '--prefix', + nargs=1, + dest='prefix', + action='store', + type='string', + metavar='DIR', + settable=True, + help='installation prefix', +) +AddOption( + '--set', + action="store_true", + help="try SetOption of 'prefix' to '/opt/share'" +) f = GetOption('force') if f: f = "True" print(f) print(GetOption('prefix')) +if GetOption('set'): + SetOption('prefix', '/opt/share') + print(GetOption('prefix')) """) -test.run('-Q -q .', - stdout="None\nNone\n") - -test.run('-Q -q . --force', - stdout="True\nNone\n") - -test.run('-Q -q . --prefix=/home/foo', - stdout="None\n/home/foo\n") - -test.run('-Q -q . -- --prefix=/home/foo --force', - status=1, - stdout="None\nNone\n") +test.run('-Q -q .', stdout="None\nNone\n") +test.run('-Q -q . --force', stdout="True\nNone\n") +test.run('-Q -q . --prefix=/home/foo', stdout="None\n/home/foo\n") +test.run('-Q -q . -- --prefix=/home/foo --force', status=1, stdout="None\nNone\n") +# check that SetOption works on prefix... +test.run('-Q -q . --set', stdout="None\nNone\n/opt/share\n") +# but the "command line wins" rule is not violated +test.run('-Q -q . --set --prefix=/home/foo', stdout="None\n/home/foo\n/home/foo\n") test.pass_test() diff --git a/test/AddOption/help.py b/test/AddOption/help.py index 6d855bd..772a381 100644 --- a/test/AddOption/help.py +++ b/test/AddOption/help.py @@ -23,6 +23,11 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" +Verify the help text when the AddOption() function is used (and when +it's not). +""" + import TestSCons test = TestSCons.TestSCons() @@ -30,16 +35,20 @@ test = TestSCons.TestSCons() test.write('SConstruct', """\ DefaultEnvironment(tools=[]) env = Environment(tools=[]) -AddOption('--force', - action="store_true", - help='force installation (overwrite existing files)') -AddOption('--prefix', - nargs=1, - dest='prefix', - action='store', - type='string', - metavar='DIR', - help='installation prefix') +AddOption( + '--force', + action="store_true", + help='force installation (overwrite existing files)', +) +AddOption( + '--prefix', + nargs=1, + dest='prefix', + action='store', + type='string', + metavar='DIR', + help='installation prefix', +) """) expected_lines = [ diff --git a/test/Clone-Variables.py b/test/Clone-Variables.py new file mode 100644 index 0000000..383caea --- /dev/null +++ b/test/Clone-Variables.py @@ -0,0 +1,63 @@ +#!/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. + + +""" +Verify that Clone() respects the variables kwarg. + +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """\ +vars = Variables() +vars.Add(BoolVariable('MYTEST', 'help', default=False)) + +_ = DefaultEnvironment(tools=[]) +env = Environment(variables=vars, tools=[]) +print(f"MYTEST={env.Dictionary('MYTEST')}") +env.Replace(MYTEST=True) +print(f"MYTEST={env.Dictionary('MYTEST')}") +env1 = env.Clone(variables=vars) +print(f"MYTEST={env1.Dictionary('MYTEST')}") +""") + +expect = """\ +MYTEST=False +MYTEST=True +MYTEST=False +""" + +test.run(arguments = '-q -Q', stdout=expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/GetOption/BadSetOption.py b/test/GetOption/BadSetOption.py index 7b0a33d..f408e39 100644 --- a/test/GetOption/BadSetOption.py +++ b/test/GetOption/BadSetOption.py @@ -32,7 +32,7 @@ import TestSCons test = TestSCons.TestSCons() badopts = ( - ("no_such_var", True, "This option is not settable from a SConscript file: no_such_var"), + ("no_such_var", True, "This option is not settable from an SConscript file: 'no_such_var'"), ("num_jobs", -22, "A positive integer is required: -22"), ("max_drift", "'Foo'", "An integer is required: 'Foo'"), ("duplicate", "'cookie'", "Not a valid duplication style: cookie"), @@ -45,11 +45,10 @@ for opt, value, expect in badopts: SConstruct = "SC-" + opt test.write( SConstruct, - """\ + f"""\ DefaultEnvironment(tools=[]) -SetOption("%(opt)s", %(value)s) -""" - % locals(), +SetOption("{opt}", {value}) +""", ) expect = r"scons: *** %s" % expect test.run(arguments='-Q -f %s .' % SConstruct, stderr=None, status=2) diff --git a/test/Variables/BoolVariable.py b/test/Variables/BoolVariable.py index c63322b..aa01a30 100644 --- a/test/Variables/BoolVariable.py +++ b/test/Variables/BoolVariable.py @@ -39,10 +39,7 @@ def check(expect): test.write(SConstruct_path, """\ -from SCons.Variables.BoolVariable import BoolVariable - -BV = BoolVariable - +from SCons.Variables.BoolVariable import BoolVariable as BV from SCons.Variables import BoolVariable opts = Variables(args=ARGUMENTS) @@ -51,7 +48,8 @@ opts.AddVariables( BV('profile', 'create profiling informations', False), ) -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) +env = Environment(variables=opts, tools=[]) Help(opts.GenerateHelpText(env)) print(env['warnings']) @@ -69,7 +67,7 @@ check([str(False), str(True)]) expect_stderr = """ scons: *** Error converting option: 'warnings' Invalid value for boolean variable: 'irgendwas' -""" + test.python_file_line(SConstruct_path, 13) +""" + test.python_file_line(SConstruct_path, 11) test.run(arguments='warnings=irgendwas', stderr=expect_stderr, status=2) diff --git a/test/Variables/EnumVariable.py b/test/Variables/EnumVariable.py index 111fff3..066df74 100644 --- a/test/Variables/EnumVariable.py +++ b/test/Variables/EnumVariable.py @@ -38,9 +38,7 @@ def check(expect): assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) test.write(SConstruct_path, """\ -from SCons.Variables.EnumVariable import EnumVariable -EV = EnumVariable - +from SCons.Variables.EnumVariable import EnumVariable as EV from SCons.Variables import EnumVariable list_of_libs = Split('x11 gl qt ical') @@ -58,7 +56,8 @@ opts.AddVariables( map={}, ignorecase=2), # make lowercase ) -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) +env = Environment(variables=opts, tools=[]) Help(opts.GenerateHelpText(env)) print(env['debug']) @@ -78,19 +77,19 @@ check(['full', 'KdE', 'eins']) expect_stderr = """ scons: *** Invalid value for enum variable 'debug': 'FULL'. Valid values are: ('yes', 'no', 'full') -""" + test.python_file_line(SConstruct_path, 21) +""" + test.python_file_line(SConstruct_path, 20) test.run(arguments='debug=FULL', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Invalid value for enum variable 'guilib': 'irgendwas'. Valid values are: ('motif', 'gtk', 'kde') -""" + test.python_file_line(SConstruct_path, 21) +""" + test.python_file_line(SConstruct_path, 20) test.run(arguments='guilib=IrGeNdwas', stderr=expect_stderr, status=2) expect_stderr = """ scons: *** Invalid value for enum variable 'some': 'irgendwas'. Valid values are: ('xaver', 'eins') -""" + test.python_file_line(SConstruct_path, 21) +""" + test.python_file_line(SConstruct_path, 20) test.run(arguments='some=IrGeNdwas', stderr=expect_stderr, status=2) diff --git a/test/Variables/ListVariable.py b/test/Variables/ListVariable.py index 2bd0327..52f1bc5 100644 --- a/test/Variables/ListVariable.py +++ b/test/Variables/ListVariable.py @@ -43,9 +43,7 @@ def check(expect): test.write(SConstruct_path, """\ -from SCons.Variables.ListVariable import ListVariable -LV = ListVariable - +from SCons.Variables.ListVariable import ListVariable as LV from SCons.Variables import ListVariable list_of_libs = Split('x11 gl qt ical') @@ -59,10 +57,10 @@ opts.AddVariables( names = list_of_libs, map = {'GL':'gl', 'QT':'qt'}), LV('listvariable', 'listvariable help', 'all', names=['l1', 'l2', 'l3']) - ) +) -DefaultEnvironment(tools=[]) # test speedup -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) # test speedup +env = Environment(variables=opts, tools=[]) opts.Save(optsfile, env) Help(opts.GenerateHelpText(env)) @@ -113,39 +111,34 @@ check(['gl,qt', '0', 'gl qt', 'gl qt', "['gl qt']"]) expect_stderr = """ -scons: *** Error converting option: 'shared' -Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 20) +scons: *** Invalid value(s) for variable 'shared': 'foo'. Valid values are: gl,ical,qt,x11,all,none +""" + test.python_file_line(SConstruct_path, 18) test.run(arguments='shared=foo', stderr=expect_stderr, status=2) # be paranoid in testing some more combinations expect_stderr = """ -scons: *** Error converting option: 'shared' -Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 20) +scons: *** Invalid value(s) for variable 'shared': 'foo'. Valid values are: gl,ical,qt,x11,all,none +""" + test.python_file_line(SConstruct_path, 18) test.run(arguments='shared=foo,ical', stderr=expect_stderr, status=2) expect_stderr = """ -scons: *** Error converting option: 'shared' -Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 20) +scons: *** Invalid value(s) for variable 'shared': 'foo'. Valid values are: gl,ical,qt,x11,all,none +""" + test.python_file_line(SConstruct_path, 18) test.run(arguments='shared=ical,foo', stderr=expect_stderr, status=2) expect_stderr = """ -scons: *** Error converting option: 'shared' -Invalid value(s) for option: foo -""" + test.python_file_line(SConstruct_path, 20) +scons: *** Invalid value(s) for variable 'shared': 'foo'. Valid values are: gl,ical,qt,x11,all,none +""" + test.python_file_line(SConstruct_path, 18) test.run(arguments='shared=ical,foo,x11', stderr=expect_stderr, status=2) expect_stderr = """ -scons: *** Error converting option: 'shared' -Invalid value(s) for option: foo,bar -""" + test.python_file_line(SConstruct_path, 20) +scons: *** Invalid value(s) for variable 'shared': 'foo,bar'. Valid values are: gl,ical,qt,x11,all,none +""" + test.python_file_line(SConstruct_path, 18) test.run(arguments='shared=foo,x11,,,bar', stderr=expect_stderr, status=2) diff --git a/test/Variables/PackageVariable.py b/test/Variables/PackageVariable.py index 47ee01b..64e0fa8 100644 --- a/test/Variables/PackageVariable.py +++ b/test/Variables/PackageVariable.py @@ -39,9 +39,7 @@ def check(expect): assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) test.write(SConstruct_path, """\ -from SCons.Variables.PackageVariable import PackageVariable -PV = PackageVariable - +from SCons.Variables.PackageVariable import PackageVariable as PV from SCons.Variables import PackageVariable opts = Variables(args=ARGUMENTS) @@ -52,7 +50,8 @@ opts.AddVariables( PV('package', 'help for package', 'yes'), ) -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) +env = Environment(variables=opts, tools=[]) Help(opts.GenerateHelpText(env)) print(env['x11']) @@ -73,7 +72,7 @@ check([test.workpath()]) expect_stderr = """ scons: *** Path does not exist for variable 'x11': '/non/existing/path/' -""" + test.python_file_line(SConstruct_path, 14) +""" + test.python_file_line(SConstruct_path, 13) test.run(arguments='x11=/non/existing/path/', stderr=expect_stderr, status=2) diff --git a/test/Variables/PathVariable.py b/test/Variables/PathVariable.py index 265f48f..61b21b3 100644 --- a/test/Variables/PathVariable.py +++ b/test/Variables/PathVariable.py @@ -47,9 +47,7 @@ workpath = test.workpath() libpath = os.path.join(workpath, 'lib') test.write(SConstruct_path, """\ -from SCons.Variables.PathVariable import PathVariable -PV = PathVariable - +from SCons.Variables.PathVariable import PathVariable as PV from SCons.Variables import PathVariable qtdir = r'%s' @@ -60,8 +58,8 @@ opts.AddVariables( PV('qt_libraries', 'where the Qt library is installed', r'%s'), ) -DefaultEnvironment(tools=[]) # test speedup -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) # test speedup +env = Environment(variables=opts, tools=[]) Help(opts.GenerateHelpText(env)) print(env['qtdir']) @@ -92,7 +90,7 @@ test.run(arguments=['qtdir=%s' % qtpath, 'qt_libraries=%s' % libpath]) check([qtpath, libpath, libpath]) qtpath = os.path.join(workpath, 'non', 'existing', 'path') -SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 15)[:-1] +SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 13)[:-1] expect_stderr = """ scons: *** Path for variable 'qtdir' does not exist: %(qtpath)s diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py index 77426c5..d585b57 100644 --- a/test/Variables/Variables.py +++ b/test/Variables/Variables.py @@ -23,12 +23,21 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" +Test general behavior of Variables including save files. + +Note this test is coded to expect a compiler tool to have run +so that CC and CCFLAGS are set. The first test "run" collects +those values and uses them as a baseline for the actual tests. +We should be able to mock that in some way. +""" + import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -DefaultEnvironment(tools=[]) # test speedup +_ = DefaultEnvironment(tools=[]) # test speedup env = Environment() print(env['CC']) print(" ".join(env['CCFLAGS'])) @@ -277,7 +286,7 @@ opts.Add('LISTOPTION_TEST', names = ['a','b','c',]) DefaultEnvironment(tools=[]) # test speedup -env = Environment(variables=opts) +env = Environment(variables=opts, tools=[]) print(env['RELEASE_BUILD']) print(env['DEBUG_BUILD']) diff --git a/test/Variables/chdir.py b/test/Variables/chdir.py index 2c553e2..ed7cf2b 100644 --- a/test/Variables/chdir.py +++ b/test/Variables/chdir.py @@ -43,7 +43,8 @@ SConscript('subdir/SConscript') SConscript_contents = """\ Import("opts") -env = Environment() +_ = DefaultEnvironment(tools=[]) +env = Environment(tools=[]) opts.Update(env) print("VARIABLE = "+repr(env['VARIABLE'])) """ diff --git a/test/Variables/help.py b/test/Variables/help.py index 186a173..84a405a 100644 --- a/test/Variables/help.py +++ b/test/Variables/help.py @@ -92,7 +92,8 @@ opts.AddVariables( PathVariable('qt_libraries', 'where the Qt library is installed', r'%(libdirvar)s'), ) -env = Environment(variables=opts) +_ = DefaultEnvironment(tools=[]) +env = Environment(variables=opts, tools=[]) Help(opts.GenerateHelpText(env)) print(env['warnings']) diff --git a/test/Variables/import.py b/test/Variables/import.py index 8db7624..833b299 100644 --- a/test/Variables/import.py +++ b/test/Variables/import.py @@ -45,7 +45,8 @@ SConscript('subdir/SConscript') SConscript_contents = """\ Import("opts") -env = Environment() +_ = DefaultEnvironment(tools=[]) +env = Environment(tools=[]) opts.Update(env) print("VARIABLE = %s"%env.get('VARIABLE')) """ diff --git a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism index a7982d4..6d20636 100644 --- a/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism +++ b/test/ninja/ninja_test_sconscripts/sconstruct_ninja_determinism @@ -5,12 +5,10 @@ import random SetOption('experimental', 'ninja') -SetOption('skip_ninja_regen', True) DefaultEnvironment(tools=[]) - env = Environment(tools=[]) - env.Tool('ninja') +SetOption('skip_ninja_regen', True) # must wait until tool creates the option # make the dependency list vary in order. Ninja tool should sort them to be deterministic. for i in range(1, 10): |