summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2014-07-30 00:34:37 +0200
committerDirk Baechle <dl9obn@darc.de>2014-07-30 00:34:37 +0200
commit67f3f8950bb1076382d816e859026018974ee132 (patch)
tree5ca20b55e848440e286dec5d233cb23d1671f47e
parentdfaf4c269aeb774c933fd9ed7e9a3b5aaa6d191a (diff)
parentc83fbe751e3a3d0f8e44eb97f9584f518b3a2b66 (diff)
downloadscons-git-67f3f8950bb1076382d816e859026018974ee132.tar.gz
Merged in manuelnaranjo/scons (pull request #159), added default for BUILDERS envvar
-rw-r--r--src/CHANGES.txt4
-rw-r--r--src/engine/SCons/Environment.py6
-rw-r--r--src/engine/SCons/EnvironmentTests.py5
3 files changed, 11 insertions, 4 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 17ee9751d..0ed523707 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -6,6 +6,10 @@
RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE
+ From Manuel Francisco Naranjo:
+ - Added a default for the BUILDERS environment variable,
+ to prevent not defined exception on a Clone().
+
From Andrew Featherstone:
- Added description of CheckTypeSize method (#1991).
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index d178f4902..77898551b 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -1378,10 +1378,8 @@ class Base(SubstitutionEnvironment):
(like a function). There are no references to any mutable
objects in the original Environment.
"""
- try:
- builders = self._dict['BUILDERS']
- except KeyError:
- pass
+
+ builders = self._dict.get('BUILDERS', {})
clone = copy.copy(self)
# BUILDERS is not safe to do a simple copy
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 523534289..b9ef3f2cb 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1892,6 +1892,11 @@ def generate(env):
env = env.Clone(KEY_THAT_I_WANT=6, tools=[my_tool])
assert env['KEY_THAT_I_WANT'] == real_value[0], env['KEY_THAT_I_WANT']
+ # test for pull request #150
+ env = self.TestEnvironment()
+ env._dict.pop('BUILDERS')
+ assert env.has_key('BUILDERS') is False
+ env2 = env.Clone()
def test_Copy(self):
"""Test copying using the old env.Copy() method"""