diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-05-21 06:06:27 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-05-21 06:06:27 (GMT) |
commit | 935e698566833e2c50898f39f565414404c68cbd (patch) | |
tree | 140962ae0b8ebef170e83e21092fec4f510e91d4 /src | |
parent | b040d94fad9024d5715d22cdc071384e827696b2 (diff) | |
download | SCons-935e698566833e2c50898f39f565414404c68cbd.zip SCons-935e698566833e2c50898f39f565414404c68cbd.tar.gz SCons-935e698566833e2c50898f39f565414404c68cbd.tar.bz2 |
Update deprecated features to the next life-cycle stage
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Builder.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConsOptions.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Sig.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Taskmaster.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Warnings.py | 82 | ||||
-rw-r--r-- | src/engine/SCons/WarningsTests.py | 8 |
6 files changed, 57 insertions, 46 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index b062678..6dc9e17 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -388,13 +388,13 @@ class BuilderBase(object): self.env = env self.single_source = single_source if 'overrides' in overrides: - SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning, "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\ "\tspecify the items as keyword arguments to the Builder() call instead.") overrides.update(overrides['overrides']) del overrides['overrides'] if 'scanner' in overrides: - SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning, "The \"scanner\" keyword to Builder() creation has been deprecated;\n" "\tuse: source_scanner or target_scanner as appropriate.") del overrides['scanner'] diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py index db52509..141f9e8 100644 --- a/src/engine/SCons/Script/SConsOptions.py +++ b/src/engine/SCons/Script/SConsOptions.py @@ -613,7 +613,7 @@ def Parser(version): parser.values.delayed_warnings = [] msg = deprecated_debug_options[value] w = "The --debug=%s option is deprecated%s." % (value, msg) - t = (SCons.Warnings.DeprecatedWarning, w) + t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w) parser.values.delayed_warnings.append(t) else: raise OptionValueError("Warning: %s is not a valid debug type" % value) diff --git a/src/engine/SCons/Sig.py b/src/engine/SCons/Sig.py index 935596e..35fffc1 100644 --- a/src/engine/SCons/Sig.py +++ b/src/engine/SCons/Sig.py @@ -40,7 +40,7 @@ import SCons.Warnings msg = 'The SCons.Sig module no longer exists.\n' \ ' Remove the following "import SCons.Sig" line to eliminate this warning:' -SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, msg) +SCons.Warnings.warn(SCons.Warnings.DeprecatedSigModuleWarning, msg) default_calc = None default_module = None diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 2ab6980..8cf5595 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -201,8 +201,9 @@ class Task(object): # Deprecation Cycle) so the desired behavior is explicitly # determined by which concrete subclass is used. #raise NotImplementedError - msg = ('Direct use of the Taskmaster.Task class will be deprecated\n' - + '\tin a future release.') + msg = ('Taskmaster.Task is an abstract base class; instead of\n' + '\tusing it directly, ' + 'derive from it and override the abstract methods.') SCons.Warnings.warn(SCons.Warnings.TaskmasterNeedsExecuteWarning, msg) return True diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index 1fa6302..b17d863 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -36,20 +36,6 @@ import SCons.Errors class Warning(SCons.Errors.UserError): pass -class MandatoryWarning(Warning): - pass - - - -class FutureDeprecatedWarning(Warning): - pass - -class DeprecatedWarning(Warning): - pass - -class MandatoryDeprecatedWarning(MandatoryWarning): - pass - # NOTE: If you add a new warning class, add it to the man page, too! @@ -63,18 +49,6 @@ class CorruptSConsignWarning(Warning): class DependencyWarning(Warning): pass -class DeprecatedCopyWarning(DeprecatedWarning): - pass - -class DeprecatedOptionsWarning(DeprecatedWarning): - pass - -class DeprecatedSourceSignaturesWarning(DeprecatedWarning): - pass - -class DeprecatedTargetSignaturesWarning(DeprecatedWarning): - pass - class DuplicateEnvironmentWarning(Warning): pass @@ -102,18 +76,12 @@ class NoObjectCountWarning(Warning): class NoParallelSupportWarning(Warning): pass -class PythonVersionWarning(DeprecatedWarning): - pass - class ReservedVariableWarning(Warning): pass class StackSizeWarning(Warning): pass -class TaskmasterNeedsExecuteWarning(FutureDeprecatedWarning): - pass - class VisualCMissingWarning(Warning): pass @@ -128,12 +96,55 @@ class VisualStudioMissingWarning(Warning): class FortranCxxMixWarning(LinkWarning): pass -_warningAsException = 0 + +# Deprecation warnings + +class FutureDeprecatedWarning(Warning): + pass + +class DeprecatedWarning(Warning): + pass + +class MandatoryDeprecatedWarning(DeprecatedWarning): + pass + + +class PythonVersionWarning(DeprecatedWarning): + pass + +class DeprecatedCopyWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): + pass + +class TaskmasterNeedsExecuteWarning(DeprecatedWarning): + pass + +class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning): + pass + # The below is a list of 2-tuples. The first element is a class object. # The second element is true if that class is enabled, false if it is disabled. _enabled = [] +# If set, raise the warning as an exception +_warningAsException = 0 + +# If not None, a function to call with the warning _warningOut = None def suppressWarningClass(clazz): @@ -142,7 +153,7 @@ def suppressWarningClass(clazz): _enabled.insert(0, (clazz, 0)) def enableWarningClass(clazz): - """Suppresses all warnings that are of type clazz or + """Enable all warnings that are of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, 1)) @@ -181,8 +192,7 @@ def process_warn_strings(arguments): "Warning" is appended to get the class name. For example, 'deprecated' will enable the DeprecatedWarning - class. 'no-dependency' will disable the .DependencyWarning - class. + class. 'no-dependency' will disable the DependencyWarning class. As a special case, --warn=all and --warn=no-all will enable or disable (respectively) the base Warning class of all warnings. diff --git a/src/engine/SCons/WarningsTests.py b/src/engine/SCons/WarningsTests.py index 37cb623..583b12a 100644 --- a/src/engine/SCons/WarningsTests.py +++ b/src/engine/SCons/WarningsTests.py @@ -94,10 +94,6 @@ class WarningsTestCase(unittest.TestCase): "Foo") assert to.out is None, to.out - SCons.Warnings.warn(SCons.Warnings.MandatoryWarning, - "Foo") - assert to.out is None, to.out - SCons.Warnings.enableWarningClass(SCons.Warnings.Warning) SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, "Foo") @@ -109,6 +105,10 @@ class WarningsTestCase(unittest.TestCase): "Foo") assert to.out is None, to.out + SCons.Warnings.warn(SCons.Warnings.MandatoryDeprecatedWarning, + "Foo") + assert to.out is None, to.out + # Dependency warnings should still be enabled though SCons.Warnings.enableWarningClass(SCons.Warnings.Warning) SCons.Warnings.warn(SCons.Warnings.DependencyWarning, |