diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-09-28 10:21:20 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-09-28 10:21:20 +0200 |
commit | 7c651e273c4db37f4babd91aaecf26800c50dd79 (patch) | |
tree | 21acf2b4172448f034a5cceb86ec34dd932fa4c0 /engine/SCons/Script/SConsOptions.py | |
parent | 1d9b9f9adaf7a3b7582c243643c6405d4f5cd135 (diff) |
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'engine/SCons/Script/SConsOptions.py')
-rw-r--r-- | engine/SCons/Script/SConsOptions.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/engine/SCons/Script/SConsOptions.py b/engine/SCons/Script/SConsOptions.py index 5bebed9..5515c7d 100644 --- a/engine/SCons/Script/SConsOptions.py +++ b/engine/SCons/Script/SConsOptions.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2016 The SCons Foundation +# Copyright (c) 2001 - 2017 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Script/SConsOptions.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Script/SConsOptions.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" import optparse import re @@ -63,6 +63,7 @@ def diskcheck_convert(value): raise ValueError(v) return result + class SConsValues(optparse.Values): """ Holder class for uniform access to SCons options, regardless @@ -112,7 +113,18 @@ class SConsValues(optparse.Values): try: return self.__dict__['__SConscript_settings__'][attr] except KeyError: - return getattr(self.__dict__['__defaults__'], attr) + try: + return getattr(self.__dict__['__defaults__'], attr) + except KeyError: + # Added because with py3 this is a new class, + # not a classic class, and due to the way + # In that case it will create an object without + # __defaults__, and then query for __setstate__ + # which will throw an exception of KeyError + # deepcopy() is expecting AttributeError if __setstate__ + # is not available. + raise AttributeError(attr) + settable = [ 'clean', @@ -127,6 +139,7 @@ class SConsValues(optparse.Values): 'random', 'stack_size', 'warn', + 'silent' ] def set_option(self, name, value): @@ -161,7 +174,7 @@ class SConsValues(optparse.Values): elif name == 'diskcheck': try: value = diskcheck_convert(value) - except ValueError, v: + except ValueError as v: raise SCons.Errors.UserError("Not a valid diskcheck value: %s"%v) if 'diskcheck' not in self.__dict__: # No --diskcheck= option was specified on the command line. @@ -186,6 +199,7 @@ class SConsValues(optparse.Values): self.__SConscript_settings__[name] = value + class SConsOption(optparse.Option): def convert_value(self, opt, value): if value is not None: @@ -638,7 +652,7 @@ def Parser(version): for value in value__.split(','): if value in debug_options: parser.values.debug.append(value) - elif value in deprecated_debug_options.keys(): + elif value in list(deprecated_debug_options.keys()): parser.values.debug.append(value) try: parser.values.delayed_warnings @@ -663,7 +677,7 @@ def Parser(version): def opt_diskcheck(option, opt, value, parser): try: diskcheck_value = diskcheck_convert(value) - except ValueError, e: + except ValueError as e: raise OptionValueError("`%s' is not a valid diskcheck type" % e) setattr(parser.values, option.dest, diskcheck_value) @@ -830,7 +844,7 @@ def Parser(version): tree_options = ["all", "derived", "prune", "status"] def opt_tree(option, opt, value, parser, tree_options=tree_options): - import Main + from . import Main tp = Main.TreePrinter() for o in value.split(','): if o == 'all': |