summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Environment.py')
-rw-r--r--src/engine/SCons/Environment.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index de8e9ef..addf782 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -10,7 +10,7 @@ Environment
"""
#
-# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
+# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -31,7 +31,7 @@ Environment
# 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/Environment.py 5357 2011/09/09 21:31:03 bdeegan"
+__revision__ = "src/engine/SCons/Environment.py issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo"
import copy
@@ -72,6 +72,7 @@ CleanTargets = {}
CalculatorArgs = {}
semi_deepcopy = SCons.Util.semi_deepcopy
+semi_deepcopy_dict = SCons.Util.semi_deepcopy_dict
# Pull UserError into the global name space for the benefit of
# Environment().SourceSignatures(), which has some import statements
@@ -303,7 +304,9 @@ class BuilderDict(UserDict):
UserDict.__init__(self, dict)
def __semi_deepcopy__(self):
- return self.__class__(self.data, self.env)
+ # These cannot be copied since they would both modify the same builder object, and indeed
+ # just copying would modify the original builder
+ raise TypeError( 'cannot semi_deepcopy a BuilderDict' )
def __setitem__(self, item, val):
try:
@@ -1374,15 +1377,15 @@ class Base(SubstitutionEnvironment):
(like a function). There are no references to any mutable
objects in the original Environment.
"""
- clone = copy.copy(self)
- clone._dict = semi_deepcopy(self._dict)
-
try:
- cbd = clone._dict['BUILDERS']
+ builders = self._dict['BUILDERS']
except KeyError:
pass
- else:
- clone._dict['BUILDERS'] = BuilderDict(cbd, clone)
+
+ clone = copy.copy(self)
+ # BUILDERS is not safe to do a simple copy
+ clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS'])
+ clone._dict['BUILDERS'] = BuilderDict(builders, clone)
# Check the methods added via AddMethod() and re-bind them to
# the cloned environment. Only do this if the attribute hasn't
@@ -1733,7 +1736,7 @@ class Base(SubstitutionEnvironment):
except KeyError:
pass
else:
- kwbd = semi_deepcopy(kwbd)
+ kwbd = BuilderDict(kwbd,self)
del kw['BUILDERS']
self.__setitem__('BUILDERS', kwbd)
kw = copy_non_reserved_keywords(kw)
@@ -2228,14 +2231,11 @@ class Base(SubstitutionEnvironment):
sources.append(s)
build_source(node.all_children())
- # THIS CODE APPEARS TO HAVE NO EFFECT
- # # get the final srcnode for all nodes, this means stripping any
- # # attached build node by calling the srcnode function
- # for file in sources:
- # srcnode = file.srcnode()
- # while srcnode != file.srcnode():
- # srcnode = file.srcnode()
-
+ def final_source(node):
+ while (node != node.srcnode()):
+ node = node.srcnode()
+ return node
+ sources = map( final_source, sources );
# remove duplicates
return list(set(sources))