diff options
author | Mats Wichmann <mats@linux.com> | 2019-10-20 16:13:32 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-10-20 16:13:32 (GMT) |
commit | 9c4e6c7a303047e4b26e58af749508f7e254ae89 (patch) | |
tree | 3e5f4082c151528b444f2fb1a754bc6d99858496 /src/engine/SCons | |
parent | 8ec5aba156f070c89609ed8c99e7b3cc4973efa2 (diff) | |
download | SCons-9c4e6c7a303047e4b26e58af749508f7e254ae89.zip SCons-9c4e6c7a303047e4b26e58af749508f7e254ae89.tar.gz SCons-9c4e6c7a303047e4b26e58af749508f7e254ae89.tar.bz2 |
Remove deprecated {Source,Target}Signatures
These two have been deprecated since 2010 (about SCons 2.0), commit
935e6985. Methods are removed, setoption for setting them removed, doc is
removed, tests are migrated to test/Removed/*/Old with a sconstest.skip
file so they don't run, and two new tests are added to confirm that
using the functions and setoptions generate exceptions.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Environment.py | 59 | ||||
-rw-r--r-- | src/engine/SCons/Environment.xml | 252 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 91 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Warnings.py | 6 |
5 files changed, 7 insertions, 403 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 08104c5..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): @@ -1621,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: @@ -2060,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 @@ -2180,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) @@ -2198,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 @@ -2237,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): """ """ @@ -2355,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 a635108..829bf12 100644 --- a/src/engine/SCons/Environment.xml +++ b/src/engine/SCons/Environment.xml @@ -2987,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) @@ -3229,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]) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 70e1a37..f016f22 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -3284,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') @@ -3338,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 @@ -3408,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): @@ -3750,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/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/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 |