summaryrefslogtreecommitdiffstats
path: root/SCons
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-06-02 20:39:30 (GMT)
committerGitHub <noreply@github.com>2022-06-02 20:39:30 (GMT)
commit99a1192929e06b1e22abae40f6140f6ce5f3dc85 (patch)
tree9cf60a0b56d253c9d34996d7d9a3d03ff3474c63 /SCons
parentb5ebe82c9867ad9da154e57c70d1f63f2d98d3a1 (diff)
parent5c7c997dc4822a93d2b02e6709803600051f3517 (diff)
downloadSCons-99a1192929e06b1e22abae40f6140f6ce5f3dc85.zip
SCons-99a1192929e06b1e22abae40f6140f6ce5f3dc85.tar.gz
SCons-99a1192929e06b1e22abae40f6140f6ce5f3dc85.tar.bz2
Merge branch 'master' into ninja_always_execute
Diffstat (limited to 'SCons')
-rw-r--r--SCons/Action.py28
-rw-r--r--SCons/Action.xml35
-rw-r--r--SCons/Environment.xml71
-rw-r--r--SCons/Scanner/ScannerTests.py4
-rw-r--r--SCons/Script/SConscript.xml94
-rw-r--r--SCons/Tool/MSCommon/common.py14
-rw-r--r--SCons/Tool/ToolTests.py4
-rw-r--r--SCons/Tool/msvsTests.py4
-rw-r--r--SCons/Tool/ninja/Methods.py4
-rw-r--r--SCons/Tool/ninja/NinjaState.py11
-rw-r--r--SCons/Tool/ninja/Utils.py4
-rw-r--r--SCons/Tool/swig.xml81
-rw-r--r--SCons/cppTests.py4
13 files changed, 209 insertions, 149 deletions
diff --git a/SCons/Action.py b/SCons/Action.py
index 0849178..6e67c7f 100644
--- a/SCons/Action.py
+++ b/SCons/Action.py
@@ -732,7 +732,7 @@ def _string_from_cmd_list(cmd_list):
default_ENV = None
-def get_default_ENV(env, target=None, source=None):
+def get_default_ENV(env):
"""
A fiddlin' little function that has an 'import SCons.Environment' which
can't be moved to the top level without creating an import loop. Since
@@ -755,6 +755,29 @@ def get_default_ENV(env, target=None, source=None):
return default_ENV
+def _resolve_shell_env(env, target, source):
+ """
+ First get default environment.
+ Then if SHELL_ENV_GENERATORS is set and is iterable,
+ call each callable in that list to allow it to alter
+ the created execution environment.
+ """
+ ENV = get_default_ENV(env)
+ shell_gen = env.get('SHELL_ENV_GENERATORS')
+ if shell_gen:
+ try:
+ shell_gens = iter(shell_gen)
+ except TypeError:
+ raise SCons.Errors.UserError("SHELL_ENV_GENERATORS must be iteratable.")
+ else:
+ ENV = ENV.copy()
+ for generator in shell_gens:
+ ENV = generator(env, target, source, ENV)
+ if not isinstance(ENV, dict):
+ raise SCons.Errors.UserError(f"SHELL_ENV_GENERATORS function: {generator} must return a dict.")
+ return ENV
+
+
def _subproc(scons_env, cmd, error='ignore', **kw):
"""Wrapper for subprocess which pulls from construction env.
@@ -924,10 +947,9 @@ class CommandAction(_ActionAction):
escape = env.get('ESCAPE', lambda x: x)
- ENV = env.get('SHELL_ENV_GENERATOR', get_default_ENV)(env, target, source)
+ ENV = _resolve_shell_env(env, target, source)
# Ensure that the ENV values are all strings:
-
for key, value in ENV.items():
if not is_String(value):
if is_List(value):
diff --git a/SCons/Action.xml b/SCons/Action.xml
index 2c18d55..1346db2 100644
--- a/SCons/Action.xml
+++ b/SCons/Action.xml
@@ -200,18 +200,32 @@ in which the command should be executed.
</summary>
</cvar>
-<cvar name="SHELL_ENV_GENERATOR">
+<cvar name="SHELL_ENV_GENERATORS">
<summary>
<para>
-A function to generate or alter the environment dictionary which will be used
-when executing the &cv-link-SPAWN; function. This primarily give the
-user a chance to customize the execution environment for particular Actions.
-It must return a dictionary containing the environment variables as
-keys and the values as values.
+Must be a list (or an iterable) containing functions where each function generates or
+alters the environment dictionary which will be used
+when executing the &cv-link-SPAWN; function. The functions will initially
+be passed a reference of the current execution environment (e.g. env['ENV']),
+and each called while iterating the list. Each function must return a dictionary
+which will then be passed to the next function iterated. The return dictionary
+should contain keys which represent the environment variables and their respective
+values.
+
+This primary purpose of this construction variable is to give the user the ability
+to substitute execution environment variables based on env, targets, and sources.
+If desired, the user can completely customize the execution environment for particular
+targets.
</para>
<example_commands>
-def custom_shell_env(env, target, source):
+def custom_shell_env(env, target, source, shell_env):
+ """customize shell_env if desired"""
+ if str(target[0]) == 'special_target':
+ shell_env['SPECIAL_VAR'] = env.subst('SOME_VAR', target=target, source=source)
+ return shell_env
+
+env["SHELL_ENV_GENERATORS"] = [custom_shell_env]
</example_commands>
<para>
@@ -223,10 +237,15 @@ execution environment can be derived from.
<varname>target</varname>
The list of targets associated with this action.
</para>
- <para>
+ <para>
<varname>source</varname>
The list of sources associated with this action.
</para>
+ <para>
+ <varname>shell_env</varname>
+The current shell_env after iterating other SHELL_ENV_GENERATORS functions. This can be compared
+to the passed env['ENV'] to detect any changes.
+ </para>
</summary>
</cvar>
diff --git a/SCons/Environment.xml b/SCons/Environment.xml
index 3a6df97..5c4326c 100644
--- a/SCons/Environment.xml
+++ b/SCons/Environment.xml
@@ -318,7 +318,7 @@ Added methods propagate through &f-env-Clone; calls.
</para>
<para>
-Examples:
+More examples:
</para>
<example_commands>
@@ -3416,42 +3416,41 @@ env.UpdateValue(target = Value(output), source = Value(input))
</arguments>
<summary>
<para>
-Sets up an alternate build location.
-When building in the <parameter>variant_dir</parameter>,
-&SCons; backfills as needed with files from <parameter>src_dir</parameter>
-to create a complete build directory.
+Sets up a mapping to define a variant build directory in
+<parameter>variant_dir</parameter>.
+<parameter>src_dir</parameter> may not be underneath
+<parameter>variant_dir</parameter>.
+A &f-VariantDir; mapping is global, even if called using the
+&f-env-VariantDir; form.
&f-VariantDir;
can be called multiple times with the same
<parameter>src_dir</parameter>
-to set up multiple builds with different options
-(<emphasis>variants</emphasis>).
+to set up multiple variant builds with different options.
</para>
<para>
-The
-<parameter>variant</parameter>
-location must be in or underneath the project top directory,
-and <parameter>src_dir</parameter>
-may not be underneath
-<parameter>variant_dir</parameter>.
+Note if <parameter>variant_dir</parameter>
+is not under the project top directory,
+target selection rules will not pick targets in the
+variant directory unless they are explicitly specified.
</para>
<para>
+When files in <parameter>variant_dir</parameter> are referenced,
+&SCons; backfills as needed with files from <parameter>src_dir</parameter>
+to create a complete build directory.
By default, &SCons;
-physically duplicates the source files and SConscript files
-as needed into the variant tree.
-Thus, a build performed in the variant tree is guaranteed to be identical
-to a build performed in the source tree even if
+physically duplicates the source files, SConscript files,
+and directory structure as needed into the variant directory.
+Thus, a build performed in the variant directory is guaranteed to be identical
+to a build performed in the source directory even if
intermediate source files are generated during the build,
or if preprocessors or other scanners search for included files
-relative to the source file,
+using paths relative to the source file,
or if individual compilers or other invoked tools are hard-coded
to put derived files in the same directory as source files.
Only the files &SCons; calculates are needed for the build are
duplicated into <parameter>variant_dir</parameter>.
-</para>
-
-<para>
If possible on the platform,
the duplication is performed by linking rather than copying.
This behavior is affected by the
@@ -3470,44 +3469,46 @@ to invoke Builders using the path names of source files in
<parameter>src_dir</parameter>
and the path names of derived files within
<parameter>variant_dir</parameter>.
-This is more efficient than
-<literal>duplicate=True</literal>,
+This is more efficient than duplicating,
and is safe for most builds;
-revert to <constant>True</constant>
+revert to <literal>duplicate=True</literal>
if it causes problems.
</para>
<para>
&f-VariantDir;
-works most naturally with used with a subsidiary SConscript file.
-The subsidiary SConscript file is called as if it
-were in
+works most naturally when used with a subsidiary SConscript file.
+The subsidiary SConscript file must be called as if it were in
<parameter>variant_dir</parameter>,
regardless of the value of
<parameter>duplicate</parameter>.
-This is how you tell
-&scons;
-which variant of a source tree to build:
+When calling an SConscript file, you can use the
+<parameter>exports</parameter> keyword argument
+to pass parameters (individually or as an appropriately set up environment)
+so the SConscript can pick up the right settings for that variant build.
+The SConscript must &f-link-Import; these to use them. Example:
</para>
<example_commands>
+env1 = Environment(...settings for variant1...)
+env2 = Environment(...settings for variant2...)
+
# run src/SConscript in two variant directories
VariantDir('build/variant1', 'src')
-SConscript('build/variant1/SConscript')
+SConscript('build/variant1/SConscript', exports={"env": env1})
VariantDir('build/variant2', 'src')
-SConscript('build/variant2/SConscript')
+SConscript('build/variant2/SConscript', exports={"env": env2})
</example_commands>
<para>
See also the
-&f-link-SConscript;
-function, described above,
+&f-link-SConscript; function
for another way to specify a variant directory
in conjunction with calling a subsidiary SConscript file.
</para>
<para>
-Examples:
+More examples:
</para>
<example_commands>
diff --git a/SCons/Scanner/ScannerTests.py b/SCons/Scanner/ScannerTests.py
index 68332a0..b9cb209 100644
--- a/SCons/Scanner/ScannerTests.py
+++ b/SCons/Scanner/ScannerTests.py
@@ -621,7 +621,9 @@ def suite():
ClassicCPPTestCase,
]
for tclass in tclasses:
- names = unittest.getTestCaseNames(tclass, 'test_')
+ loader = unittest.TestLoader()
+ loader.testMethodPrefix = 'test_'
+ names = loader.getTestCaseNames(tclass)
suite.addTests(list(map(tclass, names)))
return suite
diff --git a/SCons/Script/SConscript.xml b/SCons/Script/SConscript.xml
index 3c5b907..eb52acc 100644
--- a/SCons/Script/SConscript.xml
+++ b/SCons/Script/SConscript.xml
@@ -363,42 +363,38 @@ Return('val1 val2')
<!-- (scripts, [exports, variant_dir, src_dir, duplicate, must_exist]) -->
</arguments>
<arguments>
-(dirs=subdirs, [name=script, exports, variant_dir, duplicate, must_exist])
-<!-- (dirs=subdirs, [name=script, exports, variant_dir, src_dir, duplicate, must_exist]) -->
+(dirs=subdirs, [name=scriptname, exports, variant_dir, duplicate, must_exist])
+<!-- (dirs=subdirs, [name=scriptname, exports, variant_dir, src_dir, duplicate, must_exist]) -->
</arguments>
<summary>
<para>
-Execute one or more subsidiary SConscript (configuration) files.
+Executes one or more subsidiary SConscript (configuration) files.
There are two ways to call the
&f-SConscript; function.
</para>
<para>
-The first calling style
-is to explicitly specify one or more
-<varname>scripts</varname>
-as the first argument.
+The first calling style is to supply
+one or more SConscript file names
+as the first (positional) argument.
A single script may be specified as a string;
-multiple scripts must be specified as a list
+multiple scripts must be specified as a list of strings
(either explicitly or as created by
a function like
&f-link-Split;).
Examples:
</para>
<example_commands>
-SConscript('SConscript') # run SConscript in the current directory
+SConscript('SConscript') # run SConscript in the current directory
SConscript('src/SConscript') # run SConscript in the src directory
SConscript(['src/SConscript', 'doc/SConscript'])
config = SConscript('MyConfig.py')
</example_commands>
<para>
-The second way to call
-&f-SConscript;
-is to specify a list of (sub)directory names
-as a
-<varname>dirs</varname>=<replaceable>subdirs</replaceable>
-keyword argument.
+The other calling style is to omit the positional argument naming
+scripts and instead specify a list of directory names using the
+<varname>dirs</varname> keyword argument.
In this case,
&scons;
will
@@ -408,14 +404,14 @@ in each of the specified directories.
You may specify a name other than
&SConscript;
by supplying an optional
-<varname>name</varname>=<replaceable>script</replaceable>
+<varname>name</varname>=<replaceable>scriptname</replaceable>
keyword argument.
The first three examples below have the same effect
as the first three examples above:
</para>
<example_commands>
-SConscript(dirs='.') # run SConscript in the current directory
-SConscript(dirs='src') # run SConscript in the src directory
+SConscript(dirs='.') # run SConscript in the current directory
+SConscript(dirs='src') # run SConscript in the src directory
SConscript(dirs=['src', 'doc'])
SConscript(dirs=['sub1', 'sub2'], name='MySConscript')
</example_commands>
@@ -423,8 +419,12 @@ SConscript(dirs=['sub1', 'sub2'], name='MySConscript')
<para>
The optional
<varname>exports</varname>
-argument provides a string or list of strings representing
+keyword argument provides a string or list of strings representing
variable names, or a dictionary of named values, to export.
+For the first calling style only, a second positional argument
+will be interpreted as <varname>exports</varname>; the
+second calling style must use the keyword argument form
+for <varname>exports</varname>.
These variables are locally exported only to the called
SConscript file(s)
and do not affect the global pool of variables managed by the
@@ -448,38 +448,24 @@ SConscript(dirs=['one', 'two', 'three'], exports='shared_info')
If the optional
<varname>variant_dir</varname>
argument is present, it causes an effect equivalent to the
-&f-link-VariantDir; function.
+&f-link-VariantDir; function,
+but in effect only within the scope of the &f-SConscript; call.
The <varname>variant_dir</varname>
-argument is interpreted relative to the directory of the calling
-SConscript file.
-The optional
-<varname>duplicate</varname> argument is
-interpreted as for &f-link-VariantDir;.
-If <varname>variant_dir</varname>
-is omitted, the <varname>duplicate</varname> argument is ignored.
-See the description of
-&f-link-VariantDir;
-below for additional details and restrictions.
-</para>
-
-<para>
-If
-<varname>variant_dir</varname>
-is present,
-the source directory is the directory in which the
-SConscript
-file resides and the
-SConscript
+argument is interpreted relative to the directory of the
+<emphasis>calling</emphasis> SConscript file.
+The source directory is the directory in which the
+<emphasis>called</emphasis> SConscript
+file resides and the SConscript
file is evaluated as if it were in the
<varname>variant_dir</varname>
-directory:
+directory. Thus:
</para>
<example_commands>
SConscript('src/SConscript', variant_dir='build')
</example_commands>
<para>
-is equivalent to
+is equivalent to:
</para>
<example_commands>
@@ -488,9 +474,8 @@ SConscript('build/SConscript')
</example_commands>
<para>
-This later paradigm is often used when the sources are
-in the same directory as the
-&SConstruct;:
+If the sources are in the same directory as the
+&SConstruct;,
</para>
<example_commands>
@@ -498,7 +483,7 @@ SConscript('SConscript', variant_dir='build')
</example_commands>
<para>
-is equivalent to
+is equivalent to:
</para>
<example_commands>
@@ -507,6 +492,17 @@ SConscript('build/SConscript')
</example_commands>
<para>
+The optional
+<varname>duplicate</varname> argument is
+interpreted as for &f-link-VariantDir;.
+If the <varname>variant_dir</varname> argument
+is omitted, the <varname>duplicate</varname> argument is ignored.
+See the description of
+&f-link-VariantDir;
+for additional details and restrictions.
+</para>
+
+<para>
<!--
If
<varname>variant_dir</varname>
@@ -589,11 +585,11 @@ SConscript('src/SConscript', variant_dir='build/ppc', duplicate=0)
<para>
&f-SConscript; returns the values of any variables
-named by the executed SConscript(s) in arguments
-to the &f-link-Return; function (see above for details).
+named by the executed SConscript file(s) in arguments
+to the &f-link-Return; function.
If a single &f-SConscript; call causes multiple scripts to
be executed, the return value is a tuple containing
-the returns of all of the scripts. If an executed
+the returns of each of the scripts. If an executed
script does not explicitly call &Return;, it returns
<constant>None</constant>.
</para>
diff --git a/SCons/Tool/MSCommon/common.py b/SCons/Tool/MSCommon/common.py
index f542e02..c9f07f5 100644
--- a/SCons/Tool/MSCommon/common.py
+++ b/SCons/Tool/MSCommon/common.py
@@ -35,6 +35,10 @@ from contextlib import suppress
from pathlib import Path
import SCons.Util
+import SCons.Warnings
+
+class MSVCCacheInvalidWarning(SCons.Warnings.WarningOnByDefault):
+ pass
# SCONS_MSCOMMON_DEBUG is internal-use so undocumented:
# set to '-' to print to console, else set to filename to log to
@@ -110,7 +114,15 @@ def read_script_env_cache():
# json to the cache dictionary. Reconstruct the cache key
# tuple from the key list written to json.
envcache_list = json.load(f)
- envcache = {tuple(d['key']): d['data'] for d in envcache_list}
+ if isinstance(envcache_list, list):
+ envcache = {tuple(d['key']): d['data'] for d in envcache_list}
+ else:
+ # don't fail if incompatible format, just proceed without it
+ warn_msg = "Incompatible format for msvc cache file {}: file may be overwritten.".format(
+ repr(CONFIG_CACHE)
+ )
+ SCons.Warnings.warn(MSVCCacheInvalidWarning, warn_msg)
+ debug(warn_msg)
except FileNotFoundError:
# don't fail if no cache file, just proceed without it
pass
diff --git a/SCons/Tool/ToolTests.py b/SCons/Tool/ToolTests.py
index 7cff7c8..9338c2d 100644
--- a/SCons/Tool/ToolTests.py
+++ b/SCons/Tool/ToolTests.py
@@ -116,7 +116,9 @@ class ToolTestCase(unittest.TestCase):
if __name__ == "__main__":
- suite = unittest.makeSuite(ToolTestCase, 'test_')
+ loader = unittest.TestLoader()
+ loader.testMethodPrefix = 'test_'
+ suite = loader.loadTestsFromTestCase(ToolTestCase)
TestUnit.run(suite)
# Local Variables:
diff --git a/SCons/Tool/msvsTests.py b/SCons/Tool/msvsTests.py
index 4cbaf0e..c4d2e98 100644
--- a/SCons/Tool/msvsTests.py
+++ b/SCons/Tool/msvsTests.py
@@ -982,7 +982,9 @@ if __name__ == "__main__":
if k in os.environ:
del os.environ[k]
- suite = unittest.makeSuite(test_class, 'test_')
+ loader = unittest.TestLoader()
+ loader.testMethodPrefix = 'test_'
+ suite = loader.loadTestsFromTestCase(test_class)
if not TestUnit.cli.get_runner()().run(suite).wasSuccessful():
exit_val = 1
finally:
diff --git a/SCons/Tool/ninja/Methods.py b/SCons/Tool/ninja/Methods.py
index 2be576f..c0afab8 100644
--- a/SCons/Tool/ninja/Methods.py
+++ b/SCons/Tool/ninja/Methods.py
@@ -81,7 +81,7 @@ def get_generic_shell_command(env, node, action, targets, sources, executor=None
"GENERATED_CMD",
{
"cmd": generate_command(env, node, action, targets, sources, executor=executor),
- "env": get_command_env(env),
+ "env": get_command_env(env, targets, sources),
},
# Since this function is a rule mapping provider, it must return a list of dependencies,
# and usually this would be the path to a tool, such as a compiler, used for this rule.
@@ -266,7 +266,7 @@ def gen_get_response_file_command(env, rule, tool, tool_is_dynamic=False, custom
variables = {"rspc": rsp_content, rule: cmd}
if use_command_env:
- variables["env"] = get_command_env(env)
+ variables["env"] = get_command_env(env, targets, sources)
for key, value in custom_env.items():
variables["env"] += env.subst(
diff --git a/SCons/Tool/ninja/NinjaState.py b/SCons/Tool/ninja/NinjaState.py
index 770da07..70be248 100644
--- a/SCons/Tool/ninja/NinjaState.py
+++ b/SCons/Tool/ninja/NinjaState.py
@@ -821,6 +821,15 @@ class SConsToNinjaTranslator:
# Remove all preceding and proceeding whitespace
cmdline = cmdline.strip()
+ env = node.env if node.env else self.env
+ executor = node.get_executor()
+ if executor is not None:
+ targets = executor.get_all_targets()
+ else:
+ if hasattr(node, "target_peers"):
+ targets = node.target_peers
+ else:
+ targets = [node]
# Make sure we didn't generate an empty cmdline
if cmdline:
@@ -829,7 +838,7 @@ class SConsToNinjaTranslator:
"rule": get_rule(node, "GENERATED_CMD"),
"variables": {
"cmd": cmdline,
- "env": get_command_env(node.env if node.env else self.env),
+ "env": get_command_env(env, targets, node.sources),
},
"implicit": dependencies,
}
diff --git a/SCons/Tool/ninja/Utils.py b/SCons/Tool/ninja/Utils.py
index c5f7ee4..b2c3cd3 100644
--- a/SCons/Tool/ninja/Utils.py
+++ b/SCons/Tool/ninja/Utils.py
@@ -262,7 +262,7 @@ def ninja_noop(*_args, **_kwargs):
return None
-def get_command_env(env):
+def get_command_env(env, target, source):
"""
Return a string that sets the environment for any environment variables that
differ between the OS environment and the SCons command ENV.
@@ -278,7 +278,7 @@ def get_command_env(env):
# os.environ or differ from it. We assume if it's a new or
# differing key from the process environment then it's
# important to pass down to commands in the Ninja file.
- ENV = get_default_ENV(env)
+ ENV = SCons.Action._resolve_shell_env(env, target, source)
scons_specified_env = {
key: value
for key, value in ENV.items()
diff --git a/SCons/Tool/swig.xml b/SCons/Tool/swig.xml
index 19ec21f..a6d85ce 100644
--- a/SCons/Tool/swig.xml
+++ b/SCons/Tool/swig.xml
@@ -26,7 +26,7 @@ See its __doc__ string for a discussion of the format.
<tool name="swig">
<summary>
<para>
-Sets construction variables for the SWIG interface generator.
+Sets construction variables for the &swig; interface compiler.
</para>
</summary>
<sets>
@@ -50,7 +50,7 @@ Sets construction variables for the SWIG interface generator.
<cvar name="SWIG">
<summary>
<para>
-The scripting language wrapper and interface generator.
+The name of the &swig; compiler to use.
</para>
</summary>
</cvar>
@@ -59,10 +59,11 @@ The scripting language wrapper and interface generator.
<summary>
<para>
The suffix that will be used for intermediate C
-source files generated by
-the scripting language wrapper and interface generator.
-The default value is
-<filename>_wrap</filename>&cv-link-CFILESUFFIX;.
+source files generated by &swig;.
+The default value is <literal>'_wrap$CFILESUFFIX'</literal> -
+that is, the concatenation of the string
+<literal>_wrap</literal>
+and the current C suffix &cv-link-CFILESUFFIX;.
By default, this value is used whenever the
<option>-c++</option>
option is
@@ -78,8 +79,8 @@ construction variable.
<summary>
<para>
The suffix that will be used for intermediate C++ header
-files generated by the scripting language wrapper and interface generator.
-These are only generated for C++ code when the SWIG 'directors' feature is
+files generated by &swig;.
+These are only generated for C++ code when the &swig; 'directors' feature is
turned on.
The default value is
<filename>_wrap.h</filename>.
@@ -90,8 +91,7 @@ The default value is
<cvar name="SWIGCOM">
<summary>
<para>
-The command line used to call
-the scripting language wrapper and interface generator.
+The command line used to call &swig;.
</para>
</summary>
</cvar>
@@ -99,8 +99,7 @@ the scripting language wrapper and interface generator.
<cvar name="SWIGCOMSTR">
<summary>
<para>
-The string displayed when calling
-the scripting language wrapper and interface generator.
+The string displayed when calling &swig;.
If this is not set, then &cv-link-SWIGCOM; (the command line) is displayed.
</para>
</summary>
@@ -110,12 +109,13 @@ If this is not set, then &cv-link-SWIGCOM; (the command line) is displayed.
<summary>
<para>
The suffix that will be used for intermediate C++
-source files generated by
-the scripting language wrapper and interface generator.
-The default value is
-<filename>_wrap</filename>&cv-link-CFILESUFFIX;.
+source files generated by &swig;.
+The default value is <literal>'_wrap$CXXFILESUFFIX'</literal> -
+that is, the concatenation of the string
+<literal>_wrap</literal>
+and the current C++ suffix &cv-link-CXXFILESUFFIX;.
By default, this value is used whenever the
-<filename>-c++</filename>
+<option>-c++</option>
option is specified as part of the
&cv-link-SWIGFLAGS;
construction variable.
@@ -126,22 +126,14 @@ construction variable.
<cvar name="SWIGFLAGS">
<summary>
<para>
-General options passed to
-the scripting language wrapper and interface generator.
-This is where you should set
-<option>-python</option>,
+General options passed to &swig;.
+This is where you should set the target language
+(<option>-python</option>,
<option>-perl5</option>,
-<option>-tcl</option>,
-or whatever other options you want to specify to SWIG.
-If you set the
-<option>-c++</option>
-option in this variable,
-&scons;
-will, by default,
-generate a C++ intermediate source file
-with the extension that is specified as the
-&cv-link-CXXFILESUFFIX;
-variable.
+<option>-tcl</option>, etc.)
+and whatever other options you want to specify to &swig;,
+such as the <option>-c++</option> to generate C++ code
+instead of C Code.
</para>
</summary>
</cvar>
@@ -150,7 +142,7 @@ variable.
<summary>
<para>
An automatically-generated construction variable
-containing the SWIG command-line options
+containing the &swig; command-line options
for specifying directories to be searched for included files.
The value of &cv-_SWIGINCFLAGS; is created
by respectively prepending and appending
@@ -164,7 +156,7 @@ of each directory in &cv-SWIGPATH;.
<cvar name="SWIGINCPREFIX">
<summary>
<para>
-The prefix used to specify an include directory on the SWIG command line.
+The prefix used to specify an include directory on the &swig; command line.
This will be prepended to the beginning of each directory
in the &cv-SWIGPATH; construction variable
when the &cv-_SWIGINCFLAGS; variable is automatically generated.
@@ -175,7 +167,7 @@ when the &cv-_SWIGINCFLAGS; variable is automatically generated.
<cvar name="SWIGINCSUFFIX">
<summary>
<para>
-The suffix used to specify an include directory on the SWIG command line.
+The suffix used to specify an include directory on the &swig; command line.
This will be appended to the end of each directory
in the &cv-SWIGPATH; construction variable
when the &cv-_SWIGINCFLAGS; variable is automatically generated.
@@ -186,8 +178,7 @@ when the &cv-_SWIGINCFLAGS; variable is automatically generated.
<cvar name="SWIGOUTDIR">
<summary>
<para>
-Specifies the output directory in which
-the scripting language wrapper and interface generator
+Specifies the output directory in which &swig;
should place generated language-specific files.
This will be used by SCons to identify
the files that will be generated by the &swig; call,
@@ -200,22 +191,24 @@ and translated into the
<cvar name="SWIGPATH">
<summary>
<para>
-The list of directories that the scripting language wrapper
-and interface generate will search for included files.
-The SWIG implicit dependency scanner will search these
+The list of directories that &swig;
+will search for included files.
+&SCons;' SWIG implicit dependency scanner will search these
directories for include files. The default value is an empty list.
</para>
<para>
Don't explicitly put include directory
-arguments in SWIGFLAGS;
+arguments in &cv-link-SWIGFLAGS;
the result will be non-portable
and the directories will not be searched by the dependency scanner.
-Note: directory names in SWIGPATH will be looked-up relative to the SConscript
+Note: directory names in &cv-link-SWIGPATH;
+will be looked-up relative to the SConscript
directory when they are used in a command.
To force
&scons;
-to look-up a directory relative to the root of the source tree use #:
+to look-up a directory relative to the root of the source tree use
+a top-relative path (<literal>#</literal>):
</para>
<example_commands>
@@ -258,7 +251,7 @@ env = Environment(SWIGCOM="my_swig -o $TARGET $_SWIGINCFLAGS $SOURCES")
<cvar name="SWIGVERSION">
<summary>
<para>
-The version number of the SWIG tool.
+The detected version string of the &swig; tool.
</para>
</summary>
</cvar>
diff --git a/SCons/cppTests.py b/SCons/cppTests.py
index a9aef9d..f20c302 100644
--- a/SCons/cppTests.py
+++ b/SCons/cppTests.py
@@ -876,7 +876,9 @@ if __name__ == '__main__':
fileTestCase,
]
for tclass in tclasses:
- names = unittest.getTestCaseNames(tclass, 'test_')
+ loader = unittest.TestLoader()
+ loader.testMethodPrefix = 'test_'
+ names = loader.getTestCaseNames(tclass)
try:
names = sorted(set(names))
except NameError: