diff options
Diffstat (limited to 'engine/SCons/Warnings.py')
-rw-r--r-- | engine/SCons/Warnings.py | 98 |
1 files changed, 58 insertions, 40 deletions
diff --git a/engine/SCons/Warnings.py b/engine/SCons/Warnings.py index 9f072bf..aa6074c 100644 --- a/engine/SCons/Warnings.py +++ b/engine/SCons/Warnings.py @@ -27,9 +27,8 @@ This file implements the warnings framework for SCons. """ -__revision__ = "src/engine/SCons/Warnings.py 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/Warnings.py 5023 2010/06/14 22:05:46 scons" -import string import sys import SCons.Errors @@ -37,104 +36,124 @@ import SCons.Errors class Warning(SCons.Errors.UserError): pass -class MandatoryWarning(Warning): +class WarningOnByDefault(Warning): pass +# NOTE: If you add a new warning class, add it to the man page, too! -class FutureDeprecatedWarning(Warning): +class CacheWriteErrorWarning(Warning): pass -class DeprecatedWarning(Warning): +class CorruptSConsignWarning(WarningOnByDefault): pass -class MandatoryDeprecatedWarning(MandatoryWarning): +class DependencyWarning(Warning): pass +class DuplicateEnvironmentWarning(WarningOnByDefault): + pass +class FutureReservedVariableWarning(WarningOnByDefault): + pass -# NOTE: If you add a new warning class, add it to the man page, too! - -class CacheWriteErrorWarning(Warning): +class LinkWarning(WarningOnByDefault): pass -class CorruptSConsignWarning(Warning): +class MisleadingKeywordsWarning(WarningOnByDefault): pass -class DependencyWarning(Warning): +class MissingSConscriptWarning(WarningOnByDefault): pass -class DeprecatedCopyWarning(DeprecatedWarning): +class NoMD5ModuleWarning(WarningOnByDefault): pass -class DeprecatedOptionsWarning(DeprecatedWarning): +class NoMetaclassSupportWarning(WarningOnByDefault): pass -class DeprecatedSourceSignaturesWarning(DeprecatedWarning): +class NoObjectCountWarning(WarningOnByDefault): pass -class DeprecatedTargetSignaturesWarning(DeprecatedWarning): +class NoParallelSupportWarning(WarningOnByDefault): pass -class DuplicateEnvironmentWarning(Warning): +class ReservedVariableWarning(WarningOnByDefault): pass -class FutureReservedVariableWarning(Warning): +class StackSizeWarning(WarningOnByDefault): pass -class LinkWarning(Warning): +class VisualCMissingWarning(WarningOnByDefault): pass -class MisleadingKeywordsWarning(Warning): +# Used when MSVC_VERSION and MSVS_VERSION do not point to the +# same version (MSVS_VERSION is deprecated) +class VisualVersionMismatch(WarningOnByDefault): pass -class MissingSConscriptWarning(Warning): +class VisualStudioMissingWarning(Warning): pass -class NoMD5ModuleWarning(Warning): +class FortranCxxMixWarning(LinkWarning): pass -class NoMetaclassSupportWarning(Warning): + +# Deprecation warnings + +class FutureDeprecatedWarning(Warning): pass -class NoObjectCountWarning(Warning): +class DeprecatedWarning(Warning): pass -class NoParallelSupportWarning(Warning): +class MandatoryDeprecatedWarning(DeprecatedWarning): pass + +# Special case; base always stays DeprecatedWarning class PythonVersionWarning(DeprecatedWarning): pass -class ReservedVariableWarning(Warning): +class DeprecatedSourceCodeWarning(FutureDeprecatedWarning): pass -class StackSizeWarning(Warning): +class DeprecatedBuildDirWarning(DeprecatedWarning): pass -class TaskmasterNeedsExecuteWarning(FutureDeprecatedWarning): +class TaskmasterNeedsExecuteWarning(DeprecatedWarning): pass -class VisualCMissingWarning(Warning): +class DeprecatedCopyWarning(MandatoryDeprecatedWarning): pass -# Used when MSVC_VERSION and MSVS_VERSION do not point to the -# same version (MSVS_VERSION is deprecated) -class VisualVersionMismatch(Warning): +class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): pass -class VisualStudioMissingWarning(Warning): +class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): pass -class FortranCxxMixWarning(LinkWarning): +class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning): + pass + +class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning): pass -_warningAsException = 0 # 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): @@ -143,7 +162,7 @@ def suppressWarningClass(clazz): _enabled.insert(0, (clazz, 0)) def enableWarningClass(clazz): - """Suppresses all warnings that are of type clazz or + """Enables all warnings that are of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, 1)) @@ -182,8 +201,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. @@ -194,11 +212,11 @@ def process_warn_strings(arguments): if s[:5] == "scons": return "SCons" + s[5:] else: - return string.capitalize(s) + return s.capitalize() for arg in arguments: - elems = string.split(string.lower(arg), '-') + elems = arg.lower().split('-') enable = 1 if elems[0] == 'no': enable = 0 @@ -207,7 +225,7 @@ def process_warn_strings(arguments): if len(elems) == 1 and elems[0] == 'all': class_name = "Warning" else: - class_name = string.join(map(_capitalize, elems), '') + "Warning" + class_name = ''.join(map(_capitalize, elems)) + "Warning" try: clazz = globals()[class_name] except KeyError: |