From 62e378bca3d09546f40e923034b51b2594068c5e Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 19 Jul 2001 12:15:37 +0000 Subject: [PATCH] Copy should allow you to update the construction variables. git-svn-id: http://scons.tigris.org/svn/scons/trunk@10 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/scons/Environment.py | 4 +++- src/scons/EnvironmentTests.py | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scons/Environment.py b/src/scons/Environment.py index c410162b..da71ba17 100644 --- a/src/scons/Environment.py +++ b/src/scons/Environment.py @@ -79,7 +79,9 @@ class Environment: (like a function). There are no references to any mutable objects in the original Environment. """ - return copy.deepcopy(self) + clone = copy.deepcopy(self) + apply(clone.Update, (), kw) + return clone def Scanners(self): pass # XXX diff --git a/src/scons/EnvironmentTests.py b/src/scons/EnvironmentTests.py index 5c6c151f..5d3e1ea3 100644 --- a/src/scons/EnvironmentTests.py +++ b/src/scons/EnvironmentTests.py @@ -61,6 +61,9 @@ class EnvironmentTestCase(unittest.TestCase): Update the copy independently afterwards and check that the original remains intact (that is, no dangling references point to objects in the copied environment). + Copy the original with some construction variable + updates and check that the original remains intact + and the copy has the updated values. """ env1 = Environment(XXX = 'x', YYY = 'y') env2 = env1.Copy() @@ -69,6 +72,12 @@ class EnvironmentTestCase(unittest.TestCase): assert env1 != env2 assert env1 == env1copy + env3 = env1.Copy(XXX = 'x3', ZZZ = 'z3') + assert env3.Dictionary['XXX'] == 'x3' + assert env3.Dictionary['YYY'] == 'y' + assert env3.Dictionary['ZZZ'] == 'z3' + assert env1 == env1copy + def test_Dictionary(self): """Test the simple ability to retrieve known construction variables from the Dictionary and check for well-known -- 2.26.2