diff options
author | Adam Gross <grossag@gmail.com> | 2019-10-22 14:50:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-22 14:50:02 (GMT) |
commit | 49403a2d8484f9d464ac194a625a5feae3e9430b (patch) | |
tree | 85692e27346aa4da5f9cb82f3df54dc8ebe3de8a /src/engine/SCons | |
parent | 2acdea49024d1be045c841f314a31fd67b1b20a0 (diff) | |
parent | c6ca3bdd2ad8e9a6ceea398934d84def9ba7c497 (diff) | |
download | SCons-49403a2d8484f9d464ac194a625a5feae3e9430b.zip SCons-49403a2d8484f9d464ac194a625a5feae3e9430b.tar.gz SCons-49403a2d8484f9d464ac194a625a5feae3e9430b.tar.bz2 |
Merge pull request #2 from SCons/master
Fast forward master
Diffstat (limited to 'src/engine/SCons')
31 files changed, 907 insertions, 1539 deletions
diff --git a/src/engine/SCons/CacheDir.py b/src/engine/SCons/CacheDir.py index 704b9a5..10c088d 100644 --- a/src/engine/SCons/CacheDir.py +++ b/src/engine/SCons/CacheDir.py @@ -33,6 +33,7 @@ import os import stat import sys +import SCons import SCons.Action import SCons.Warnings from SCons.Util import PY3 @@ -185,7 +186,7 @@ class CacheDir(object): pass except OSError: msg = "Failed to create cache directory " + path - raise SCons.Errors.EnvironmentError(msg) + raise SCons.Errors.SConsEnvironmentError(msg) try: with open(config_file, 'x') as config: @@ -194,14 +195,14 @@ class CacheDir(object): json.dump(self.config, config) except Exception: msg = "Failed to write cache configuration for " + path - raise SCons.Errors.EnvironmentError(msg) + raise SCons.Errors.SConsEnvironmentError(msg) except FileExistsError: try: with open(config_file) as config: self.config = json.load(config) except ValueError: msg = "Failed to read cache configuration for " + path - raise SCons.Errors.EnvironmentError(msg) + raise SCons.Errors.SConsEnvironmentError(msg) def _readconfig2(self, path): diff --git a/src/engine/SCons/CacheDirTests.py b/src/engine/SCons/CacheDirTests.py index ef87746..07c32b4 100644 --- a/src/engine/SCons/CacheDirTests.py +++ b/src/engine/SCons/CacheDirTests.py @@ -27,10 +27,13 @@ import os.path import shutil import sys import unittest +import tempfile +import stat from TestCmd import TestCmd import SCons.CacheDir +from SCons.Util import PY3 built_it = None @@ -112,6 +115,84 @@ class CacheDirTestCase(BaseTestCase): finally: SCons.Util.MD5collect = save_collect +class ExceptionTestCase(unittest.TestCase): + """Test that the correct exceptions are thrown by CacheDir.""" + + # Don't inherit from BaseTestCase, we're by definition trying to + # break things so we really want a clean slate for each test. + def setUp(self): + self.tmpdir = tempfile.mkdtemp() + self._CacheDir = SCons.CacheDir.CacheDir(self.tmpdir) + + def tearDown(self): + shutil.rmtree(self.tmpdir) + + @unittest.skipIf(sys.platform.startswith("win"), "This fixture will not trigger an OSError on Windows") + def test_throws_correct_on_OSError(self): + """Test that the correct error is thrown when cache directory cannot be created.""" + privileged_dir = os.path.join(os.getcwd(), "privileged") + try: + os.mkdir(privileged_dir) + os.chmod(privileged_dir, stat.S_IREAD) + cd = SCons.CacheDir.CacheDir(os.path.join(privileged_dir, "cache")) + assert False, "Should have raised exception and did not" + except SCons.Errors.SConsEnvironmentError as e: + assert str(e) == "Failed to create cache directory {}".format(os.path.join(privileged_dir, "cache")) + finally: + os.chmod(privileged_dir, stat.S_IWRITE | stat.S_IEXEC | stat.S_IREAD) + shutil.rmtree(privileged_dir) + + + def test_throws_correct_when_failed_to_write_configfile(self): + class Unserializable: + """A class which the JSON should not be able to serialize""" + + def __init__(self, oldconfig): + self.something = 1 # Make the object unserializable + # Pretend to be the old config just enough + self.__dict__["prefix_len"] = oldconfig["prefix_len"] + + def __getitem__(self, name, default=None): + if name == "prefix_len": + return self.__dict__["prefix_len"] + else: + return None + + def __setitem__(self, name, value): + self.__dict__[name] = value + + oldconfig = self._CacheDir.config + self._CacheDir.config = Unserializable(oldconfig) + # Remove the config file that got created on object creation + # so that _readconfig* will try to rewrite it + old_config = os.path.join(self._CacheDir.path, "config") + os.remove(old_config) + + try: + if PY3: + self._CacheDir._readconfig3(self._CacheDir.path) + else: + self._CacheDir._readconfig2(self._CacheDir.path) + assert False, "Should have raised exception and did not" + except SCons.Errors.SConsEnvironmentError as e: + assert str(e) == "Failed to write cache configuration for {}".format(self._CacheDir.path) + + def test_raise_environment_error_on_invalid_json(self): + config_file = os.path.join(self._CacheDir.path, "config") + with open(config_file, "r") as cfg: + content = cfg.read() + # This will make JSON load raise a ValueError + content += "{}" + with open(config_file, "w") as cfg: + cfg.write(content) + + try: + # Construct a new cache dir that will try to read the invalid config + new_cache_dir = SCons.CacheDir.CacheDir(self._CacheDir.path) + assert False, "Should have raised exception and did not" + except SCons.Errors.SConsEnvironmentError as e: + assert str(e) == "Failed to read cache configuration for {}".format(self._CacheDir.path) + class FileTestCase(BaseTestCase): """ Test calling CacheDir code through Node.FS.File interfaces. diff --git a/src/engine/SCons/Conftest.py b/src/engine/SCons/Conftest.py index 1163aa3..c24adf8 100644 --- a/src/engine/SCons/Conftest.py +++ b/src/engine/SCons/Conftest.py @@ -290,6 +290,10 @@ char %s();""" % function_name #include <assert.h> %(hdr)s +#if _MSC_VER && !__INTEL_COMPILER + #pragma function(%(name)s) +#endif + int main(void) { #if defined (__stub_%(name)s) || defined (__stub___%(name)s) fail fail fail diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 8d06af7..0e1102e 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -46,7 +46,7 @@ import SCons.Builder import SCons.Debug from SCons.Debug import logInstanceCreation import SCons.Defaults -import SCons.Errors +from SCons.Errors import UserError, BuildError import SCons.Memoize import SCons.Node import SCons.Node.Alias @@ -75,11 +75,6 @@ CalculatorArgs = {} semi_deepcopy = SCons.Util.semi_deepcopy semi_deepcopy_dict = SCons.Util.semi_deepcopy_dict -# Pull UserError into the global name space for the benefit of -# Environment().SourceSignatures(), which has some import statements -# which seem to mess up its ability to reference SCons directly. -UserError = SCons.Errors.UserError - def alias_builder(env, target, source): pass @@ -154,7 +149,7 @@ def _set_BUILDERS(env, key, value): env._dict[key] = bd for k, v in value.items(): if not SCons.Builder.is_a_Builder(v): - raise SCons.Errors.UserError('%s is not a Builder.' % repr(v)) + raise UserError('%s is not a Builder.' % repr(v)) bd.update(value) def _del_SCANNERS(env, key): @@ -431,7 +426,7 @@ class SubstitutionEnvironment(object): # efficient than calling another function or a method. if key not in self._dict \ and not _is_valid_var.match(key): - raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + raise UserError("Illegal construction variable `%s'" % key) self._dict[key] = value def get(self, key, default=None): @@ -783,13 +778,14 @@ class SubstitutionEnvironment(object): elif arg in ['-mno-cygwin', '-pthread', '-openmp', + '-fmerge-all-constants', '-fopenmp']: dict['CCFLAGS'].append(arg) dict['LINKFLAGS'].append(arg) elif arg == '-mwindows': dict['LINKFLAGS'].append(arg) elif arg[:5] == '-std=': - if arg[5:].find('++')!=-1: + if '++' in arg[5:]: key='CXXFLAGS' else: key='CFLAGS' @@ -1492,8 +1488,14 @@ class Base(SubstitutionEnvironment): self.copy_from_cache = copy_function + def Detect(self, progs): """Return the first available program in progs. + + :param progs: one or more command names to check for + :type progs: str or list + :returns str: first name from progs that can be found. + """ if not SCons.Util.is_List(progs): progs = [ progs ] @@ -1502,7 +1504,17 @@ class Base(SubstitutionEnvironment): if path: return prog return None + def Dictionary(self, *args): + """Return construction variables from an environment. + + :param *args: (optional) variable names to look up + :returns: if args omitted, the dictionary of all constr. vars. + If one arg, the corresponding value is returned. + If more than one arg, a list of values is returned. + :raises KeyError: if any of *args is not in the construction env. + + """ if not args: return self._dict dlist = [self._dict[x] for x in args] @@ -1510,23 +1522,28 @@ class Base(SubstitutionEnvironment): dlist = dlist[0] return dlist - def Dump(self, key = None): - """ - Using the standard Python pretty printer, return the contents of the - scons build environment as a string. - If the key passed in is anything other than None, then that will - be used as an index into the build environment dictionary and - whatever is found there will be fed into the pretty printer. Note - that this key is case sensitive. + def Dump(self, key=None): + """ Return pretty-printed string of construction variables. + + :param key: if None, format the whole dict of variables. + Else look up and format just the value for key. + """ import pprint pp = pprint.PrettyPrinter(indent=2) if key: - dict = self.Dictionary(key) + cvars = self.Dictionary(key) else: - dict = self.Dictionary() - return pp.pformat(dict) + cvars = self.Dictionary() + + # TODO: pprint doesn't do a nice job on path-style values + # if the paths contain spaces (i.e. Windows), because the + # algorithm tries to break lines on spaces, while breaking + # on the path-separator would be more "natural". Is there + # a better way to format those? + return pp.pformat(cvars) + def FindIxes(self, paths, prefix, suffix): """ @@ -1599,7 +1616,7 @@ class Base(SubstitutionEnvironment): for td in tdlist: targets.extend(td[0]) if len(targets) > 1: - raise SCons.Errors.UserError( + raise UserError( "More than one dependency target found in `%s': %s" % (filename, targets)) for target, depends in tdlist: @@ -2038,7 +2055,7 @@ class Base(SubstitutionEnvironment): """ action = self.Action(action, *args, **kw) result = action([], [], self) - if isinstance(result, SCons.Errors.BuildError): + if isinstance(result, BuildError): errstr = result.errstr if result.filename: errstr = result.filename + ': ' + errstr @@ -2158,7 +2175,7 @@ class Base(SubstitutionEnvironment): for side_effect in side_effects: if side_effect.multiple_side_effect_has_builder(): - raise SCons.Errors.UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect)) + raise UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect)) side_effect.add_source(targets) side_effect.side_effect = 1 self.Precious(side_effect) @@ -2176,24 +2193,6 @@ class Base(SubstitutionEnvironment): entry.set_src_builder(builder) return entries - def SourceSignatures(self, type): - global _warn_source_signatures_deprecated - if _warn_source_signatures_deprecated: - msg = "The env.SourceSignatures() method is deprecated;\n" + \ - "\tconvert your build to use the env.Decider() method instead." - SCons.Warnings.warn(SCons.Warnings.DeprecatedSourceSignaturesWarning, msg) - _warn_source_signatures_deprecated = False - type = self.subst(type) - self.src_sig_type = type - if type == 'MD5': - if not SCons.Util.md5: - raise UserError("MD5 signatures are not available in this version of Python.") - self.decide_source = self._changed_content - elif type == 'timestamp': - self.decide_source = self._changed_timestamp_match - else: - raise UserError("Unknown source signature type '%s'" % type) - def Split(self, arg): """This function converts a string or list into a list of strings or Nodes. This makes things easier for users by allowing files to @@ -2215,28 +2214,6 @@ class Base(SubstitutionEnvironment): else: return [self.subst(arg)] - def TargetSignatures(self, type): - global _warn_target_signatures_deprecated - if _warn_target_signatures_deprecated: - msg = "The env.TargetSignatures() method is deprecated;\n" + \ - "\tconvert your build to use the env.Decider() method instead." - SCons.Warnings.warn(SCons.Warnings.DeprecatedTargetSignaturesWarning, msg) - _warn_target_signatures_deprecated = False - type = self.subst(type) - self.tgt_sig_type = type - if type in ('MD5', 'content'): - if not SCons.Util.md5: - raise UserError("MD5 signatures are not available in this version of Python.") - self.decide_target = self._changed_content - elif type == 'timestamp': - self.decide_target = self._changed_timestamp_match - elif type == 'build': - self.decide_target = self._changed_build - elif type == 'source': - self.decide_target = self._changed_source - else: - raise UserError("Unknown target signature type '%s'"%type) - def Value(self, value, built_value=None): """ """ @@ -2321,7 +2298,7 @@ class OverrideEnvironment(Base): return attr.clone(self) else: return attr - + def __setattr__(self, name, value): setattr(self.__dict__['__subject'], name, value) @@ -2333,7 +2310,7 @@ class OverrideEnvironment(Base): return self.__dict__['__subject'].__getitem__(key) def __setitem__(self, key, value): if not is_valid_construction_var(key): - raise SCons.Errors.UserError("Illegal construction variable `%s'" % key) + raise UserError("Illegal construction variable `%s'" % key) self.__dict__['overrides'][key] = value def __delitem__(self, key): try: diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml index 1b0a04c..829bf12 100644 --- a/src/engine/SCons/Environment.xml +++ b/src/engine/SCons/Environment.xml @@ -148,9 +148,9 @@ appending to this list, although the more flexible approach is to associate scanners with a specific Builder. -See the sections "Builder Objects" -and "Scanner Objects," -below, for more information. +See the manpage sections "Builder Objects" +and "Scanner Objects" +for more information. </para> </summary> </cvar> @@ -160,7 +160,8 @@ below, for more information. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -170,7 +171,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -180,7 +182,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -190,7 +193,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -200,7 +204,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -210,7 +215,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -220,7 +226,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -230,7 +237,8 @@ that may not be set or used in a construction environment. <para> A reserved variable name that may not be set or used in a construction environment. -(See "Variable Substitution," below.) +(See the manpage section "Variable Substitution" +for more information). </para> </summary> </cvar> @@ -255,8 +263,8 @@ that are part of this construction environment. Creates an Action object for the specified <varname>action</varname>. -See the section "Action Objects," -below, for a complete explanation of the arguments and behavior. +See the manpage section "Action Objects" +for a complete explanation of the arguments and behavior. </para> <para> @@ -359,7 +367,8 @@ has been built. The specified action(s) may be an Action object, or anything that can be converted into an Action object -(see below). +See the manpage section "Action Objects" +for a complete explanation. </para> <para> @@ -386,7 +395,8 @@ is built. The specified action(s) may be an Action object, or anything that can be converted into an Action object -(see below). +See the manpage section "Action Objects" +for a complete explanation. </para> <para> @@ -512,7 +522,7 @@ Otherwise, the construction variable and the value of the keyword argument are both coerced to lists, and the lists are added together. -(See also the Prepend method, below.) +(See also the &Prepend; method). </para> <para> @@ -634,8 +644,8 @@ or Creates a Builder object for the specified <varname>action</varname>. -See the section "Builder Objects," -below, for a complete explanation of the arguments and behavior. +See the manpage section "Builder Objects" +for a complete explanation of the arguments and behavior. </para> <para> @@ -898,11 +908,15 @@ wx_env = env.Clone(parse_flags='!wx-config --cflags --cxxflags') <builder name="Command"> <summary> <para> -The &b-Command; "Builder" is actually implemented -as a function that looks like a Builder, -but actually takes an additional argument of the action -from which the Builder should be made. -See the &f-link-Command; function description +The &b-Command; "Builder" is actually +a function that looks like a Builder, +but takes a required third argument, which is the +action to take to construct the target +from the source, used for "one-off" builds +where a full builder is not needed. +Thus it does not follow the builder +calling rules described at the start of this section. +See instead the &f-link-Command; function description for the calling syntax and details. </para> </summary> @@ -947,7 +961,7 @@ same-named existing construction variables. An action can be an external command, specified as a string, or a callable Python object; -see "Action Objects," below, +see the manpage section "Action Objects" for more complete information. Also note that a string specifying an external command may be preceded by an @@ -971,7 +985,7 @@ env.Command('foo.out', 'foo.in', env.Command('bar.out', 'bar.in', ["rm -f $TARGET", "$BAR_BUILD < $SOURCES > $TARGET"], - ENV = {'PATH' : '/usr/local/bin/'}) + ENV={'PATH': '/usr/local/bin/'}) def rename(env, target, source): import os @@ -979,7 +993,7 @@ def rename(env, target, source): env.Command('baz.out', 'baz.in', ["$BAZ_BUILD < $SOURCES > .tmp", - rename ]) + rename]) </example_commands> <para> @@ -988,14 +1002,14 @@ Note that the function will usually assume, by default, that the specified targets and/or sources are Files, if no other part of the configuration -identifies what type of entry it is. +identifies what type of entries they are. If necessary, you can explicitly specify that targets or source nodes should -be treated as directoriese +be treated as directories by using the &f-link-Dir; or -<function>env.Dir</function>() +<function>env.Dir</function> functions. </para> @@ -1011,9 +1025,9 @@ env.Command(env.Dir('$DISTDIR')), None, make_distdir) </example_commands> <para> -(Also note that SCons will usually +Also note that SCons will usually automatically create any directory necessary to hold a target file, -so you normally don't need to create directories by hand.) +so you normally don't need to create directories by hand. </para> </summary> </scons_function> @@ -1029,8 +1043,8 @@ so you normally don't need to create directories by hand.) <para> Creates a Configure object for integrated functionality similar to GNU autoconf. -See the section "Configure Contexts," -below, for a complete explanation of the arguments and behavior. +See the manpage section "Configure Contexts" +for a complete explanation of the arguments and behavior. </para> </summary> </scons_function> @@ -1325,11 +1339,11 @@ env.Depends(bar, installed_lib) <summary> <para> Returns a dictionary object -containing copies of all of the -construction variables in the environment. -If there are any variable names specified, -only the specified construction -variables are returned in the dictionary. +containing the &consvars; in the &consenv;. +If there are any arguments specified, +the values of the specified &consvars; +are returned as a string (if one +argument) or as a list of strings. </para> <para> @@ -1337,8 +1351,8 @@ Example: </para> <example_commands> -dict = env.Dictionary() -cc_dict = env.Dictionary('CC', 'CCFLAGS', 'CCCOM') +cvars = env.Dictionary() +cc_values = env.Dictionary('CC', 'CCFLAGS', 'CCCOM') </example_commands> </summary> </scons_function> @@ -1375,7 +1389,8 @@ would supply a string as a directory name to a Builder method or function. Directory Nodes have attributes and methods that are useful in many situations; -see "File and Directory Nodes," below. +see manpage section "File and Directory Nodes" +for more information. </para> </summary> </scons_function> @@ -1458,8 +1473,8 @@ Executes an Action object. The specified <varname>action</varname> may be an Action object -(see the section "Action Objects," -below, for a complete explanation of the arguments and behavior), +(see manpage section "Action Objects" +for a complete explanation of the arguments and behavior), or it may be a command-line string, list of commands, or executable Python function, @@ -1532,7 +1547,8 @@ would supply a string as a file name to a Builder method or function. File Nodes have attributes and methods that are useful in many situations; -see "File and Directory Nodes," below. +see manpage section "File and Directory Nodes" +for more information. </para> </summary> </scons_function> @@ -2190,7 +2206,7 @@ and the construction variables they affect are as specified for the &f-link-env-ParseFlags; method (which this method calls). -See that method's description, below, +See that method's description for a table of options and construction variables. </para> </summary> @@ -2301,30 +2317,33 @@ and added to the following construction variables: </para> <example_commands> --arch CCFLAGS, LINKFLAGS --D CPPDEFINES --framework FRAMEWORKS --frameworkdir= FRAMEWORKPATH --include CCFLAGS --isysroot CCFLAGS, LINKFLAGS --isystem CCFLAGS --iquote CCFLAGS --idirafter CCFLAGS --I CPPPATH --l LIBS --L LIBPATH --mno-cygwin CCFLAGS, LINKFLAGS --mwindows LINKFLAGS --pthread CCFLAGS, LINKFLAGS --std= CFLAGS --Wa, ASFLAGS, CCFLAGS --Wl,-rpath= RPATH --Wl,-R, RPATH --Wl,-R RPATH --Wl, LINKFLAGS --Wp, CPPFLAGS -- CCFLAGS -+ CCFLAGS, LINKFLAGS +-arch CCFLAGS, LINKFLAGS +-D CPPDEFINES +-framework FRAMEWORKS +-frameworkdir= FRAMEWORKPATH +-fmerge-all-constants CCFLAGS, LINKFLAGS +-fopenmp CCFLAGS, LINKFLAGS +-include CCFLAGS +-isysroot CCFLAGS, LINKFLAGS +-isystem CCFLAGS +-iquote CCFLAGS +-idirafter CCFLAGS +-I CPPPATH +-l LIBS +-L LIBPATH +-mno-cygwin CCFLAGS, LINKFLAGS +-mwindows LINKFLAGS +-openmp CCFLAGS, LINKFLAGS +-pthread CCFLAGS, LINKFLAGS +-std= CFLAGS +-Wa, ASFLAGS, CCFLAGS +-Wl,-rpath= RPATH +-Wl,-R, RPATH +-Wl,-R RPATH +-Wl, LINKFLAGS +-Wp, CPPFLAGS +- CCFLAGS ++ CCFLAGS, LINKFLAGS </example_commands> <para> @@ -2655,8 +2674,8 @@ env.Requires('foo', 'file-that-must-be-built-before-foo') Creates a Scanner object for the specified <varname>function</varname>. -See the section "Scanner Objects," -below, for a complete explanation of the arguments and behavior. +See manpage section "Scanner Objects" +for a complete explanation of the arguments and behavior. </para> </summary> </scons_function> @@ -2968,105 +2987,6 @@ env.SourceCode('no_source.c', None) </summary> </scons_function> -<scons_function name="SourceSignatures"> -<arguments> -(type) -</arguments> -<summary> -<para> -Note: Although it is not yet officially deprecated, -use of this function is discouraged. -See the -&f-link-Decider; -function for a more flexible and straightforward way -to configure SCons' decision-making. -</para> - -<para> -The -&f-SourceSignatures; -function tells -&scons; -how to decide if a source file -(a file that is not built from any other files) -has changed since the last time it -was used to build a particular target file. -Legal values are -<literal>MD5</literal> -or -<literal>timestamp</literal>. -</para> - -<para> -If the environment method is used, -the specified type of source signature -is only used when deciding whether targets -built with that environment are up-to-date or must be rebuilt. -If the global function is used, -the specified type of source signature becomes the default -used for all decisions -about whether targets are up-to-date. -</para> - -<para> -<literal>MD5</literal> -means -&scons; -decides that a source file has changed -if the MD5 checksum of its contents has changed since -the last time it was used to rebuild a particular target file. -</para> - -<para> -<literal>timestamp</literal> -means -&scons; -decides that a source file has changed -if its timestamp (modification time) has changed since -the last time it was used to rebuild a particular target file. -(Note that although this is similar to the behavior of Make, -by default it will also rebuild if the dependency is -<emphasis>older</emphasis> -than the last time it was used to rebuild the target file.) -</para> - -<para> -There is no different between the two behaviors -for Python -&f-Value; -node objects. -</para> - -<para> -<literal>MD5</literal> -signatures take longer to compute, -but are more accurate than -<literal>timestamp</literal> -signatures. -The default value is -<literal>MD5</literal>. -</para> - -<para> -Note that the default -&f-link-TargetSignatures; -setting (see below) -is to use this -&f-SourceSignatures; -setting for any target files that are used -to build other target files. -Consequently, changing the value of -&f-SourceSignatures; -will, by default, -affect the up-to-date decision for all files in the build -(or all files built with a specific construction environment -when -&f-env-SourceSignatures; -is used). -</para> -</summary> -</scons_function> - <scons_function name="Split"> <arguments> (arg) @@ -3210,159 +3130,6 @@ source_nodes = env.subst('$EXPAND_TO_NODELIST', </summary> </scons_function> -<scons_function name="TargetSignatures"> -<arguments> -(type) -</arguments> -<summary> -<para> -Note: Although it is not yet officially deprecated, -use of this function is discouraged. -See the -&f-link-Decider; -function for a more flexible and straightforward way -to configure SCons' decision-making. -</para> - -<para> -The -&f-TargetSignatures; -function tells -&scons; -how to decide if a target file -(a file that -<emphasis>is</emphasis> -built from any other files) -has changed since the last time it -was used to build some other target file. -Legal values are -<literal>"build"</literal>; -<literal>"content"</literal> -(or its synonym -<literal>"MD5"</literal>); -<literal>"timestamp"</literal>; -or -<literal>"source"</literal>. -</para> - -<para> -If the environment method is used, -the specified type of target signature is only used -for targets built with that environment. -If the global function is used, -the specified type of signature becomes the default -used for all target files that -don't have an explicit target signature type -specified for their environments. -</para> - -<para> -<literal>"content"</literal> -(or its synonym -<literal>"MD5"</literal>) -means -&scons; -decides that a target file has changed -if the MD5 checksum of its contents has changed since -the last time it was used to rebuild some other target file. -This means -&scons; -will open up -MD5 sum the contents -of target files after they're built, -and may decide that it does not need to rebuild -"downstream" target files if a file was -rebuilt with exactly the same contents as the last time. -</para> - -<para> -<literal>"timestamp"</literal> -means -&scons; -decides that a target file has changed -if its timestamp (modification time) has changed since -the last time it was used to rebuild some other target file. -(Note that although this is similar to the behavior of Make, -by default it will also rebuild if the dependency is -<emphasis>older</emphasis> -than the last time it was used to rebuild the target file.) -</para> - -<para> -<literal>"source"</literal> -means -&scons; -decides that a target file has changed -as specified by the corresponding -&f-SourceSignatures; -setting -(<literal>"MD5"</literal> -or -<literal>"timestamp"</literal>). -This means that -&scons; -will treat all input files to a target the same way, -regardless of whether they are source files -or have been built from other files. -</para> - -<para> -<literal>"build"</literal> -means -&scons; -decides that a target file has changed -if it has been rebuilt in this invocation -or if its content or timestamp have changed -as specified by the corresponding -&f-SourceSignatures; -setting. -This "propagates" the status of a rebuilt file -so that other "downstream" target files -will always be rebuilt, -even if the contents or the timestamp -have not changed. -</para> - -<para> -<literal>"build"</literal> -signatures are fastest because -<literal>"content"</literal> -(or -<literal>"MD5"</literal>) -signatures take longer to compute, -but are more accurate than -<literal>"timestamp"</literal> -signatures, -and can prevent unnecessary "downstream" rebuilds -when a target file is rebuilt to the exact same contents -as the previous build. -The -<literal>"source"</literal> -setting provides the most consistent behavior -when other target files may be rebuilt from -both source and target input files. -The default value is -<literal>"source"</literal>. -</para> - -<para> -Because the default setting is -<literal>"source"</literal>, -using -&f-SourceSignatures; -is generally preferable to -&f-TargetSignatures;, -so that the up-to-date decision -will be consistent for all files -(or all files built with a specific construction environment). -Use of -&f-TargetSignatures; -provides specific control for how built target files -affect their "downstream" dependencies. -</para> -</summary> -</scons_function> - <scons_function name="Tool"> <arguments> (string, [toolpath, **kw]) @@ -3647,30 +3414,51 @@ SConscript(dirs='doc', variant_dir='build/doc', duplicate=0) Searches for the specified executable <varname>program</varname>, returning the full path name to the program -if it is found, -and returning None if not. -Searches the specified -<varname>path</varname>, -the value of the calling environment's PATH -(<literal>env['ENV']['PATH']</literal>), -or the user's current external PATH -(<literal>os.environ['PATH']</literal>) -by default. +if it is found, else <literal>None</literal>. +Searches the value of the +<varname>path</varname> keyword argument, +or if <literal>None</literal> (the default) +the value of the calling environment's <envar>PATH</envar> +(<literal>env['ENV']['PATH']</literal>). +If <varname>path</varname> is <literal>None</literal> and +the <literal>env['ENV']['PATH']</literal> key does not exist, +the user's current external <envar>PATH</envar> +(<literal>os.environ['PATH']</literal>) is used as fallback. +</para> +<para> On Windows systems, searches for executable -programs with any of the file extensions -listed in the specified -<varname>pathext</varname>, -the calling environment's PATHEXT -(<literal>env['ENV']['PATHEXT']</literal>) -or the user's current PATHEXT +programs with any of the file extensions listed in the +<varname>pathext</varname> keyword argument, +or if <literal>None</literal> (the default) +the calling environment's <envar>PATHEXT</envar> +(<literal>env['ENV']['PATHEXT']</literal>). +The user's current external <envar>PATHEXT</envar> (<literal>os.environ['PATHEXT']</literal>) -by default. +is used as a fallback if <varname>pathext</varname> is +<literal>None</literal> +and the key <literal>env['ENV']['PATHEXT']</literal> +does not exist. +</para> +<para> Will not select any path name or names in the specified <varname>reject</varname> list, if any. </para> +<note> +<para> +If you would prefer to search +the user's current external <envar>PATH</envar> +(<literal>os.environ['PATH']</literal>) +by default, +consider using the function <literal>SCons.Util.WhereIs</literal> instead. +Note that <literal>SCons.Util.WhereIs</literal> +does not expand environment variables automatically +(no implicit <literal>env.subst</literal> for its arguments). +</para> +</note> + </summary> </scons_function> diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 834cfd1..f016f22 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -797,6 +797,7 @@ sys.exit(0) "-F fwd3 " + \ "-dylib_file foo-dylib " + \ "-pthread " + \ + "-fmerge-all-constants " +\ "-fopenmp " + \ "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ @@ -811,7 +812,8 @@ sys.exit(0) assert d['ASFLAGS'] == ['-as'], d['ASFLAGS'] assert d['CFLAGS'] == ['-std=c99'] assert d['CCFLAGS'] == ['-X', '-Wa,-as', - '-pthread', '-fopenmp', '-mno-cygwin', + '-pthread', '-fmerge-all-constants', + '-fopenmp', '-mno-cygwin', ('-arch', 'i386'), ('-isysroot', '/tmp'), ('-iquote', '/usr/include/foo1'), ('-isystem', '/usr/include/foo2'), @@ -832,7 +834,7 @@ sys.exit(0) assert LIBS == ['xxx', 'yyy', 'ascend'], (d['LIBS'], LIBS) assert d['LINKFLAGS'] == ['-Wl,-link', '-dylib_file', 'foo-dylib', - '-pthread', '-fopenmp', + '-pthread', '-fmerge-all-constants', '-fopenmp', '-mno-cygwin', '-mwindows', ('-arch', 'i386'), ('-isysroot', '/tmp'), @@ -2024,6 +2026,7 @@ def generate(env): "-Ffwd2 " + \ "-F fwd3 " + \ "-pthread " + \ + "-fmerge-all-constants " + \ "-mno-cygwin -mwindows " + \ "-arch i386 -isysroot /tmp " + \ "-iquote /usr/include/foo1 " + \ @@ -2035,7 +2038,7 @@ def generate(env): assert save_command == ['fake command'], save_command assert env['ASFLAGS'] == ['assembler', '-as'], env['ASFLAGS'] assert env['CCFLAGS'] == ['', '-X', '-Wa,-as', - '-pthread', '-mno-cygwin', + '-pthread', '-fmerge-all-constants', '-mno-cygwin', ('-arch', 'i386'), ('-isysroot', '/tmp'), ('-iquote', '/usr/include/foo1'), ('-isystem', '/usr/include/foo2'), @@ -2049,6 +2052,7 @@ def generate(env): assert env['LIBPATH'] == ['list', '/usr/fax', 'foo'], env['LIBPATH'] assert env['LIBS'] == ['xxx', 'yyy', env.File('abc')], env['LIBS'] assert env['LINKFLAGS'] == ['', '-Wl,-link', '-pthread', + '-fmerge-all-constants', '-mno-cygwin', '-mwindows', ('-arch', 'i386'), ('-isysroot', '/tmp'), @@ -3280,44 +3284,6 @@ def generate(env): s = e.src_builder() assert s is None, s - def test_SourceSignatures(self): - """Test the SourceSignatures() method""" - import SCons.Errors - - env = self.TestEnvironment(M = 'MD5', T = 'timestamp') - - exc_caught = None - try: - env.SourceSignatures('invalid_type') - except SCons.Errors.UserError: - exc_caught = 1 - assert exc_caught, "did not catch expected UserError" - - env.SourceSignatures('MD5') - assert env.src_sig_type == 'MD5', env.src_sig_type - - env.SourceSignatures('$M') - assert env.src_sig_type == 'MD5', env.src_sig_type - - env.SourceSignatures('timestamp') - assert env.src_sig_type == 'timestamp', env.src_sig_type - - env.SourceSignatures('$T') - assert env.src_sig_type == 'timestamp', env.src_sig_type - - try: - import SCons.Util - save_md5 = SCons.Util.md5 - SCons.Util.md5 = None - try: - env.SourceSignatures('MD5') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - finally: - SCons.Util.md5 = save_md5 - def test_Split(self): """Test the Split() method""" env = self.TestEnvironment(FOO = 'fff', BAR = 'bbb') @@ -3334,56 +3300,6 @@ def generate(env): s = env.Split("$FOO$BAR") assert s == ["fffbbb"], s - def test_TargetSignatures(self): - """Test the TargetSignatures() method""" - import SCons.Errors - - env = self.TestEnvironment(B='build', C='content') - - exc_caught = None - try: - env.TargetSignatures('invalid_type') - except SCons.Errors.UserError: - exc_caught = 1 - assert exc_caught, "did not catch expected UserError" - assert not hasattr(env, '_build_signature') - - env.TargetSignatures('build') - assert env.tgt_sig_type == 'build', env.tgt_sig_type - - env.TargetSignatures('$B') - assert env.tgt_sig_type == 'build', env.tgt_sig_type - - env.TargetSignatures('content') - assert env.tgt_sig_type == 'content', env.tgt_sig_type - - env.TargetSignatures('$C') - assert env.tgt_sig_type == 'content', env.tgt_sig_type - - env.TargetSignatures('MD5') - assert env.tgt_sig_type == 'MD5', env.tgt_sig_type - - env.TargetSignatures('timestamp') - assert env.tgt_sig_type == 'timestamp', env.tgt_sig_type - - try: - import SCons.Util - save_md5 = SCons.Util.md5 - SCons.Util.md5 = None - try: - env.TargetSignatures('MD5') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - try: - env.TargetSignatures('content') - except SCons.Errors.UserError: - pass - else: - self.fail('Did not catch expected UserError') - finally: - SCons.Util.md5 = save_md5 def test_Value(self): """Test creating a Value() object @@ -3404,7 +3320,6 @@ def generate(env): assert v3.value == 'c', v3.value - def test_Environment_global_variable(self): """Test setting Environment variable to an Environment.Base subclass""" class MyEnv(SCons.Environment.Base): @@ -3746,8 +3661,6 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture): # Environment() # FindFile() # Scanner() - # SourceSignatures() - # TargetSignatures() # It's unlikely Clone() will ever be called this way, so let the # other methods test that handling overridden values works. diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 33105fb..6b0fe98 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -3436,6 +3436,8 @@ class File(Base): Boolean - Indicates if node(File) has changed. """ + if node is None: + node = self # Now get sconsign name -> csig map and then get proper prev_ni if possible bi = node.get_stored_info().binfo rebuilt = False diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 72eaba7..eddfdf0 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -2545,11 +2545,10 @@ class FileTestCase(_tempdirTestCase): def get_ninfo(self): """ mocked to ensure csig will equal the filename""" - try: - return self.ninfo - except AttributeError: - self.ninfo = FakeNodeInfo(self.name, self.timestamp) + if self.ninfo is not None: return self.ninfo + self.ninfo = FakeNodeInfo(self.name, self.timestamp) + return self.ninfo def get_csig(self): ninfo = self.get_ninfo() diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 3073d59..daf79ba 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -614,6 +614,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)): self._func_rexists = 1 self._func_get_contents = 0 self._func_target_from_source = 0 + self.ninfo = None self.clear_memoized_values() @@ -1131,11 +1132,10 @@ class Node(object, with_metaclass(NoSlotsPyPy)): return ninfo def get_ninfo(self): - try: - return self.ninfo - except AttributeError: - self.ninfo = self.new_ninfo() + if self.ninfo is not None: return self.ninfo + self.ninfo = self.new_ninfo() + return self.ninfo def new_binfo(self): binfo = self.BuildInfo() @@ -1661,10 +1661,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)): if k not in old_bkids: lines.append("`%s' is a new dependency\n" % stringify(k)) else: - try: - changed = _decider_map[k.changed_since_last_build](k, self, osig[k]) - except DeciderNeedsNode as e: - changed = e.decider(self, osig[k], node=self) + changed = _decider_map[k.changed_since_last_build](k, self, osig[k]) if changed: lines.append("`%s' changed\n" % stringify(k)) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index acc8678..58dbf64 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -75,6 +75,7 @@ print_objects = 0 print_memoizer = 0 print_stacktrace = 0 print_time = 0 +print_action_timestamps = 0 sconscript_time = 0 cumulative_command_time = 0 exit_status = 0 # final exit status, assume success by default @@ -209,7 +210,11 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask): finish_time = time.time() last_command_end = finish_time cumulative_command_time = cumulative_command_time+finish_time-start_time + if print_action_timestamps: + sys.stdout.write("Command execution start time: %s: %f seconds\n"%(str(self.node), start_time)) sys.stdout.write("Command execution time: %s: %f seconds\n"%(str(self.node), finish_time-start_time)) + if print_action_timestamps: + sys.stdout.write("Command execution stop time: %s: %f seconds\n"%(str(self.node), finish_time)) def do_failed(self, status=2): _BuildFailures.append(self.exception[1]) @@ -636,7 +641,7 @@ def _SConstruct_exists(dirname='', repositories=[], filelist=None): return None def _set_debug_values(options): - global print_memoizer, print_objects, print_stacktrace, print_time + global print_memoizer, print_objects, print_stacktrace, print_time, print_action_timestamps debug_values = options.debug @@ -674,6 +679,9 @@ def _set_debug_values(options): options.tree_printers.append(TreePrinter(status=True)) if "time" in debug_values: print_time = 1 + if "action_timestamps" in debug_values: + print_time = 1 + print_action_timestamps = 1 if "tree" in debug_values: options.tree_printers.append(TreePrinter()) if "prepare" in debug_values: diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py index c45cb01..7b5d523 100644 --- a/src/engine/SCons/Script/SConsOptions.py +++ b/src/engine/SCons/Script/SConsOptions.py @@ -584,9 +584,15 @@ def Parser(version): help="Print build actions for files from CacheDir.") def opt_invalid(group, value, options): + """report an invalid option from a group""" errmsg = "`%s' is not a valid %s option type, try:\n" % (value, group) return errmsg + " %s" % ", ".join(options) + def opt_invalid_rm(group, value, msg): + """report an invalid option from a group: recognized but removed""" + errmsg = "`%s' is not a valid %s option type " % (value, group) + return errmsg + msg + config_options = ["auto", "force" ,"cache"] opt_config_help = "Controls Configure subsystem: %s." \ @@ -604,9 +610,11 @@ def Parser(version): help="Search up directory tree for SConstruct, " "build all Default() targets.") - deprecated_debug_options = { + deprecated_debug_options = {} + + removed_debug_options = { "dtree" : '; please use --tree=derived instead', - "nomemoizer" : ' and has no effect', + "nomemoizer" : '; there is no replacement', "stree" : '; please use --tree=all,status instead', "tree" : '; please use --tree=all instead', } @@ -614,15 +622,16 @@ def Parser(version): debug_options = ["count", "duplicate", "explain", "findlibs", "includes", "memoizer", "memory", "objects", "pdb", "prepare", "presub", "stacktrace", - "time"] + "time", "action_timestamps"] def opt_debug(option, opt, value__, parser, debug_options=debug_options, - deprecated_debug_options=deprecated_debug_options): + deprecated_debug_options=deprecated_debug_options, + removed_debug_options=removed_debug_options): for value in value__.split(','): if value in debug_options: parser.values.debug.append(value) - elif value in list(deprecated_debug_options.keys()): + elif value in deprecated_debug_options: parser.values.debug.append(value) try: parser.values.delayed_warnings @@ -632,6 +641,9 @@ def Parser(version): w = "The --debug=%s option is deprecated%s." % (value, msg) t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w) parser.values.delayed_warnings.append(t) + elif value in removed_debug_options: + msg = removed_debug_options[value] + raise OptionValueError(opt_invalid_rm('debug', value, msg)) else: raise OptionValueError(opt_invalid('debug', value, debug_options)) diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 007eb0d..24af73e 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -346,10 +346,8 @@ GlobalDefaultEnvironmentFunctions = [ 'SConsignFile', 'SideEffect', 'SourceCode', - 'SourceSignatures', 'Split', 'Tag', - 'TargetSignatures', 'Value', 'VariantDir', ] diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 6f62198..2de64c5 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -409,7 +409,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ handles separating command lines into lists of arguments, so see that function if that's what you're looking for. """ - if isinstance(strSubst, str) and strSubst.find('$') < 0: + if (isinstance(strSubst, str) and '$' not in strSubst) or isinstance(strSubst, CmdStringHolder): return strSubst class StringSubber(object): diff --git a/src/engine/SCons/Tool/DCommon.xml b/src/engine/SCons/Tool/DCommon.xml index f42bea3..8c8c1b5 100644 --- a/src/engine/SCons/Tool/DCommon.xml +++ b/src/engine/SCons/Tool/DCommon.xml @@ -23,49 +23,339 @@ See its __doc__ string for a discussion of the format. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd"> +<cvar name="DC"> +<summary> +<para> +The D compiler to use. +</para> +</summary> +</cvar> +<cvar name="DCOM"> +<summary> +<para> +The command line used to compile a D file to an object file. +Any options specified in the &cv-link-DFLAGS; construction variable +is included on this command line. +</para> +</summary> +</cvar> +<cvar name="DDEBUG"> +<summary> +<para> +List of debug tags to enable when compiling. +</para> +</summary> +</cvar> +<cvar name="DDEBUGPREFIX"> +<summary> +<para> +DDEBUGPREFIX. +</para> +</summary> +</cvar> - <cvar name="DRPATHPREFIX"> - <summary> - <para> - DRPATHPREFIX. - </para> - </summary> - </cvar> - - <cvar name="DRPATHSUFFIX"> - <summary> - <para> - DRPATHSUFFIX. - </para> - </summary> - </cvar> - - - <cvar name="DShLibSonameGenerator"> - <summary> - <para> - DShLibSonameGenerator. - </para> - </summary> - </cvar> - - <cvar name="SHDLIBVERSION"> - <summary> - <para> - SHDLIBVERSION. - </para> - </summary> - </cvar> - <cvar name="SHDLIBVERSIONFLAGS"> - <summary> - <para> - SHDLIBVERSIONFLAGS. - </para> - </summary> - </cvar> +<cvar name="DDEBUGSUFFIX"> +<summary> +<para> +DDEBUGSUFFIX. +</para> +</summary> +</cvar> +<cvar name="DFILESUFFIX"> +<summary> +<para> +DFILESUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DFLAGPREFIX"> +<summary> +<para> +DFLAGPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DFLAGS"> +<summary> +<para> +General options that are passed to the D compiler. +</para> +</summary> +</cvar> + +<cvar name="DFLAGSUFFIX"> +<summary> +<para> +DFLAGSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DINCSUFFIX"> +<summary> +<para> +DLIBFLAGSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DINCPREFIX"> +<summary> +<para> +DINCPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIB"> +<summary> +<para> +Name of the lib tool to use for D codes. +</para> +</summary> +</cvar> + +<cvar name="DLIBCOM"> +<summary> +<para> +The command line to use when creating libraries. +</para> +</summary> +</cvar> + +<cvar name="DLIBDIRPREFIX"> +<summary> +<para> +DLIBLINKPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIBDIRSUFFIX"> +<summary> +<para> +DLIBLINKSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIBFLAGSUFFIX"> +<summary> +<para> +DLIBFLAGSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIBFLAGPREFIX"> +<summary> +<para> +DLIBFLAGPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIBLINKPREFIX"> +<summary> +<para> +DLIBLINKPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DLIBLINKSUFFIX"> +<summary> +<para> +DLIBLINKSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DLINK"> +<summary> +<para> +Name of the linker to use for linking systems including D sources. +</para> +</summary> +</cvar> + +<cvar name="DLINKCOM"> +<summary> +<para> +The command line to use when linking systems including D sources. +</para> +</summary> +</cvar> + +<cvar name="DLINKFLAGS"> +<summary> +<para> +List of linker flags. +</para> +</summary> +</cvar> + +<cvar name="DLINKFLAGSUFFIX"> +<summary> +<para> +DLINKFLAGSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DLINKFLAGPREFIX"> +<summary> +<para> +DLINKFLAGPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DPATH"> +<summary> +<para> + List of paths to search for import modules. +</para> +</summary> +</cvar> + +<cvar name="DRPATHPREFIX"> +<summary> +<para> +DRPATHPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DRPATHSUFFIX"> +<summary> +<para> +DRPATHSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="DShLibSonameGenerator"> +<summary> +<para> +DShLibSonameGenerator. +</para> +</summary> +</cvar> + +<cvar name="DVERPREFIX"> +<summary> +<para> +DVERPREFIX. +</para> +</summary> +</cvar> + +<cvar name="DVERSIONS"> +<summary> +<para> +List of version tags to enable when compiling. +</para> +</summary> +</cvar> + +<cvar name="DVERSUFFIX"> +<summary> +<para> +DVERSUFFIX. +</para> +</summary> +</cvar> + +<cvar name="SHDC"> +<summary> +<para> +The name of the compiler to use when compiling D source +destined to be in a shared objects. +</para> +</summary> +</cvar> + +<cvar name="SHDCOM"> +<summary> +<para> +The command line to use when compiling code to be part of shared objects. +</para> +</summary> +</cvar> + +<cvar name="SHDLIBVERSION"> +<summary> +<para> +SHDLIBVERSION. +</para> +</summary> +</cvar> + +<cvar name="SHDLIBVERSIONFLAGS"> +<summary> +<para> +SHDLIBVERSIONFLAGS. +</para> +</summary> +</cvar> + +<cvar name="SHDLINK"> +<summary> +<para> +The linker to use when creating shared objects for code bases +include D sources. +</para> +</summary> +</cvar> + +<cvar name="SHDLINKCOM"> +<summary> +<para> +The command line to use when generating shared objects. +</para> +</summary> +</cvar> + +<cvar name="SHDLINKFLAGS"> +<summary> +<para> +The list of flags to use when generating a shared object. +</para> +</summary> +</cvar> + + +<builder name="ProgramAllAtOnce"> +<summary> + <para> + Builds an executable from D sources without first creating individual + objects for each file. + </para> + <para> + D sources can be compiled file-by-file as C and C++ source are, and + D is integrated into the &scons; Object and Program builders for + this model of build. D codes can though do whole source + meta-programming (some of the testing frameworks do this). For this + it is imperative that all sources are compiled and linked in a single + call to the D compiler. This builder serves that purpose. + </para> + <example_commands> + env.ProgramAllAtOnce('executable', ['mod_a.d, mod_b.d', 'mod_c.d']) + </example_commands> + <para> + This command will compile the modules mod_a, mod_b, and mod_c in a + single compilation process without first creating object files for + the modules. Some of the D compilers will create executable.o others + will not. + </para> +</summary> +</builder> </sconsdoc> diff --git a/src/engine/SCons/Tool/MSCommon/common.py b/src/engine/SCons/Tool/MSCommon/common.py index c3ba8e5..bbccf61 100644 --- a/src/engine/SCons/Tool/MSCommon/common.py +++ b/src/engine/SCons/Tool/MSCommon/common.py @@ -28,28 +28,64 @@ from __future__ import print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import copy +import json import os -import subprocess import re +import subprocess +import sys import SCons.Util +# SCONS_MSCOMMON_DEBUG is internal-use so undocumented: +# set to '-' to print to console, else set to filename to log to LOGFILE = os.environ.get('SCONS_MSCOMMON_DEBUG') if LOGFILE == '-': def debug(message): print(message) elif LOGFILE: - try: - import logging - except ImportError: - debug = lambda message: open(LOGFILE, 'a').write(message + '\n') - else: - logging.basicConfig(filename=LOGFILE, level=logging.DEBUG) - debug = logging.getLogger(name=__name__).debug + import logging + logging.basicConfig( + format='%(relativeCreated)05dms:pid%(process)05d:MSCommon/%(filename)s:%(message)s', + filename=LOGFILE, + level=logging.DEBUG) + debug = logging.getLogger(name=__name__).debug else: debug = lambda x: None +# SCONS_CACHE_MSVC_CONFIG is public, and is documented. +CONFIG_CACHE = os.environ.get('SCONS_CACHE_MSVC_CONFIG') +if CONFIG_CACHE in ('1', 'true', 'True'): + CONFIG_CACHE = os.path.join(os.path.expanduser('~'), '.scons_msvc_cache') + +def read_script_env_cache(): + """ fetch cached msvc env vars if requested, else return empty dict """ + envcache = {} + if CONFIG_CACHE: + try: + with open(CONFIG_CACHE, 'r') as f: + envcache = json.load(f) + #TODO can use more specific FileNotFoundError when py2 dropped + except IOError: + # don't fail if no cache file, just proceed without it + pass + return envcache + + +def write_script_env_cache(cache): + """ write out cache of msvc env vars if requested """ + if CONFIG_CACHE: + try: + with open(CONFIG_CACHE, 'w') as f: + json.dump(cache, f, indent=2) + except TypeError: + # data can't serialize to json, don't leave partial file + os.remove(CONFIG_CACHE) + except IOError: + # can't write the file, just skip + pass + + _is_win64 = None def is_win64(): @@ -199,7 +235,6 @@ def get_output(vcbat, args = None, env = None): if stderr: # TODO: find something better to do with stderr; # this at least prevents errors from getting swallowed. - import sys sys.stderr.write(stderr) if popen.wait() != 0: raise IOError(stderr.decode("mbcs")) @@ -207,14 +242,15 @@ def get_output(vcbat, args = None, env = None): output = stdout.decode("mbcs") return output -def parse_output(output, keep=("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat')): +KEEPLIST = ("INCLUDE", "LIB", "LIBPATH", "PATH", 'VSCMD_ARG_app_plat') +def parse_output(output, keep=KEEPLIST): """ Parse output from running visual c++/studios vcvarsall.bat and running set To capture the values listed in keep """ # dkeep is a dict associating key: path_list, where key is one item from - # keep, and pat_list the associated list of paths + # keep, and path_list the associated list of paths dkeep = dict([(i, []) for i in keep]) # rdk will keep the regex to match the .bat file output line starts diff --git a/src/engine/SCons/Tool/MSCommon/sdk.py b/src/engine/SCons/Tool/MSCommon/sdk.py index ad57865..281c1e3 100644 --- a/src/engine/SCons/Tool/MSCommon/sdk.py +++ b/src/engine/SCons/Tool/MSCommon/sdk.py @@ -118,11 +118,11 @@ class SDKDefinition(object): if (host_arch != target_arch): arch_string='%s_%s'%(host_arch,target_arch) - debug("sdk.py: get_sdk_vc_script():arch_string:%s host_arch:%s target_arch:%s"%(arch_string, + debug("get_sdk_vc_script():arch_string:%s host_arch:%s target_arch:%s"%(arch_string, host_arch, target_arch)) file=self.vc_setup_scripts.get(arch_string,None) - debug("sdk.py: get_sdk_vc_script():file:%s"%file) + debug("get_sdk_vc_script():file:%s"%file) return file class WindowsSDK(SDKDefinition): @@ -286,14 +286,14 @@ InstalledSDKMap = None def get_installed_sdks(): global InstalledSDKList global InstalledSDKMap - debug('sdk.py:get_installed_sdks()') + debug('get_installed_sdks()') if InstalledSDKList is None: InstalledSDKList = [] InstalledSDKMap = {} for sdk in SupportedSDKList: - debug('MSCommon/sdk.py: trying to find SDK %s' % sdk.version) + debug('trying to find SDK %s' % sdk.version) if sdk.get_sdk_dir(): - debug('MSCommon/sdk.py:found SDK %s' % sdk.version) + debug('found SDK %s' % sdk.version) InstalledSDKList.append(sdk) InstalledSDKMap[sdk.version] = sdk return InstalledSDKList @@ -346,13 +346,13 @@ def get_default_sdk(): return InstalledSDKList[0] def mssdk_setup_env(env): - debug('sdk.py:mssdk_setup_env()') + debug('mssdk_setup_env()') if 'MSSDK_DIR' in env: sdk_dir = env['MSSDK_DIR'] if sdk_dir is None: return sdk_dir = env.subst(sdk_dir) - debug('sdk.py:mssdk_setup_env: Using MSSDK_DIR:{}'.format(sdk_dir)) + debug('mssdk_setup_env: Using MSSDK_DIR:{}'.format(sdk_dir)) elif 'MSSDK_VERSION' in env: sdk_version = env['MSSDK_VERSION'] if sdk_version is None: @@ -364,22 +364,22 @@ def mssdk_setup_env(env): msg = "SDK version %s is not installed" % sdk_version raise SCons.Errors.UserError(msg) sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir) + debug('mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir) elif 'MSVS_VERSION' in env: msvs_version = env['MSVS_VERSION'] - debug('sdk.py:mssdk_setup_env:Getting MSVS_VERSION from env:%s'%msvs_version) + debug('mssdk_setup_env:Getting MSVS_VERSION from env:%s'%msvs_version) if msvs_version is None: - debug('sdk.py:mssdk_setup_env thinks msvs_version is None') + debug('mssdk_setup_env thinks msvs_version is None') return msvs_version = env.subst(msvs_version) from . import vs msvs = vs.get_vs_by_version(msvs_version) - debug('sdk.py:mssdk_setup_env:msvs is :%s'%msvs) + debug('mssdk_setup_env:msvs is :%s'%msvs) if not msvs: - debug('sdk.py:mssdk_setup_env: no VS version detected, bailingout:%s'%msvs) + debug('mssdk_setup_env: no VS version detected, bailingout:%s'%msvs) return sdk_version = msvs.sdk_version - debug('sdk.py:msvs.sdk_version is %s'%sdk_version) + debug('msvs.sdk_version is %s'%sdk_version) if not sdk_version: return mssdk = get_sdk_by_version(sdk_version) @@ -388,13 +388,13 @@ def mssdk_setup_env(env): if not mssdk: return sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) + debug('mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) else: mssdk = get_default_sdk() if not mssdk: return sdk_dir = mssdk.get_sdk_dir() - debug('sdk.py:mssdk_setup_env: not using any env values. sdk_dir:%s'%sdk_dir) + debug('mssdk_setup_env: not using any env values. sdk_dir:%s'%sdk_dir) set_sdk_by_directory(env, sdk_dir) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 0e4ef15..4f6048d 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -40,7 +40,10 @@ import SCons.Util import subprocess import os import platform +import sys from string import digits as string_digits +if sys.version_info[0] == 2: + import collections import SCons.Warnings from SCons.Tool import find_program_path @@ -152,20 +155,15 @@ def get_msvc_version_numeric(msvc_version): return ''.join([x for x in msvc_version if x in string_digits + '.']) def get_host_target(env): - debug('vc.py:get_host_target()') + debug('get_host_target()') host_platform = env.get('HOST_ARCH') if not host_platform: host_platform = platform.machine() - # TODO(2.5): the native Python platform.machine() function returns - # '' on all Python versions before 2.6, after which it also uses - # PROCESSOR_ARCHITECTURE. - if not host_platform: - host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '') # Retain user requested TARGET_ARCH req_target_platform = env.get('TARGET_ARCH') - debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform) + debug('get_host_target() req_target_platform:%s'%req_target_platform) if req_target_platform: # If user requested a specific platform then only try that one. @@ -403,7 +401,7 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): if pdir is None: raise NoVersionFound("No version of Visual Studio found") - debug('vc.py: find_batch_file() in {}'.format(pdir)) + debug('find_batch_file() in {}'.format(pdir)) # filter out e.g. "Exp" from the version name msvc_ver_numeric = get_msvc_version_numeric(msvc_version) @@ -423,17 +421,17 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): debug("Not found: %s" % batfilename) batfilename = None - installed_sdks=get_installed_sdks() + installed_sdks = get_installed_sdks() for _sdk in installed_sdks: sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch) if not sdk_bat_file: - debug("vc.py:find_batch_file() not found:%s"%_sdk) + debug("find_batch_file() not found:%s"%_sdk) else: sdk_bat_file_path = os.path.join(pdir,sdk_bat_file) if os.path.exists(sdk_bat_file_path): - debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) - return (batfilename,sdk_bat_file_path) - return (batfilename,None) + debug('find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + return (batfilename, sdk_bat_file_path) + return (batfilename, None) __INSTALLED_VCS_RUN = None @@ -592,21 +590,57 @@ def reset_installed_vcs(): # env2 = Environment(tools='msvs') # we can greatly improve the speed of the second and subsequent Environment # (or Clone) calls by memoizing the environment variables set by vcvars*.bat. -script_env_stdout_cache = {} +# +# Updated: by 2018, vcvarsall.bat had gotten so expensive (vs2017 era) +# it was breaking CI builds because the test suite starts scons so many +# times and the existing memo logic only helped with repeated calls +# within the same scons run. Windows builds on the CI system were split +# into chunks to get around single-build time limits. +# With VS2019 it got even slower and an optional persistent cache file +# was introduced. The cache now also stores only the parsed vars, +# not the entire output of running the batch file - saves a bit +# of time not parsing every time. + +script_env_cache = None + def script_env(script, args=None): - cache_key = (script, args) - stdout = script_env_stdout_cache.get(cache_key, None) - if stdout is None: + global script_env_cache + + if script_env_cache is None: + script_env_cache = common.read_script_env_cache() + cache_key = "{}--{}".format(script, args) + cache_data = script_env_cache.get(cache_key, None) + if cache_data is None: stdout = common.get_output(script, args) - script_env_stdout_cache[cache_key] = stdout - # Stupid batch files do not set return code: we take a look at the - # beginning of the output for an error message instead - olines = stdout.splitlines() - if olines[0].startswith("The specified configuration type is missing"): - raise BatchFileExecutionError("\n".join(olines[:2])) + # Stupid batch files do not set return code: we take a look at the + # beginning of the output for an error message instead + olines = stdout.splitlines() + if olines[0].startswith("The specified configuration type is missing"): + raise BatchFileExecutionError("\n".join(olines[:2])) + + cache_data = common.parse_output(stdout) + script_env_cache[cache_key] = cache_data + # once we updated cache, give a chance to write out if user wanted + common.write_script_env_cache(script_env_cache) + else: + #TODO: Python 2 cleanup + # If we "hit" data from the json file, we have a Py2 problem: + # keys & values will be unicode. don't detect, just convert. + if sys.version_info[0] == 2: + def convert(data): + if isinstance(data, basestring): + return str(data) + elif isinstance(data, collections.Mapping): + return dict(map(convert, data.iteritems())) + elif isinstance(data, collections.Iterable): + return type(data)(map(convert, data)) + else: + return data - return common.parse_output(stdout) + cache_data = convert(cache_data) + + return cache_data def get_default_version(env): debug('get_default_version()') @@ -635,12 +669,12 @@ def get_default_version(env): debug('installed_vcs:%s' % installed_vcs) if not installed_vcs: #msg = 'No installed VCs' - #debug('msv %s\n' % repr(msg)) + #debug('msv %s' % repr(msg)) #SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, msg) debug('msvc_setup_env: No installed VCs') return None msvc_version = installed_vcs[0] - debug('msvc_setup_env: using default installed MSVC version %s\n' % repr(msvc_version)) + debug('msvc_setup_env: using default installed MSVC version %s' % repr(msvc_version)) return msvc_version @@ -654,12 +688,12 @@ def msvc_setup_env_once(env): msvc_setup_env(env) env["MSVC_SETUP_RUN"] = True -def msvc_find_valid_batch_script(env,version): - debug('vc.py:msvc_find_valid_batch_script()') +def msvc_find_valid_batch_script(env, version): + debug('msvc_find_valid_batch_script()') # Find the host platform, target platform, and if present the requested # target platform platforms = get_host_target(env) - debug("vc.py: msvs_find_valid_batch_script(): host_platform %s, target_platform %s req_target_platform:%s" % platforms) + debug(" msvs_find_valid_batch_script(): host_platform %s, target_platform %s req_target_platform:%s" % platforms) host_platform, target_platform, req_target_platform = platforms try_target_archs = [target_platform] @@ -683,7 +717,7 @@ def msvc_find_valid_batch_script(env,version): # Set to current arch. env['TARGET_ARCH']=tp - debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp) + debug("msvc_find_valid_batch_script() trying target_platform:%s"%tp) host_target = (host_platform, tp) if not is_host_target_supported(host_target, version): warn_msg = "host, target = %s not supported for MSVC version %s" % \ @@ -701,8 +735,8 @@ def msvc_find_valid_batch_script(env,version): # Try to locate a batch file for this host/target platform combo try: - (vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp) - debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script)) + (vc_script, sdk_script) = find_batch_file(env, version, host_platform, tp) + debug('msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script)) except VisualCException as e: msg = str(e) debug('Caught exception while looking for batch file (%s)' % msg) @@ -714,29 +748,29 @@ def msvc_find_valid_batch_script(env,version): continue # Try to use the located batch file for this host/target platform combo - debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg)) + debug('msvc_find_valid_batch_script() use_script 2 %s, args:%s' % (repr(vc_script), arg)) found = None if vc_script: try: d = script_env(vc_script, args=arg) found = vc_script except BatchFileExecutionError as e: - debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) + debug('msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) vc_script=None continue if not vc_script and sdk_script: - debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) + debug('msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) try: d = script_env(sdk_script) found = sdk_script except BatchFileExecutionError as e: - debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) + debug('msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) continue elif not vc_script and not sdk_script: - debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') + debug('msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') continue - debug("vc.py:msvc_find_valid_batch_script() Found a working script/target: %s/%s"%(repr(found),arg)) + debug("msvc_find_valid_batch_script() Found a working script/target: %s/%s"%(repr(found),arg)) break # We've found a working target_platform, so stop looking # If we cannot find a viable installed compiler, reset the TARGET_ARCH @@ -756,7 +790,7 @@ def msvc_setup_env(env): "compilers most likely not set correctly" SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg) return None - debug('msvc_setup_env: using specified MSVC version %s\n' % repr(version)) + debug('msvc_setup_env: using specified MSVC version %s' % repr(version)) # XXX: we set-up both MSVS version for backward # compatibility with the msvs tool @@ -767,11 +801,11 @@ def msvc_setup_env(env): use_script = env.get('MSVC_USE_SCRIPT', True) if SCons.Util.is_String(use_script): - debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script)) + debug('msvc_setup_env() use_script 1 %s' % repr(use_script)) d = script_env(use_script) elif use_script: d = msvc_find_valid_batch_script(env,version) - debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d) + debug('msvc_setup_env() use_script 2 %s' % d) if not d: return d else: @@ -782,7 +816,7 @@ def msvc_setup_env(env): return None for k, v in d.items(): - debug('vc.py:msvc_setup_env() env:%s -> %s'%(k,v)) + debug('msvc_setup_env() env:%s -> %s'%(k,v)) env.PrependENVPath(k, v, delete_existing=True) # final check to issue a warning if the compiler is not present diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py index dfca48d..bac35d8 100644 --- a/src/engine/SCons/Tool/MSCommon/vs.py +++ b/src/engine/SCons/Tool/MSCommon/vs.py @@ -465,14 +465,14 @@ def get_vs_by_version(msvs): global InstalledVSMap global SupportedVSMap - debug('vs.py:get_vs_by_version()') + debug('get_vs_by_version()') if msvs not in SupportedVSMap: msg = "Visual Studio version %s is not supported" % repr(msvs) raise SCons.Errors.UserError(msg) get_installed_visual_studios() vs = InstalledVSMap.get(msvs) debug('InstalledVSMap:%s'%InstalledVSMap) - debug('vs.py:get_vs_by_version: found vs:%s'%vs) + debug('get_vs_by_version: found vs:%s'%vs) # Some check like this would let us provide a useful error message # if they try to set a Visual Studio version that's not installed. # However, we also want to be able to run tests (like the unit diff --git a/src/engine/SCons/Tool/__init__.xml b/src/engine/SCons/Tool/__init__.xml index 69cc597..b6e5a43 100644 --- a/src/engine/SCons/Tool/__init__.xml +++ b/src/engine/SCons/Tool/__init__.xml @@ -468,7 +468,7 @@ as C++ files. Used to override &cv-link-SHLIBVERSION;/&cv-link-LDMODULEVERSION; when generating versioned import library for a shared library/loadable module. If undefined, the &cv-link-SHLIBVERSION;/&cv-link-LDMODULEVERSION; is used to -determine the version of versioned import library. +determine the version of versioned import library. </para> </summary> </cvar> @@ -476,7 +476,10 @@ determine the version of versioned import library. <cvar name="LIBEMITTER"> <summary> <para> -TODO +Contains the emitter specification for the +&b-link-StaticLibrary; builder. +The manpage section "Builder Objects" contains +general information on specifying emitters. </para> </summary> </cvar> @@ -494,10 +497,24 @@ format as &cv-link-SHLIBVERSION;. </summary> </cvar> +<cvar name="LDMODULEEMITTER"> +<summary> +<para> +Contains the emitter specification for the +&b-link-LoadableModule; builder. +The manpage section "Builder Objects" contains +general information on specifying emitters. +</para> +</summary> +</cvar> + <cvar name="SHLIBEMITTER"> <summary> <para> -TODO +Contains the emitter specification for the +&b-link-SharedLibrary; builder. +The manpage section "Builder Objects" contains +general information on specifying emitters. </para> </summary> </cvar> @@ -505,7 +522,10 @@ TODO <cvar name="PROGEMITTER"> <summary> <para> -TODO +Contains the emitter specification for the +&b-link-Program; builder. +The manpage section "Builder Objects" contains +general information on specifying emitters. </para> </summary> </cvar> @@ -514,7 +534,7 @@ TODO <summary> <para> When this construction variable is defined, a versioned shared library -is created by &b-link-SharedLibrary; builder. This activates the +is created by the &b-link-SharedLibrary; builder. This activates the &cv-link-_SHLIBVERSIONFLAGS; and thus modifies the &cv-link-SHLINKCOM; as required, adds the version number to the library name, and creates the symlinks that are needed. &cv-link-SHLIBVERSION; versions should exist as alpha-numeric, diff --git a/src/engine/SCons/Tool/cc.xml b/src/engine/SCons/Tool/cc.xml index 9330436..7ce8b36 100644 --- a/src/engine/SCons/Tool/cc.xml +++ b/src/engine/SCons/Tool/cc.xml @@ -26,7 +26,7 @@ See its __doc__ string for a discussion of the format. <tool name="cc"> <summary> <para> -Sets construction variables for generic POSIX C copmilers. +Sets construction variables for generic POSIX C compilers. </para> </summary> <sets> diff --git a/src/engine/SCons/Tool/default.xml b/src/engine/SCons/Tool/default.xml index 38eb122..4b862fb 100644 --- a/src/engine/SCons/Tool/default.xml +++ b/src/engine/SCons/Tool/default.xml @@ -26,10 +26,91 @@ See its __doc__ string for a discussion of the format. <tool name="default"> <summary> <para> -Sets variables by calling a default list of Tool modules -for the platform on which SCons is running. +Sets &consvars; for a default list of Tool modules. +Use <emphasis role="bold">default</emphasis> +in the tools list to retain the original defaults, +since the <parameter>tools</parameter> parameter +is treated as a literal statement of the tools +to be made available in that &consenv;, not an addition. </para> + +<para> +The list of tools selected by default is not static, +but is dependent both on +the platform and on the software installed on the platform. +Some tools will not initialize if an underlying command is +not found, and some tools are selected from a list of choices +on a first-found basis. The finished tool list can be +examined by inspecting the <envar>TOOLS</envar> &consvar; +in the &consenv;. +</para> + +<para> +On all platforms, all tools from the following list +are selected whose respective conditions are met: +filesystem, wix, lex, yacc, rpcgen, swig, +jar, javac, javah, rmic, dvipdf, dvips, gs, +tex, latex, pdflatex, pdftex, tar, zip, textfile. +</para> + +<para> +On Linux systems, the default tools list selects +(first-found): a C compiler from +gcc, intelc, icc, cc; +a C++ compiler from +g++, intelc, icc, cxx; +an assembler from +gas, nasm, masm; +a linker from +gnulink, ilink; +a Fortran compiler from +gfortran, g77, ifort, ifl, f95, f90, f77; +and a static archiver 'ar'. +It also selects all found from the list +m4, rpm. +</para> + +<para> +On Windows systems, the default tools list selects +(first-found): a C compiler from +msvc, mingw, gcc, intelc, icl, icc, cc, bcc32; +a C++ compiler from +msvc, intelc, icc, g++, cxx, bcc32; +an assembler from +masm, nasm, gas, 386asm; +a linker from +mslink, gnulink, ilink, linkloc, ilink32; +a Fortran compiler from +gfortran, g77, ifl, cvf, f95, f90, fortran; +and a static archiver from +mslib, ar, tlib; +It also selects all found from the list +msvs, midl. +</para> + +<para> +On MacOS systems, the default tools list selects +(first-found): a C compiler from +gcc, cc; +a C++ compiler from +g++, cxx; +an assembler 'as'; +a linker from +applelink, gnulink; +a Fortran compiler from +gfortran, f95, f90, g77; +and a static archiver ar. +It also selects all found from the list +m4, rpm. +</para> + +<para> +Default lists for other platforms can be found by +examining the &scons; +source code (see +<filename>SCons/Tool/__init__.py</filename>). +</para> + </summary> </tool> - </sconsdoc> diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index 7e220dc..a3620ce 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -73,299 +73,4 @@ Sets construction variables for D language compiler DMD. </uses> </tool> -<cvar name="DC"> -<summary> -<para> -The D compiler to use. -</para> -</summary> -</cvar> - -<cvar name="DCOM"> -<summary> -<para> - The command line used to compile a D file to an object file. - Any options specified in the &cv-link-DFLAGS; construction variable - is included on this command line. -</para> -</summary> -</cvar> - -<cvar name="DDEBUG"> -<summary> -<para> - List of debug tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="DFLAGS"> -<summary> -<para> - General options that are passed to the D compiler. -</para> -</summary> -</cvar> - -<cvar name="DLIB"> -<summary> -<para> - Name of the lib tool to use for D codes. -</para> -</summary> -</cvar> - -<cvar name="DLIBCOM"> -<summary> -<para> - The command line to use when creating libraries. -</para> -</summary> -</cvar> - -<cvar name="DLINK"> -<summary> -<para> - Name of the linker to use for linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKCOM"> -<summary> -<para> - The command line to use when linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKFLAGS"> -<summary> -<para> -List of linker flags. -</para> -</summary> -</cvar> - -<cvar name="DPATH"> -<summary> -<para> - List of paths to search for import modules. -</para> -</summary> -</cvar> - -<cvar name="DVERSIONS"> -<summary> -<para> - List of version tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="SHDC"> -<summary> -<para> - The name of the compiler to use when compiling D source - destined to be in a shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDCOM"> -<summary> -<para> - The command line to use when compiling code to be part of shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINK"> -<summary> -<para> - The linker to use when creating shared objects for code bases - include D sources. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKCOM"> -<summary> -<para> - The command line to use when generating shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKFLAGS"> -<summary> -<para> - The list of flags to use when generating a shared object. -</para> -</summary> -</cvar> - -<cvar name="DVERSUFFIX"> - <summary> - <para> - DVERSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DVERPREFIX"> - <summary> - <para> - DVERPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGSUFFIX"> - <summary> - <para> - DLINKFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGPREFIX"> - <summary> - <para> - DLINKFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGPREFIX"> - <summary> - <para> - DLIBFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DINCSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - - -<cvar name="DINCPREFIX"> - <summary> - <para> - DINCPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGSUFFIX"> - <summary> - <para> - DFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGPREFIX"> - <summary> - <para> - DFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFILESUFFIX"> - <summary> - <para> - DFILESUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGPREFIX"> - <summary> - <para> - DDEBUGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGSUFFIX"> - <summary> - <para> - DDEBUGSUFFIX. - </para> - </summary> -</cvar> - -<builder name="ProgramAllAtOnce"> - <summary> - <para> - Builds an executable from D sources without first creating individual - objects for each file. - </para> - <para> - D sources can be compiled file-by-file as C and C++ source are, and - D is integrated into the &scons; Object and Program builders for - this model of build. D codes can though do whole source - meta-programming (some of the testing frameworks do this). For this - it is imperative that all sources are compiled and linked in a single call of - the D compiler. This builder serves that purpose. - </para> - <example_commands> - env.ProgramAllAtOnce('executable', ['mod_a.d, mod_b.d', 'mod_c.d']) - </example_commands> - <para> - This command will compile the modules mod_a, mod_b, and mod_c in a - single compilation process without first creating object files for - the modules. Some of the D compilers will create executable.o others - will not. - </para> - </summary> -</builder> - </sconsdoc> diff --git a/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml index d44489e..4c6c2f8 100644 --- a/src/engine/SCons/Tool/gdc.xml +++ b/src/engine/SCons/Tool/gdc.xml @@ -73,299 +73,4 @@ Sets construction variables for the D language compiler GDC. </uses> </tool> -<cvar name="DC"> -<summary> -<para> -The D compiler to use. -</para> -</summary> -</cvar> - -<cvar name="DCOM"> -<summary> -<para> - The command line used to compile a D file to an object file. - Any options specified in the &cv-link-DFLAGS; construction variable - is included on this command line. -</para> -</summary> -</cvar> - -<cvar name="DDEBUG"> -<summary> -<para> - List of debug tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="DFLAGS"> -<summary> -<para> - General options that are passed to the D compiler. -</para> -</summary> -</cvar> - -<cvar name="DLIB"> -<summary> -<para> - Name of the lib tool to use for D codes. -</para> -</summary> -</cvar> - -<cvar name="DLIBCOM"> -<summary> -<para> - The command line to use when creating libraries. -</para> -</summary> -</cvar> - -<cvar name="DLINK"> -<summary> -<para> - Name of the linker to use for linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKCOM"> -<summary> -<para> - The command line to use when linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKFLAGS"> -<summary> -<para> -List of linker flags. -</para> -</summary> -</cvar> - -<cvar name="DPATH"> -<summary> -<para> - List of paths to search for import modules. -</para> -</summary> -</cvar> - -<cvar name="DVERSIONS"> -<summary> -<para> - List of version tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="SHDC"> -<summary> -<para> - The name of the compiler to use when compiling D source - destined to be in a shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDCOM"> -<summary> -<para> - The command line to use when compiling code to be part of shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINK"> -<summary> -<para> - The linker to use when creating shared objects for code bases - include D sources. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKCOM"> -<summary> -<para> - The command line to use when generating shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKFLAGS"> -<summary> -<para> - The list of flags to use when generating a shared object. -</para> -</summary> -</cvar> - -<cvar name="DVERSUFFIX"> - <summary> - <para> - DVERSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DVERPREFIX"> - <summary> - <para> - DVERPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGSUFFIX"> - <summary> - <para> - DLINKFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGPREFIX"> - <summary> - <para> - DLINKFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGPREFIX"> - <summary> - <para> - DLIBFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DINCSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - - -<cvar name="DINCPREFIX"> - <summary> - <para> - DINCPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGSUFFIX"> - <summary> - <para> - DFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGPREFIX"> - <summary> - <para> - DFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFILESUFFIX"> - <summary> - <para> - DFILESUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGPREFIX"> - <summary> - <para> - DDEBUGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGSUFFIX"> - <summary> - <para> - DDEBUGSUFFIX. - </para> - </summary> -</cvar> - -<builder name="ProgramAllAtOnce"> - <summary> - <para> - Builds an executable from D sources without first creating individual - objects for each file. - </para> - <para> - D sources can be compiled file-by-file as C and C++ source are, and - D is integrated into the &scons; Object and Program builders for - this model of build. D codes can though do whole source - meta-programming (some of the testing frameworks do this). For this - it is imperative that all sources are compiled and linked in a single call of - the D compiler. This builder serves that purpose. - </para> - <example_commands> - env.ProgramAllAtOnce('executable', ['mod_a.d, mod_b.d', 'mod_c.d']) - </example_commands> - <para> - This command will compile the modules mod_a, mod_b, and mod_c in a - single compilation process without first creating object files for - the modules. Some of the D compilers will create executable.o others - will not. - </para> - </summary> -</builder> - </sconsdoc> diff --git a/src/engine/SCons/Tool/install.xml b/src/engine/SCons/Tool/install.xml index 6ae3e30..74169b3 100644 --- a/src/engine/SCons/Tool/install.xml +++ b/src/engine/SCons/Tool/install.xml @@ -52,6 +52,22 @@ a builder. <example_commands> env.Install('/usr/local/bin', source = ['foo', 'bar']) </example_commands> + +<para> +If the <option>--install-sandbox</option> command line +option is given, the target directory will be prefixed +by the directory path specified. +This is useful to test installs without installing to +a "live" location in the system. +</para> + +<para> +See also &FindInstalledFiles;. +For more thoughts on installation, see the User Guide +(particularly the section on Command-Line Targets +and the chapters on Installing Files and on Alias Targets). +</para> + </summary> </builder> diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml index 495b8bc..6a80436 100644 --- a/src/engine/SCons/Tool/ldc.xml +++ b/src/engine/SCons/Tool/ldc.xml @@ -73,299 +73,4 @@ Sets construction variables for the D language compiler LDC2. </uses> </tool> -<cvar name="DC"> -<summary> -<para> -The D compiler to use. -</para> -</summary> -</cvar> - -<cvar name="DCOM"> -<summary> -<para> - The command line used to compile a D file to an object file. - Any options specified in the &cv-link-DFLAGS; construction variable - is included on this command line. -</para> -</summary> -</cvar> - -<cvar name="DDEBUG"> -<summary> -<para> - List of debug tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="DFLAGS"> -<summary> -<para> - General options that are passed to the D compiler. -</para> -</summary> -</cvar> - -<cvar name="DLIB"> -<summary> -<para> - Name of the lib tool to use for D codes. -</para> -</summary> -</cvar> - -<cvar name="DLIBCOM"> -<summary> -<para> - The command line to use when creating libraries. -</para> -</summary> -</cvar> - -<cvar name="DLINK"> -<summary> -<para> - Name of the linker to use for linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKCOM"> -<summary> -<para> - The command line to use when linking systems including D sources. -</para> -</summary> -</cvar> - -<cvar name="DLINKFLAGS"> -<summary> -<para> -List of linker flags. -</para> -</summary> -</cvar> - -<cvar name="DPATH"> -<summary> -<para> - List of paths to search for import modules. -</para> -</summary> -</cvar> - -<cvar name="DVERSIONS"> -<summary> -<para> - List of version tags to enable when compiling. -</para> -</summary> -</cvar> - -<cvar name="SHDC"> -<summary> -<para> - The name of the compiler to use when compiling D source - destined to be in a shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDCOM"> -<summary> -<para> - The command line to use when compiling code to be part of shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINK"> -<summary> -<para> - The linker to use when creating shared objects for code bases - include D sources. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKCOM"> -<summary> -<para> - The command line to use when generating shared objects. -</para> -</summary> -</cvar> - -<cvar name="SHDLINKFLAGS"> -<summary> -<para> - The list of flags to use when generating a shared object. -</para> -</summary> -</cvar> - -<cvar name="DVERSUFFIX"> - <summary> - <para> - DVERSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DVERPREFIX"> - <summary> - <para> - DVERPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGSUFFIX"> - <summary> - <para> - DLINKFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLINKFLAGPREFIX"> - <summary> - <para> - DLINKFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBLINKPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBFLAGPREFIX"> - <summary> - <para> - DLIBFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRSUFFIX"> - <summary> - <para> - DLIBLINKSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DLIBDIRPREFIX"> - <summary> - <para> - DLIBLINKPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DINCSUFFIX"> - <summary> - <para> - DLIBFLAGSUFFIX. - </para> - </summary> -</cvar> - - -<cvar name="DINCPREFIX"> - <summary> - <para> - DINCPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGSUFFIX"> - <summary> - <para> - DFLAGSUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DFLAGPREFIX"> - <summary> - <para> - DFLAGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DFILESUFFIX"> - <summary> - <para> - DFILESUFFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGPREFIX"> - <summary> - <para> - DDEBUGPREFIX. - </para> - </summary> -</cvar> - -<cvar name="DDEBUGSUFFIX"> - <summary> - <para> - DDEBUGSUFFIX. - </para> - </summary> -</cvar> - -<builder name="ProgramAllAtOnce"> - <summary> - <para> - Builds an executable from D sources without first creating individual - objects for each file. - </para> - <para> - D sources can be compiled file-by-file as C and C++ source are, and - D is integrated into the &scons; Object and Program builders for - this model of build. D codes can though do whole source - meta-programming (some of the testing frameworks do this). For this - it is imperative that all sources are compiled and linked in a single call of - the D compiler. This builder serves that purpose. - </para> - <example_commands> - env.ProgramAllAtOnce('executable', ['mod_a.d, mod_b.d', 'mod_c.d']) - </example_commands> - <para> - This command will compile the modules mod_a, mod_b, and mod_c in a - single compilation process without first creating object files for - the modules. Some of the D compilers will create executable.o others - will not. - </para> - </summary> -</builder> - </sconsdoc> diff --git a/src/engine/SCons/Tool/link.xml b/src/engine/SCons/Tool/link.xml index 2f913fe..75b2ed8 100644 --- a/src/engine/SCons/Tool/link.xml +++ b/src/engine/SCons/Tool/link.xml @@ -26,7 +26,9 @@ See its __doc__ string for a discussion of the format. <tool name="link"> <summary> <para> -Sets construction variables for generic POSIX linkers. +Sets construction variables for generic POSIX linkers. This is +a "smart" linker tool which selects a compiler to complete the linking +based on the types of source files. </para> </summary> <sets> diff --git a/src/engine/SCons/Tool/midl.xml b/src/engine/SCons/Tool/midl.xml index efd83cc..63cf527 100644 --- a/src/engine/SCons/Tool/midl.xml +++ b/src/engine/SCons/Tool/midl.xml @@ -86,7 +86,7 @@ The command line used to pass files to the Microsoft IDL compiler. <summary> <para> The string displayed when -the Microsoft IDL copmiler is called. +the Microsoft IDL compiler is called. If this is not set, then &cv-link-MIDLCOM; (the command line) is displayed. </para> </summary> diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index d27294b..7dca9e1 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -652,7 +652,7 @@ class _GenerateV6DSP(_DSPGenerator): for base in ("BASE ",""): self.file.write('# PROP %sUse_MFC 0\n' '# PROP %sUse_Debug_Libraries ' % (base, base)) - if kind.lower().find('debug') < 0: + if 'debug' not in kind.lower(): self.file.write('0\n') else: self.file.write('1\n') @@ -731,7 +731,7 @@ class _GenerateV6DSP(_DSPGenerator): line = dspfile.readline() # skip until marker while line: - if line.find("# End Project") > -1: + if "# End Project" in line: break line = dspfile.readline() @@ -1049,7 +1049,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User): line = dspfile.readline() # skip until marker while line: - if line.find('<!-- SCons Data:') > -1: + if '<!-- SCons Data:' in line: break line = dspfile.readline() diff --git a/src/engine/SCons/Tool/suncxx.py b/src/engine/SCons/Tool/suncxx.py index 9ac8d32..090df7d 100644 --- a/src/engine/SCons/Tool/suncxx.py +++ b/src/engine/SCons/Tool/suncxx.py @@ -74,7 +74,7 @@ def get_package_info(package_name, pkginfo, pkgchk): except EnvironmentError: pass else: - pkginfo_contents = p.communicate()[0] + pkginfo_contents = p.communicate()[0].decode() version_re = re.compile(r'^ *VERSION:\s*(.*)$', re.M) version_match = version_re.search(pkginfo_contents) if version_match: @@ -88,7 +88,7 @@ def get_package_info(package_name, pkginfo, pkgchk): except EnvironmentError: pass else: - pkgchk_contents = p.communicate()[0] + pkgchk_contents = p.communicate()[0].decode() pathname_re = re.compile(r'^Pathname:\s*(.*/bin/CC)$', re.M) pathname_match = pathname_re.search(pkgchk_contents) if pathname_match: diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index 6ed9d82..f139a09 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -80,7 +80,7 @@ def _find_modules(src): for m in matches: mnames.append(m[2]) - directors = directors or m[0].find('directors') >= 0 + directors = directors or 'directors' in m[0] return mnames, directors def _add_director_header_targets(target, env): diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index a5b257b..718b3d5 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -132,12 +132,6 @@ class DeprecatedCopyWarning(MandatoryDeprecatedWarning): class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): pass -class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): - pass - -class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): - pass - class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): pass |