summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Variables
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Variables')
-rw-r--r--src/engine/SCons/Variables/BoolVariable.py8
-rw-r--r--src/engine/SCons/Variables/BoolVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/EnumVariable.py8
-rw-r--r--src/engine/SCons/Variables/EnumVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/ListVariable.py12
-rw-r--r--src/engine/SCons/Variables/ListVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/PackageVariable.py14
-rw-r--r--src/engine/SCons/Variables/PackageVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/PathVariable.py13
-rw-r--r--src/engine/SCons/Variables/PathVariableTests.py4
-rw-r--r--src/engine/SCons/Variables/VariablesTests.py20
-rw-r--r--src/engine/SCons/Variables/__init__.py11
12 files changed, 63 insertions, 43 deletions
diff --git a/src/engine/SCons/Variables/BoolVariable.py b/src/engine/SCons/Variables/BoolVariable.py
index c7310a7..e6ad86b 100644
--- a/src/engine/SCons/Variables/BoolVariable.py
+++ b/src/engine/SCons/Variables/BoolVariable.py
@@ -12,7 +12,7 @@ Usage example:
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/BoolVariable.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
__all__ = ['BoolVariable',]
@@ -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/BoolVariableTests.py b/src/engine/SCons/Variables/BoolVariableTests.py
index 75aa386..1977b5e 100644
--- a/src/engine/SCons/Variables/BoolVariableTests.py
+++ b/src/engine/SCons/Variables/BoolVariableTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/BoolVariableTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/BoolVariableTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import sys
import unittest
diff --git a/src/engine/SCons/Variables/EnumVariable.py b/src/engine/SCons/Variables/EnumVariable.py
index 734d48c..5fd4101 100644
--- a/src/engine/SCons/Variables/EnumVariable.py
+++ b/src/engine/SCons/Variables/EnumVariable.py
@@ -15,7 +15,7 @@ Usage example:
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/EnumVariable.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
__all__ = ['EnumVariable',]
@@ -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/EnumVariableTests.py b/src/engine/SCons/Variables/EnumVariableTests.py
index 07e7c8a..69fc92a 100644
--- a/src/engine/SCons/Variables/EnumVariableTests.py
+++ b/src/engine/SCons/Variables/EnumVariableTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/EnumVariableTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/EnumVariableTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import sys
import unittest
diff --git a/src/engine/SCons/Variables/ListVariable.py b/src/engine/SCons/Variables/ListVariable.py
index 5541f30..8e31d88 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:
@@ -25,7 +25,7 @@ Usage example:
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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,9 +46,9 @@ 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.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/ListVariable.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
-# 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/ListVariableTests.py b/src/engine/SCons/Variables/ListVariableTests.py
index 1c75402..e6600fc 100644
--- a/src/engine/SCons/Variables/ListVariableTests.py
+++ b/src/engine/SCons/Variables/ListVariableTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/ListVariableTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/ListVariableTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import copy
import sys
diff --git a/src/engine/SCons/Variables/PackageVariable.py b/src/engine/SCons/Variables/PackageVariable.py
index a0244e4..44d87cc 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
@@ -28,7 +28,7 @@ Usage example:
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/PackageVariable.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
__all__ = ['PackageVariable',]
@@ -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/PackageVariableTests.py b/src/engine/SCons/Variables/PackageVariableTests.py
index 6062704..af97dae 100644
--- a/src/engine/SCons/Variables/PackageVariableTests.py
+++ b/src/engine/SCons/Variables/PackageVariableTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/PackageVariableTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/PackageVariableTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import sys
import unittest
diff --git a/src/engine/SCons/Variables/PathVariable.py b/src/engine/SCons/Variables/PathVariable.py
index a7c68a8..081fee5 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:
@@ -46,7 +46,7 @@ Usage example:
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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 +68,7 @@ Usage example:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Variables/PathVariable.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/PathVariable.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
__all__ = ['PathVariable',]
@@ -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/PathVariableTests.py b/src/engine/SCons/Variables/PathVariableTests.py
index d741cca..18b4c19 100644
--- a/src/engine/SCons/Variables/PathVariableTests.py
+++ b/src/engine/SCons/Variables/PathVariableTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/PathVariableTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/PathVariableTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import os.path
import sys
diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py
index 300519b..88b2385 100644
--- a/src/engine/SCons/Variables/VariablesTests.py
+++ b/src/engine/SCons/Variables/VariablesTests.py
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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/Variables/VariablesTests.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/VariablesTests.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import sys
import unittest
@@ -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 57447d7..83ec1b2 100644
--- a/src/engine/SCons/Variables/__init__.py
+++ b/src/engine/SCons/Variables/__init__.py
@@ -5,7 +5,7 @@ customizable variables to an SCons build.
"""
#
-# Copyright (c) 2001 - 2015 The SCons Foundation
+# Copyright (c) 2001 - 2016 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.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
+__revision__ = "src/engine/SCons/Variables/__init__.py rel_2.5.0:3543:937e55cd78f7 2016/04/09 11:29:54 bdbaddog"
import os.path
import sys
@@ -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):