summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Variables
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2016-05-08 23:27:44 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2016-05-08 23:27:44 (GMT)
commitd86a8cf1f8e5aadca9bcd6b7481ab15eccc0530d (patch)
tree521ddb1071569fa90100e11d7f03af13d5689aaf /src/engine/SCons/Variables
parent98bb69c7c9e13ea57ae7e6e8db4740a4dd43ed16 (diff)
parent6a37189174372c9c98c63ada58ab4352adf650e8 (diff)
downloadSCons-d86a8cf1f8e5aadca9bcd6b7481ab15eccc0530d.zip
SCons-d86a8cf1f8e5aadca9bcd6b7481ab15eccc0530d.tar.gz
SCons-d86a8cf1f8e5aadca9bcd6b7481ab15eccc0530d.tar.bz2
merged
Diffstat (limited to 'src/engine/SCons/Variables')
-rw-r--r--src/engine/SCons/Variables/BoolVariable.py4
-rw-r--r--src/engine/SCons/Variables/EnumVariable.py4
-rw-r--r--src/engine/SCons/Variables/ListVariable.py8
-rw-r--r--src/engine/SCons/Variables/PackageVariable.py10
-rw-r--r--src/engine/SCons/Variables/PathVariable.py9
-rw-r--r--src/engine/SCons/Variables/VariablesTests.py16
-rw-r--r--src/engine/SCons/Variables/__init__.py7
7 files changed, 39 insertions, 19 deletions
diff --git a/src/engine/SCons/Variables/BoolVariable.py b/src/engine/SCons/Variables/BoolVariable.py
index 6bc66bb..c005a62 100644
--- a/src/engine/SCons/Variables/BoolVariable.py
+++ b/src/engine/SCons/Variables/BoolVariable.py
@@ -51,7 +51,7 @@ def _text2bool(val):
will be returned.
See '__true_strings' and '__false_strings' for values considered
- 'true' or 'false respectivly.
+ 'true' or 'false respectively.
This is usable as 'converter' for SCons' Variables.
"""
@@ -74,7 +74,7 @@ def _validator(key, val, env):
def BoolVariable(key, help, default):
"""
- The input parameters describe a boolen option, thus they are
+ The input parameters describe a boolean option, thus they are
returned with the correct converter and validator appended. The
'help' text will by appended by '(yes|no) to show the valid
valued. The result is usable for input to opts.Add().
diff --git a/src/engine/SCons/Variables/EnumVariable.py b/src/engine/SCons/Variables/EnumVariable.py
index 582be27..9448ba9 100644
--- a/src/engine/SCons/Variables/EnumVariable.py
+++ b/src/engine/SCons/Variables/EnumVariable.py
@@ -52,7 +52,7 @@ def _validator(key, val, env, vals):
def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0):
"""
- The input parameters describe a option with only certain values
+ The input parameters describe an option with only certain values
allowed. They are returned with an appropriate converter and
validator appended. The result is usable for input to
Variables.Add().
@@ -65,7 +65,7 @@ def EnumVariable(key, help, default, allowed_values, map={}, ignorecase=0):
for this option.
The 'map'-dictionary may be used for converting the input value
- into canonical values (eg. for aliases).
+ into canonical values (e.g. for aliases).
'ignorecase' defines the behaviour of the validator:
diff --git a/src/engine/SCons/Variables/ListVariable.py b/src/engine/SCons/Variables/ListVariable.py
index 413aacb..f2fdc18 100644
--- a/src/engine/SCons/Variables/ListVariable.py
+++ b/src/engine/SCons/Variables/ListVariable.py
@@ -4,7 +4,7 @@ This file defines the option type for SCons implementing 'lists'.
A 'list' option may either be 'all', 'none' or a list of names
separated by comma. After the option has been processed, the option
-value holds either the named list elements, all list elemens or no
+value holds either the named list elements, all list elements or no
list elements at all.
Usage example:
@@ -48,7 +48,7 @@ Usage example:
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-# Know Bug: This should behave like a Set-Type, but does not really,
+# Known Bug: This should behave like a Set-Type, but does not really,
# since elements can occur twice.
__all__ = ['ListVariable',]
@@ -106,14 +106,14 @@ def _converter(val, allowedElems, mapdict):
## def _validator(key, val, env):
## """
## """
-## # todo: write validater for pgk list
+## # todo: write validator for pgk list
## return 1
def ListVariable(key, help, default, names, map={}):
"""
The input parameters describe a 'package list' option, thus they
- are returned with the correct converter and validater appended. The
+ are returned with the correct converter and validator appended. The
result is usable for input to opts.Add() .
A 'package list' option may either be 'all', 'none' or a list of
diff --git a/src/engine/SCons/Variables/PackageVariable.py b/src/engine/SCons/Variables/PackageVariable.py
index 440d0f6..4ab0856 100644
--- a/src/engine/SCons/Variables/PackageVariable.py
+++ b/src/engine/SCons/Variables/PackageVariable.py
@@ -11,7 +11,7 @@ Usage example:
Examples:
x11=no (disables X11 support)
x11=yes (will search for the package installation dir)
- x11=/usr/local/X11 (will check this path for existance)
+ x11=/usr/local/X11 (will check this path for existence)
To replace autoconf's --with-xxx=yyy
@@ -70,10 +70,10 @@ def _converter(val):
def _validator(key, val, env, searchfunc):
- # NB: searchfunc is currenty undocumented and unsupported
+ # NB: searchfunc is currently undocumented and unsupported
"""
"""
- # todo: write validator, check for path
+ # TODO write validator, check for path
import os
if env[key] is True:
if searchfunc:
@@ -84,14 +84,14 @@ def _validator(key, val, env, searchfunc):
def PackageVariable(key, help, default, searchfunc=None):
- # NB: searchfunc is currenty undocumented and unsupported
+ # NB: searchfunc is currently undocumented and unsupported
"""
The input parameters describe a 'package list' option, thus they
are returned with the correct converter and validator appended. The
result is usable for input to opts.Add() .
A 'package list' option may either be 'all', 'none' or a list of
- package names (seperated by space).
+ package names (separated by space).
"""
help = '\n '.join(
(help, '( yes | no | /path/to/%s )' % key))
diff --git a/src/engine/SCons/Variables/PathVariable.py b/src/engine/SCons/Variables/PathVariable.py
index 951fc75..e615a53 100644
--- a/src/engine/SCons/Variables/PathVariable.py
+++ b/src/engine/SCons/Variables/PathVariable.py
@@ -2,7 +2,7 @@
This file defines an option type for SCons implementing path settings.
-To be used whenever a a user-specified path override should be allowed.
+To be used whenever a user-specified path override should be allowed.
Arguments to PathVariable are:
option-name = name of this option on the command line (e.g. "prefix")
@@ -22,7 +22,7 @@ Arguments to PathVariable are:
is valid. The arguments to the validator function
are: (key, val, env). The key is the name of the
option, the val is the path specified for the option,
- and the env is the env to which the Otions have been
+ and the env is the env to which the Options have been
added.
Usage example:
@@ -102,7 +102,7 @@ class _PathVariableClass(object):
os.makedirs(val)
def PathIsFile(self, key, val, env):
- """validator to check if Path is a file"""
+ """Validator to check if Path is a file"""
if not os.path.isfile(val):
if os.path.isdir(val):
m = 'File path for option %s is a directory: %s'
@@ -111,13 +111,12 @@ class _PathVariableClass(object):
raise SCons.Errors.UserError(m % (key, val))
def PathExists(self, key, val, env):
- """validator to check if Path exists"""
+ """Validator to check if Path exists"""
if not os.path.exists(val):
m = 'Path for option %s does not exist: %s'
raise SCons.Errors.UserError(m % (key, val))
def __call__(self, key, help, default, validator=None):
- # NB: searchfunc is currenty undocumented and unsupported
"""
The input parameters describe a 'path list' option, thus they
are returned with the correct converter and validator appended. The
diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py
index 3888d19..7f2a978 100644
--- a/src/engine/SCons/Variables/VariablesTests.py
+++ b/src/engine/SCons/Variables/VariablesTests.py
@@ -273,6 +273,22 @@ class VariablesTestCase(unittest.TestCase):
opts.Update(env, {})
assert 'ANSWER' not in env
+ def test_noaggregation(self):
+ """Test that the 'files' and 'args' attributes of the Variables class
+ don't aggregate entries from one instance to another.
+ This used to be a bug in SCons version 2.4.1 and earlier.
+ """
+
+ opts = SCons.Variables.Variables()
+ opts.files.append('custom.py')
+ opts.args['ANSWER'] = 54
+ nopts = SCons.Variables.Variables()
+
+ # Ensure that both attributes are initialized to
+ # an empty list and dict, respectively.
+ assert len(nopts.files) == 0
+ assert len(nopts.args) == 0
+
def test_args(self):
"""Test updating an Environment with arguments overridden"""
diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py
index 1c8d834..b03e5b5 100644
--- a/src/engine/SCons/Variables/__init__.py
+++ b/src/engine/SCons/Variables/__init__.py
@@ -50,12 +50,17 @@ class Variables(object):
Holds all the options, updates the environment with the variables,
and renders the help text.
"""
- def __init__(self, files=[], args={}, is_global=1):
+ def __init__(self, files=None, args=None, is_global=1):
"""
files - [optional] List of option configuration files to load
(backward compatibility) If a single string is passed it is
automatically placed in a file list
"""
+ # initialize arguments
+ if files is None:
+ files = []
+ if args is None:
+ args = {}
self.options = []
self.args = args
if not SCons.Util.is_List(files):