| OLD | NEW |
| 1 # | 1 # |
| 2 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 2 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons F
oundation |
| 3 # | 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining | 4 # Permission is hereby granted, free of charge, to any person obtaining |
| 5 # a copy of this software and associated documentation files (the | 5 # a copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including | 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, | 7 # without limitation the rights to use, copy, modify, merge, publish, |
| 8 # distribute, sublicense, and/or sell copies of the Software, and to | 8 # distribute, sublicense, and/or sell copies of the Software, and to |
| 9 # permit persons to whom the Software is furnished to do so, subject to | 9 # permit persons to whom the Software is furnished to do so, subject to |
| 10 # the following conditions: | 10 # the following conditions: |
| 11 # | 11 # |
| 12 # The above copyright notice and this permission notice shall be included | 12 # The above copyright notice and this permission notice shall be included |
| 13 # in all copies or substantial portions of the Software. | 13 # in all copies or substantial portions of the Software. |
| 14 # | 14 # |
| 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
| 16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 # | 22 # |
| 23 | 23 |
| 24 """SCons.Warnings | 24 """SCons.Warnings |
| 25 | 25 |
| 26 This file implements the warnings framework for SCons. | 26 This file implements the warnings framework for SCons. |
| 27 | 27 |
| 28 """ | 28 """ |
| 29 | 29 |
| 30 __revision__ = "src/engine/SCons/Warnings.py 3842 2008/12/20 22:59:52 scons" | 30 __revision__ = "src/engine/SCons/Warnings.py 3897 2009/01/13 06:45:54 scons" |
| 31 | 31 |
| 32 import string | 32 import string |
| 33 import sys | 33 import sys |
| 34 | 34 |
| 35 import SCons.Errors | 35 import SCons.Errors |
| 36 | 36 |
| 37 class Warning(SCons.Errors.UserError): | 37 class Warning(SCons.Errors.UserError): |
| 38 pass | 38 pass |
| 39 | 39 |
| 40 class MandatoryWarning(Warning): |
| 41 pass |
| 42 |
| 43 |
| 44 |
| 45 class FutureDeprecatedWarning(Warning): |
| 46 pass |
| 47 |
| 48 class DeprecatedWarning(Warning): |
| 49 pass |
| 50 |
| 51 class MandatoryDeprecatedWarning(MandatoryWarning): |
| 52 pass |
| 53 |
| 54 |
| 40 | 55 |
| 41 # NOTE: If you add a new warning class, add it to the man page, too! | 56 # NOTE: If you add a new warning class, add it to the man page, too! |
| 42 | 57 |
| 43 class CacheWriteErrorWarning(Warning): | 58 class CacheWriteErrorWarning(Warning): |
| 44 pass | 59 pass |
| 45 | 60 |
| 46 class CorruptSConsignWarning(Warning): | 61 class CorruptSConsignWarning(Warning): |
| 47 pass | 62 pass |
| 48 | 63 |
| 49 class DependencyWarning(Warning): | 64 class DependencyWarning(Warning): |
| 50 pass | 65 pass |
| 51 | 66 |
| 52 class DeprecatedWarning(Warning): | |
| 53 pass | |
| 54 | |
| 55 class DeprecatedCopyWarning(DeprecatedWarning): | 67 class DeprecatedCopyWarning(DeprecatedWarning): |
| 56 pass | 68 pass |
| 57 | 69 |
| 58 class DeprecatedOptionsWarning(DeprecatedWarning): | 70 class DeprecatedOptionsWarning(DeprecatedWarning): |
| 59 pass | 71 pass |
| 60 | 72 |
| 61 class DeprecatedSourceSignaturesWarning(DeprecatedWarning): | 73 class DeprecatedSourceSignaturesWarning(DeprecatedWarning): |
| 62 pass | 74 pass |
| 63 | 75 |
| 64 class DeprecatedTargetSignaturesWarning(DeprecatedWarning): | 76 class DeprecatedTargetSignaturesWarning(DeprecatedWarning): |
| (...skipping 28 matching lines...) Expand all Loading... |
| 93 | 105 |
| 94 class PythonVersionWarning(DeprecatedWarning): | 106 class PythonVersionWarning(DeprecatedWarning): |
| 95 pass | 107 pass |
| 96 | 108 |
| 97 class ReservedVariableWarning(Warning): | 109 class ReservedVariableWarning(Warning): |
| 98 pass | 110 pass |
| 99 | 111 |
| 100 class StackSizeWarning(Warning): | 112 class StackSizeWarning(Warning): |
| 101 pass | 113 pass |
| 102 | 114 |
| 115 class TaskmasterNeedsExecuteWarning(FutureDeprecatedWarning): |
| 116 pass |
| 117 |
| 103 class FortranCxxMixWarning(LinkWarning): | 118 class FortranCxxMixWarning(LinkWarning): |
| 104 pass | 119 pass |
| 105 | 120 |
| 106 _warningAsException = 0 | 121 _warningAsException = 0 |
| 107 | 122 |
| 108 # The below is a list of 2-tuples. The first element is a class object. | 123 # The below is a list of 2-tuples. The first element is a class object. |
| 109 # The second element is true if that class is enabled, false if it is disabled. | 124 # The second element is true if that class is enabled, false if it is disabled. |
| 110 _enabled = [] | 125 _enabled = [] |
| 111 | 126 |
| 112 _warningOut = None | 127 _warningOut = None |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 class_name = "Warning" | 197 class_name = "Warning" |
| 183 else: | 198 else: |
| 184 class_name = string.join(map(_capitalize, elems), '') + "Warning" | 199 class_name = string.join(map(_capitalize, elems), '') + "Warning" |
| 185 try: | 200 try: |
| 186 clazz = globals()[class_name] | 201 clazz = globals()[class_name] |
| 187 except KeyError: | 202 except KeyError: |
| 188 sys.stderr.write("No warning type: '%s'\n" % arg) | 203 sys.stderr.write("No warning type: '%s'\n" % arg) |
| 189 else: | 204 else: |
| 190 if enable: | 205 if enable: |
| 191 enableWarningClass(clazz) | 206 enableWarningClass(clazz) |
| 207 elif issubclass(clazz, MandatoryDeprecatedWarning): |
| 208 fmt = "Can not disable mandataory warning: '%s'\n" |
| 209 sys.stderr.write(fmt % arg) |
| 192 else: | 210 else: |
| 193 suppressWarningClass(clazz) | 211 suppressWarningClass(clazz) |
| OLD | NEW |