diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-09-28 10:21:25 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-09-28 10:21:25 +0200 |
commit | 4f3ca5f60f4de1aca6e3b9d7f30467ba0f724c27 (patch) | |
tree | d47e14dc637e15861e9ba7d65e5f4aae5d79df6d /engine/SCons/Variables | |
parent | 3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff) | |
parent | 7c651e273c4db37f4babd91aaecf26800c50dd79 (diff) |
Updated version 3.0.0 from 'upstream/3.0.0'
with Debian dir f5f84710e04b09c178d76c96bcda7517932c0c17
Diffstat (limited to 'engine/SCons/Variables')
-rw-r--r-- | engine/SCons/Variables/BoolVariable.py | 14 | ||||
-rw-r--r-- | engine/SCons/Variables/EnumVariable.py | 28 | ||||
-rw-r--r-- | engine/SCons/Variables/ListVariable.py | 16 | ||||
-rw-r--r-- | engine/SCons/Variables/PackageVariable.py | 28 | ||||
-rw-r--r-- | engine/SCons/Variables/PathVariable.py | 13 | ||||
-rw-r--r-- | engine/SCons/Variables/__init__.py | 43 |
6 files changed, 72 insertions, 70 deletions
diff --git a/engine/SCons/Variables/BoolVariable.py b/engine/SCons/Variables/BoolVariable.py index 4473184..881a6b4 100644 --- a/engine/SCons/Variables/BoolVariable.py +++ b/engine/SCons/Variables/BoolVariable.py @@ -2,17 +2,17 @@ This file defines the option type for SCons implementing true/false values. -Usage example: +Usage example:: - opts = Variables() - opts.Add(BoolVariable('embedded', 'build for an embedded system', 0)) - ... - if env['embedded'] == 1: + opts = Variables() + opts.Add(BoolVariable('embedded', 'build for an embedded system', 0)) + ... + if env['embedded'] == 1: ... """ # -# 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 @@ -34,7 +34,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/BoolVariable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/BoolVariable.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" __all__ = ['BoolVariable',] diff --git a/engine/SCons/Variables/EnumVariable.py b/engine/SCons/Variables/EnumVariable.py index 57c4661..b6fc382 100644 --- a/engine/SCons/Variables/EnumVariable.py +++ b/engine/SCons/Variables/EnumVariable.py @@ -3,19 +3,19 @@ This file defines the option type for SCons allowing only specified input-values. -Usage example: +Usage example:: - opts = Variables() - opts.Add(EnumVariable('debug', 'debug output and symbols', 'no', + opts = Variables() + opts.Add(EnumVariable('debug', 'debug output and symbols', 'no', allowed_values=('yes', 'no', 'full'), map={}, ignorecase=2)) - ... - if env['debug'] == 'full': + ... + if env['debug'] == 'full': ... """ # -# 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 @@ -37,7 +37,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/EnumVariable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/EnumVariable.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" __all__ = ['EnumVariable',] @@ -69,16 +69,14 @@ def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0): 'ignorecase' defines the behaviour of the validator: - If ignorecase == 0, the validator/converter are case-sensitive. - If ignorecase == 1, the validator/converter are case-insensitive. - If ignorecase == 2, the validator/converter is case-insensitive and - the converted value will always be lower-case. + If ignorecase == 0, the validator/converter are case-sensitive. + If ignorecase == 1, the validator/converter are case-insensitive. + If ignorecase == 2, the validator/converter is case-insensitive and the converted value will always be lower-case. - The 'validator' tests whether the value is in the list of allowed - values. The 'converter' converts input values according to the - given 'map'-dictionary (unmapped input values are returned - unchanged). + The 'validator' tests whether the value is in the list of allowed values. The 'converter' converts input values + according to the given 'map'-dictionary (unmapped input values are returned unchanged). """ + help = '%s (%s)' % (help, '|'.join(allowed_values)) # define validator if ignorecase >= 1: diff --git a/engine/SCons/Variables/ListVariable.py b/engine/SCons/Variables/ListVariable.py index 1840561..8f9a9a8 100644 --- a/engine/SCons/Variables/ListVariable.py +++ b/engine/SCons/Variables/ListVariable.py @@ -7,17 +7,17 @@ separated by comma. After the option has been processed, the option value holds either the named list elements, all list elements or no list elements at all. -Usage example: +Usage example:: - list_of_libs = Split('x11 gl qt ical') + list_of_libs = Split('x11 gl qt ical') - opts = Variables() - opts.Add(ListVariable('shared', + opts = Variables() + opts.Add(ListVariable('shared', 'libraries to build as shared libraries', 'all', elems = list_of_libs)) - ... - for lib in list_of_libs: + ... + for lib in list_of_libs: if lib in env['shared']: env.SharedObject(...) else: @@ -25,7 +25,7 @@ Usage example: """ # -# 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 @@ -46,7 +46,7 @@ Usage example: # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Variables/ListVariable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/ListVariable.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" # Known Bug: This should behave like a Set-Type, but does not really, # since elements can occur twice. diff --git a/engine/SCons/Variables/PackageVariable.py b/engine/SCons/Variables/PackageVariable.py index 6d4761f..8e229b7 100644 --- a/engine/SCons/Variables/PackageVariable.py +++ b/engine/SCons/Variables/PackageVariable.py @@ -13,22 +13,22 @@ Usage example: x11=yes (will search for the package installation dir) x11=/usr/local/X11 (will check this path for existence) - To replace autoconf's --with-xxx=yyy - - opts = Variables() - opts.Add(PackageVariable('x11', - 'use X11 installed here (yes = search some places', - 'yes')) - ... - if env['x11'] == True: - dir = ... search X11 in some standard places ... - env['x11'] = dir - if env['x11']: - ... build with x11 ... + To replace autoconf's --with-xxx=yyy :: + + opts = Variables() + opts.Add(PackageVariable('x11', + 'use X11 installed here (yes = search some places', + 'yes')) + ... + if env['x11'] == True: + dir = ... search X11 in some standard places ... + env['x11'] = dir + if env['x11']: + ... build with x11 ... """ # -# 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 @@ -50,7 +50,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/PackageVariable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/PackageVariable.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" __all__ = ['PackageVariable',] diff --git a/engine/SCons/Variables/PathVariable.py b/engine/SCons/Variables/PathVariable.py index aa3f218..dc5fcd2 100644 --- a/engine/SCons/Variables/PathVariable.py +++ b/engine/SCons/Variables/PathVariable.py @@ -8,8 +8,7 @@ Arguments to PathVariable are: option-name = name of this option on the command line (e.g. "prefix") option-help = help string for option option-dflt = default value for this option - validator = [optional] validator for option value. Predefined - validators are: + validator = [optional] validator for option value. Predefined validators are: PathAccept -- accepts any path setting; no validation PathIsDir -- path must be an existing directory @@ -25,7 +24,7 @@ Arguments to PathVariable are: and the env is the env to which the Options have been added. -Usage example: +Usage example:: Examples: prefix=/usr/local @@ -34,8 +33,8 @@ Usage example: opts = Variables() opts.Add(PathVariable('qtdir', - 'where the root of Qt is installed', - qtdir, PathIsDir)) + 'where the root of Qt is installed', + qtdir, PathIsDir)) opts.Add(PathVariable('qt_includes', 'where the Qt includes are installed', '$qtdir/includes', PathIsDirCreate)) @@ -46,7 +45,7 @@ Usage example: """ # -# 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 @@ -68,7 +67,7 @@ Usage example: # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Variables/PathVariable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/PathVariable.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" __all__ = ['PathVariable',] diff --git a/engine/SCons/Variables/__init__.py b/engine/SCons/Variables/__init__.py index 284813f..784f795 100644 --- a/engine/SCons/Variables/__init__.py +++ b/engine/SCons/Variables/__init__.py @@ -5,7 +5,7 @@ customizable variables to an SCons build. """ # -# 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 @@ -26,7 +26,7 @@ customizable variables to an SCons build. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Variables/__init__.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Variables/__init__.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" import os.path import sys @@ -36,11 +36,11 @@ import SCons.Errors import SCons.Util import SCons.Warnings -from BoolVariable import BoolVariable # okay -from EnumVariable import EnumVariable # okay -from ListVariable import ListVariable # naja -from PackageVariable import PackageVariable # naja -from PathVariable import PathVariable # okay +from .BoolVariable import BoolVariable # okay +from .EnumVariable import EnumVariable # okay +from .ListVariable import ListVariable # naja +from .PackageVariable import PackageVariable # naja +from .PathVariable import PathVariable # okay class Variables(object): @@ -115,13 +115,13 @@ class Variables(object): """ Add an option. - key - the name of the variable, or a list or tuple of arguments - help - optional help text for the options - default - optional default value - validator - optional function that is called to validate the option's value - Called with (key, value, environment) - converter - optional function that is called to convert the option's value before - putting it in the environment. + + @param key: the name of the variable, or a list or tuple of arguments + @param help: optional help text for the options + @param default: optional default value + @param validator: optional function that is called to validate the option's value + @type validator: Called with (key, value, environment) + @param converter: optional function that is called to convert the option's value before putting it in the environment. """ if SCons.Util.is_List(key) or isinstance(key, tuple): @@ -141,14 +141,17 @@ class Variables(object): Each list element is a tuple/list of arguments to be passed on to the underlying method for adding options. - Example: - opt.AddVariables( + Example:: + + opt.AddVariables( ('debug', '', 0), ('CC', 'The C compiler'), ('VALIDATE', 'An option for testing validation', 'notset', validator, None), ) + """ + for o in optlist: self._do_add(*o) @@ -175,7 +178,9 @@ class Variables(object): sys.path.insert(0, dir) try: values['__name__'] = filename - exec open(filename, 'rU').read() in {}, values + with open(filename, 'r') as f: + contents = f.read() + exec(contents, {}, values) finally: if dir: del sys.path[0] @@ -211,7 +216,7 @@ class Variables(object): env[option.key] = option.converter(value) except TypeError: env[option.key] = option.converter(value, env) - except ValueError, x: + except ValueError as x: raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x)) @@ -273,7 +278,7 @@ class Variables(object): finally: fh.close() - except IOError, x: + except IOError as x: raise SCons.Errors.UserError('Error writing options to file: %s\n%s' % (filename, x)) def GenerateHelpText(self, env, sort=None): |