diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2012-08-20 23:30:35 +0200 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2012-08-20 23:30:35 +0200 |
commit | 82c4addb364fffb1c647ff7e5fab201000719305 (patch) | |
tree | cc244c59579c58d9e8df6e157d8fc49510e0f494 /src/engine/SCons/Environment.py | |
parent | fa0c16e75fd6770db0a9eb67a37a9b420ba3fa4f (diff) | |
parent | 3d529f4ea2b0de42aa2144dbe904e564b7b0b813 (diff) |
Merge tag 'upstream/2.2.0'
Upstream version 2.2.0
Diffstat (limited to 'src/engine/SCons/Environment.py')
-rw-r--r-- | src/engine/SCons/Environment.py | 36 |
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)) |