diff options
author | Steven Knight <knight@baldmt.com> | 2006-11-04 05:31:24 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2006-11-04 05:31:24 (GMT) |
commit | c36a10f28f1c38541757cbbe96d67cd87a2096e7 (patch) | |
tree | 6631963b4e4521d9a9a643edc1269409083e4651 | |
parent | 6fcc7d78858a5ca068e3deea183d35295b7dd88e (diff) | |
download | SCons-c36a10f28f1c38541757cbbe96d67cd87a2096e7.zip SCons-c36a10f28f1c38541757cbbe96d67cd87a2096e7.tar.gz SCons-c36a10f28f1c38541757cbbe96d67cd87a2096e7.tar.bz2 |
Merged revisions 1667-1674 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1672 | stevenknight | 2006-11-03 23:11:52 -0600 (Fri, 03 Nov 2006) | 1 line
0.96.D480 - Don't use UNIX logic to detect an executable qmtest.py on Windows.
........
r1673 | stevenknight | 2006-11-03 23:18:59 -0600 (Fri, 03 Nov 2006) | 1 line
0.96.D481 - Remove the print statement from the previous checkin.
........
r1674 | stevenknight | 2006-11-03 23:25:43 -0600 (Fri, 03 Nov 2006) | 1 line
0.96.D482 - Create a env.Clone() method and encourage its use in favor of env.Copy().
........
67 files changed, 293 insertions, 158 deletions
@@ -809,7 +809,7 @@ for p in [ scons ]: rpm_files.sort() rpm_files_str = string.join(rpm_files, "\n") + "\n" - rpm_spec_env = env.Copy(RPM_FILES = rpm_files_str) + rpm_spec_env = env.Clone(RPM_FILES = rpm_files_str) rpm_spec_action = Action(spec_function, varlist=['RPM_FILES']) rpm_spec_env.Command(specfile, specfile_in, rpm_spec_action) diff --git a/doc/SConscript b/doc/SConscript index 6f92fbc..b0a4ba1 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -31,7 +31,7 @@ import string Import('env', 'whereis') -env = env.Copy() +env = env.Clone() env.TargetSignatures('content') @@ -103,9 +103,9 @@ def scansgml(node, env, target): s = Scanner(name = 'sgml', function = scansgml, skeys = ['.sgml', '.mod']) orig_env = env -env = orig_env.Copy(SCANNERS = [s], - SCONS_PROC_PY = File('#bin/scons-proc.py').rfile(), - SCONSOUTPUT_PY = File('#bin/sconsoutput.py').rfile()) +env = orig_env.Clone(SCANNERS = [s], + SCONS_PROC_PY = File('#bin/scons-proc.py').rfile(), + SCONSOUTPUT_PY = File('#bin/sconsoutput.py').rfile()) # Fetch the list of files in the build engine that contain # SCons documentation XML for processing. diff --git a/doc/man/scons.1 b/doc/man/scons.1 index a12bd68..1b30e6a 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -1163,14 +1163,14 @@ would override the built-in gcc tool. Also note that the toolpath is stored in the environment for use by later calls to -.BR Copy () +.BR Clone () and .BR Tool () methods: .ES base = Environment(toolpath=['custom_path']) -derived = base.Copy(tools=['custom_tool']) +derived = base.Clone(tools=['custom_tool']) derived.CustomBuilder() .EE @@ -2274,7 +2274,7 @@ below, for a complete explanation of the arguments and behavior. '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP -.RI env.Copy([ key = val ", ...])" +.RI env.Clone([ key = val ", ...])" Return a separate copy of a construction environment. If there are any keyword arguments specified, they are added to the returned copy, @@ -2282,8 +2282,8 @@ overwriting any existing values for the keywords. .ES -env2 = env.Copy() -env3 = env.Copy(CCFLAGS = '-g') +env2 = env.Clone() +env3 = env.Clone(CCFLAGS = '-g') .EE .IP Additionally, a list of tools and a toolpath may be specified, as in @@ -2291,11 +2291,18 @@ the Environment constructor: .ES def MyTool(env): env['FOO'] = 'bar' -env4 = env.Copy(tools = ['msvc', MyTool]) +env4 = env.Clone(tools = ['msvc', MyTool]) .EE '\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" .TP +.RI env.Copy([ key = val ", ...])" +A synonym for +env.Clone(). +(This will probably be officially deprecated some day.) + +'\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.TP .RI env.CVS( repository ", " module ) A factory function that returns a Builder object @@ -4400,11 +4407,11 @@ env = Environment(CC="cc") .EE or when copying a construction environment using the -.B Copy +.B Clone method: .ES -env2 = env.Copy(CC="cl.exe") +env2 = env.Clone(CC="cl.exe") .EE .SS Configure Contexts diff --git a/doc/user/environments.in b/doc/user/environments.in index 9b5c348..ae453a0 100644 --- a/doc/user/environments.in +++ b/doc/user/environments.in @@ -620,7 +620,7 @@ environment undisturbed. to share the same values for one or more variables. Rather than always having to repeat all of the common variables when you create each construction environment, - you can use the &Copy; method + you can use the &Clone; method to create a copy of a construction environment. </para> @@ -628,7 +628,7 @@ environment undisturbed. <para> Like the &Environment; call that creates a construction environment, - the &Copy; method takes &consvar; assignments, + the &Clone; method takes &consvar; assignments, which will override the values in the copied construction environment. For example, suppose we want to use &gcc; to create three versions of a program, @@ -644,8 +644,8 @@ environment undisturbed. <scons_example name="ex5"> <file name="SConstruct" printme="1"> env = Environment(CC = 'gcc') - opt = env.Copy(CCFLAGS = '-O2') - dbg = env.Copy(CCFLAGS = '-g') + opt = env.Clone(CCFLAGS = '-O2') + dbg = env.Clone(CCFLAGS = '-g') env.Program('foo', 'foo.c') diff --git a/doc/user/environments.sgml b/doc/user/environments.sgml index 14be5af..90f6e3f 100644 --- a/doc/user/environments.sgml +++ b/doc/user/environments.sgml @@ -610,7 +610,7 @@ environment undisturbed. to share the same values for one or more variables. Rather than always having to repeat all of the common variables when you create each construction environment, - you can use the &Copy; method + you can use the &Clone; method to create a copy of a construction environment. </para> @@ -618,7 +618,7 @@ environment undisturbed. <para> Like the &Environment; call that creates a construction environment, - the &Copy; method takes &consvar; assignments, + the &Clone; method takes &consvar; assignments, which will override the values in the copied construction environment. For example, suppose we want to use &gcc; to create three versions of a program, @@ -633,8 +633,8 @@ environment undisturbed. <programlisting> env = Environment(CC = 'gcc') - opt = env.Copy(CCFLAGS = '-O2') - dbg = env.Copy(CCFLAGS = '-g') + opt = env.Clone(CCFLAGS = '-O2') + dbg = env.Clone(CCFLAGS = '-g') env.Program('foo', 'foo.c') diff --git a/doc/user/hierarchy.in b/doc/user/hierarchy.in index 355aca3..2ec3fd3 100644 --- a/doc/user/hierarchy.in +++ b/doc/user/hierarchy.in @@ -638,7 +638,7 @@ make no difference to the build. <sconstruct> Import('env', 'debug') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </sconstruct> @@ -652,7 +652,7 @@ make no difference to the build. <sconstruct> Import('env debug') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </sconstruct> @@ -667,7 +667,7 @@ make no difference to the build. <sconstruct> Import('*') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </sconstruct> diff --git a/doc/user/hierarchy.sgml b/doc/user/hierarchy.sgml index 8281175..047545d 100644 --- a/doc/user/hierarchy.sgml +++ b/doc/user/hierarchy.sgml @@ -602,7 +602,7 @@ make no difference to the build. <programlisting> Import('env', 'debug') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </programlisting> @@ -616,7 +616,7 @@ make no difference to the build. <programlisting> Import('env debug') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </programlisting> @@ -631,7 +631,7 @@ make no difference to the build. <programlisting> Import('*') - env = env.Copy(DEBUG = debug) + env = env.Clone(DEBUG = debug) env.Program('prog', ['prog.c']) </programlisting> @@ -233,18 +233,31 @@ runtest.py: No tests were specified. """) sys.exit(1) +if sys.platform in ('win32', 'cygwin'): + + def whereis(file): + pathext = [''] + string.split(os.environ['PATHEXT']) + for dir in string.split(os.environ['PATH'], os.pathsep): + f = os.path.join(dir, file) + for ext in pathext: + fext = f + ext + if os.path.isfile(fext): + return fext + return None -def whereis(file): - for dir in string.split(os.environ['PATH'], os.pathsep): - f = os.path.join(dir, file) - if os.path.isfile(f): - try: - st = os.stat(f) - except OSError: - continue - if stat.S_IMODE(st[stat.ST_MODE]) & 0111: - return f - return None +else: + + def whereis(file): + for dir in string.split(os.environ['PATH'], os.pathsep): + f = os.path.join(dir, file) + if os.path.isfile(f): + try: + st = os.stat(f) + except OSError: + continue + if stat.S_IMODE(st[stat.ST_MODE]) & 0111: + return f + return None try: qmtest diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 88e70dc..778825e 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -89,6 +89,10 @@ RELEASE 0.97 - XXX - Document the difference in construction variable expansion between {Action,Builder}() and env.{Action,Builder}(). + - Change the name of env.Copy() to env.Clone(), keeping the old name + around for backwards compatibility (with the intention of eventually + phasing it out to avoid confusion with the Copy() Action factory). + From Arve Knudsen: - Support cleaning and scanning SWIG-generated files. diff --git a/src/RELEASE.txt b/src/RELEASE.txt index b5c0374..0c5f587 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -467,6 +467,45 @@ RELEASE 0.96.92 - Mon, 10 Apr 2006 21:08:22 -0400 SourceFileScanner.add_scanner('.x', XScanner) + -- THE env.Copy() METHOD WILL CHANGE OR GO AWAY ENTIRELY + + The env.Copy() method (to make a copy of a construction + environment) is being replaced by the env.Clone() method. + + In some future release, a deprecation warning will be added + to current uses of the env.Copy() method. At some point after + the deprecation warning, the env.Copy() method will either be + removed entirely or have its behavior changed. + + You can prepare for this by changing all your uses of env.Copy() + to env.Clone(), which has the exact same calling arguments. + + NOTE: CHANGING USES OF env.Copy() TO env.Clone() WILL MAKE YOUR + SConscript FILES NOT WORK ON EARLIER VERSIONS OF SCons. + + If you change SConscript files in software that you make available + for download or otherwise distribute, other users may try to + build your software with an earlier version of SCons that does + not have the env.Clone() method. We recommend preparing for + this in one of two ways: + + -- Make your SConscript files backwards-compatible by + including the following code near the beginning of your + top-level SConstruct file: + + import SCons.Environment + try: + SCons.Environment.Environment.Clone + except AttributeError: + SCons.Environment.Environment.Clone = \ + SCons.Environment.Environment.Copy + + -- Use the EnsureSConsVersion() function to provide a + descriptive error message if your SConscript files + are executed by an earlier version of SCons: + + EnsureSConsVersion(0, 96, 93) + SCons is developed with an extensive regression test suite, and a rigorous development methodology for continually improving that suite. Because of this, SCons is of sufficient quality that you can use it diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 57910de..2c6d915 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -152,7 +152,7 @@ class Environment: return self.d.items() def Dictionary(self): return self.d - def Copy(self, **kw): + def Clone(self, **kw): res = Environment() res.d = SCons.Environment.our_deepcopy(self.d) for k, v in kw.items(): @@ -908,7 +908,7 @@ class CommandActionTestCase(unittest.TestCase): cmd1 = r'%s %s %s xyzzy' % (_python_, act_py, outfile) act = SCons.Action.CommandAction(cmd1) - r = act([], [], env.Copy()) + r = act([], [], env.Clone()) assert r == 0 c = test.read(outfile, 'r') assert c == "act.py: 'xyzzy'\n", c @@ -916,7 +916,7 @@ class CommandActionTestCase(unittest.TestCase): cmd2 = r'%s %s %s $TARGET' % (_python_, act_py, outfile) act = SCons.Action.CommandAction(cmd2) - r = act(DummyNode('foo'), [], env.Copy()) + r = act(DummyNode('foo'), [], env.Clone()) assert r == 0 c = test.read(outfile, 'r') assert c == "act.py: 'foo'\n", c @@ -924,7 +924,7 @@ class CommandActionTestCase(unittest.TestCase): cmd3 = r'%s %s %s ${TARGETS}' % (_python_, act_py, outfile) act = SCons.Action.CommandAction(cmd3) - r = act(map(DummyNode, ['aaa', 'bbb']), [], env.Copy()) + r = act(map(DummyNode, ['aaa', 'bbb']), [], env.Clone()) assert r == 0 c = test.read(outfile, 'r') assert c == "act.py: 'aaa' 'bbb'\n", c @@ -932,7 +932,7 @@ class CommandActionTestCase(unittest.TestCase): cmd4 = r'%s %s %s $SOURCES' % (_python_, act_py, outfile) act = SCons.Action.CommandAction(cmd4) - r = act([], [DummyNode('one'), DummyNode('two')], env.Copy()) + r = act([], [DummyNode('one'), DummyNode('two')], env.Clone()) assert r == 0 c = test.read(outfile, 'r') assert c == "act.py: 'one' 'two'\n", c @@ -941,7 +941,7 @@ class CommandActionTestCase(unittest.TestCase): act = SCons.Action.CommandAction(cmd4) sources = [DummyNode('three'), DummyNode('four'), DummyNode('five')] - env2 = env.Copy() + env2 = env.Clone() r = act([], source = sources, env = env2) assert r == 0 c = test.read(outfile, 'r') @@ -964,7 +964,7 @@ class CommandActionTestCase(unittest.TestCase): act = SCons.Action.CommandAction(cmd5) r = act(target = DummyNode('out5'), source = [], - env = env.Copy(ENV = {'XYZZY' : 'xyzzy5', + env = env.Clone(ENV = {'XYZZY' : 'xyzzy5', 'PATH' : PATH})) assert r == 0 c = test.read(outfile, 'r') @@ -985,7 +985,7 @@ class CommandActionTestCase(unittest.TestCase): act = SCons.Action.CommandAction(cmd6) r = act(target = [Obj('111'), Obj('222')], source = [Obj('333'), Obj('444'), Obj('555')], - env = env.Copy()) + env = env.Clone()) assert r == 0 c = test.read(outfile, 'r') assert c == "act.py: '222' '111' '333' '444'\n", c @@ -1004,18 +1004,18 @@ class CommandActionTestCase(unittest.TestCase): # Test that a nonexistent command returns 127 act = SCons.Action.CommandAction(python + "_no_such_command_") - r = act([], [], env.Copy(out = outfile)) + r = act([], [], env.Clone(out = outfile)) assert r == expect_nonexistent, "r == %d" % r # Test that trying to execute a directory returns 126 dir, tail = os.path.split(python) act = SCons.Action.CommandAction(dir) - r = act([], [], env.Copy(out = outfile)) + r = act([], [], env.Clone(out = outfile)) assert r == expect_nonexecutable, "r == %d" % r # Test that trying to execute a non-executable file returns 126 act = SCons.Action.CommandAction(outfile) - r = act([], [], env.Copy(out = outfile)) + r = act([], [], env.Clone(out = outfile)) assert r == expect_nonexecutable, "r == %d" % r act = SCons.Action.CommandAction('%s %s 1' % (_python_, exit_py)) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 7aa1909..a5bffc8 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -474,7 +474,7 @@ class SubstitutionEnvironment: the overrides dictionaries. "overrides" is a dictionary that will override the variables of this environment. - This function is much more efficient than Copy() or creating + This function is much more efficient than Clone() or creating a new Environment because it doesn't copy the construction environment dictionary, it just wraps the underlying construction environment, and doesn't even create a wrapper object if there @@ -999,7 +999,7 @@ class Base(SubstitutionEnvironment): self._dict[key] = self._dict[key] + val self.scanner_map_delete(kw) - def Copy(self, tools=[], toolpath=None, **kw): + def Clone(self, tools=[], toolpath=None, **kw): """Return a copy of a construction Environment. The copy is like a Python "deep copy"--that is, independent copies are made recursively of each objects--except that @@ -1023,9 +1023,12 @@ class Base(SubstitutionEnvironment): for key, value in kw.items(): new[key] = SCons.Subst.scons_subst_once(value, self, key) apply(clone.Replace, (), new) - if __debug__: logInstanceCreation(self, 'Environment.EnvironmentCopy') + if __debug__: logInstanceCreation(self, 'Environment.EnvironmentClone') return clone + def Copy(self, *args, **kw): + return apply(self.Clone, args, kw) + def Detect(self, progs): """Return the first available program in progs. __cacheable__ """ diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 52aac23..edf3740 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -834,7 +834,7 @@ class BaseTestCase(unittest.TestCase,TestEnvironmentFixture): assert built_it['out2'] assert built_it['out3'] - env4 = env3.Copy() + env4 = env3.Clone() assert env4.builder1.env is env4, "builder1.env (%s) == env3 (%s)?" % (env4.builder1.env, env3) assert env4.builder2.env is env4, "builder2.env (%s) == env3 (%s)?" % (env4.builder1.env, env3) @@ -915,7 +915,7 @@ class BaseTestCase(unittest.TestCase,TestEnvironmentFixture): s = map(env.get_scanner, suffixes) assert s == [s1, s1, None, s2, s3], s - env = env.Copy(SCANNERS = [s2]) + env = env.Clone(SCANNERS = [s2]) s = map(env.get_scanner, suffixes) assert s == [None, None, None, s2, None], s @@ -1468,19 +1468,19 @@ def exists(env): assert isinstance(result, CLVar), repr(result) assert result == ['bar'], result - def test_Copy(self): + def test_Clone(self): """Test construction environment copying 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 + Clone the original with some construction variable updates and check that the original remains intact and the copy has the updated values. """ env1 = self.TestEnvironment(XXX = 'x', YYY = 'y') - env2 = env1.Copy() - env1copy = env1.Copy() + env2 = env1.Clone() + env1copy = env1.Clone() assert env1copy == env1copy assert env2 == env2 env2.Replace(YYY = 'yyy') @@ -1488,7 +1488,7 @@ def exists(env): assert env1 != env2 assert env1 == env1copy - env3 = env1.Copy(XXX = 'x3', ZZZ = 'z3') + env3 = env1.Clone(XXX = 'x3', ZZZ = 'z3') assert env3 == env3 assert env3.Dictionary('XXX') == 'x3' assert env3.Dictionary('YYY') == 'y' @@ -1501,7 +1501,7 @@ def exists(env): pass env1 = self.TestEnvironment(XXX=TestA(), YYY = [ 1, 2, 3 ], ZZZ = { 1:2, 3:4 }) - env2=env1.Copy() + env2=env1.Clone() env2.Dictionary('YYY').append(4) env2.Dictionary('ZZZ')[5] = 6 assert env1.Dictionary('XXX') is env2.Dictionary('XXX') @@ -1514,7 +1514,7 @@ def exists(env): env1 = self.TestEnvironment(BUILDERS = {'b1' : 1}) assert hasattr(env1, 'b1'), "env1.b1 was not set" assert env1.b1.env == env1, "b1.env doesn't point to env1" - env2 = env1.Copy(BUILDERS = {'b2' : 2}) + env2 = env1.Clone(BUILDERS = {'b2' : 2}) assert env2 is env2 assert env2 == env2 assert hasattr(env1, 'b1'), "b1 was mistakenly cleared from env1" @@ -1529,8 +1529,8 @@ def exists(env): def bar(env): env['BAR'] = 2 def baz(env): env['BAZ'] = 3 env1 = self.TestEnvironment(tools=[foo]) - env2 = env1.Copy() - env3 = env1.Copy(tools=[bar, baz]) + env2 = env1.Clone() + env3 = env1.Clone(tools=[bar, baz]) assert env1.get('FOO') is 1 assert env1.get('BAR') is None @@ -1545,7 +1545,7 @@ def exists(env): # Ensure that recursive variable substitution when copying # environments works properly. env1 = self.TestEnvironment(CCFLAGS = '-DFOO', XYZ = '-DXYZ') - env2 = env1.Copy(CCFLAGS = '$CCFLAGS -DBAR', + env2 = env1.Clone(CCFLAGS = '$CCFLAGS -DBAR', XYZ = ['-DABC', 'x $XYZ y', '-DDEF']) x = env2.get('CCFLAGS') assert x == '-DFOO -DBAR', x @@ -1557,7 +1557,7 @@ def exists(env): env1 = self.TestEnvironment(FLAGS = CLVar('flag1 flag2')) x = env1.get('FLAGS') assert x == ['flag1', 'flag2'], x - env2 = env1.Copy() + env2 = env1.Clone() env2.Append(FLAGS = 'flag3 flag4') x = env2.get('FLAGS') assert x == ['flag1', 'flag2', 'flag3', 'flag4'], x @@ -1582,9 +1582,21 @@ def generate(env): env = self.TestEnvironment(tools=['xxx'], toolpath=[test.workpath('')]) assert env['XXX'] == 'one', env['XXX'] - env = env.Copy(tools=['yyy']) + env = env.Clone(tools=['yyy']) assert env['YYY'] == 'two', env['YYY'] + def test_Copy(self): + """Test copying using the old env.Copy() method""" + env1 = self.TestEnvironment(XXX = 'x', YYY = 'y') + env2 = env1.Copy() + env1copy = env1.Copy() + assert env1copy == env1copy + assert env2 == env2 + env2.Replace(YYY = 'yyy') + assert env2 == env2 + assert env1 != env2 + assert env1 == env1copy + def test_Detect(self): """Test Detect()ing tools""" test = TestCmd.TestCmd(workdir = '') @@ -3166,11 +3178,11 @@ def generate(env): for x in added: assert env.has_key(x), bad_msg % x - copy = env.Copy(TARGETS = 'targets', - SOURCES = 'sources', - SOURCE = 'source', - TARGET = 'target', - COPY = 'copy') + copy = env.Clone(TARGETS = 'targets', + SOURCES = 'sources', + SOURCE = 'source', + TARGET = 'target', + COPY = 'copy') for x in reserved: assert not copy.has_key(x), env[x] for x in added + ['COPY']: @@ -3341,10 +3353,10 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture): # SourceSignatures() # TargetSignatures() - # It's unlikely Copy() will ever be called this way, so let the + # It's unlikely Clone() will ever be called this way, so let the # other methods test that handling overridden values works. - #def test_Copy(self): - # """Test the OverrideEnvironment Copy() method""" + #def test_Clone(self): + # """Test the OverrideEnvironment Clone() method""" # pass def test_FindIxes(self): diff --git a/src/engine/SCons/SConfTests.py b/src/engine/SCons/SConfTests.py index 0acbee3..3ad4cc7 100644 --- a/src/engine/SCons/SConfTests.py +++ b/src/engine/SCons/SConfTests.py @@ -386,7 +386,7 @@ int main() { def libs(env): return env.get('LIBS', []) - env = sconf.env.Copy() + env = sconf.env.Clone() try: r = sconf.CheckLib( existing_lib, "main", autoadd=1 ) @@ -395,7 +395,7 @@ int main() { got = libs(sconf.env) assert got == expect, "LIBS: expected %s, got %s" % (expect, got) - sconf.env = env.Copy() + sconf.env = env.Clone() r = sconf.CheckLib( existing_lib, "main", autoadd=0 ) assert r, "did not find main in %s" % existing_lib expect = libs(env) @@ -449,7 +449,7 @@ int main() { def libs(env): return env.get('LIBS', []) - env = sconf.env.Copy() + env = sconf.env.Clone() try: r = sconf.CheckLibWithHeader( existing_lib, "math.h", "C", autoadd=1 ) @@ -458,7 +458,7 @@ int main() { got = libs(sconf.env) assert got == expect, "LIBS: expected %s, got %s" % (expect, got) - sconf.env = env.Copy() + sconf.env = env.Clone() r = sconf.CheckLibWithHeader( existing_lib, "math.h", "C", autoadd=0 ) assert r, "did not find math.h with %s" % existing_lib expect = libs(env) diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index eff8f97..b100473 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -795,7 +795,7 @@ def scons_subst_once(strSubst, env, key): in an Environment. We want to capture (expand) the old value before we override it, so people can do things like: - env2 = env.Copy(CCFLAGS = '$CCFLAGS -g') + env2 = env.Clone(CCFLAGS = '$CCFLAGS -g') We do this with some straightforward, brute-force code here... """ diff --git a/test/AS/AS.py b/test/AS/AS.py index 2c9e624..8bfa740 100644 --- a/test/AS/AS.py +++ b/test/AS/AS.py @@ -182,8 +182,8 @@ os.system(cmd) test.write('SConstruct', """\ aaa = Environment() -bbb = aaa.Copy(AS = r'%(_python_)s wrapper.py ' + WhereIs('as')) -ccc = aaa.Copy(CPPPATH=['.']) +bbb = aaa.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('as')) +ccc = aaa.Clone(CPPPATH=['.']) aaa.Program(target = 'aaa', source = ['aaa.s', 'aaa_main.c']) bbb.Program(target = 'bbb', source = ['bbb.s', 'bbb_main.c']) ccc.Program(target = 'ccc', source = ['ccc.S', 'ccc_main.c']) @@ -317,7 +317,7 @@ import os ccc = Environment(tools = ['msvc', 'mslink', 'masm'], ASFLAGS = '/nologo /coff') ccc['ENV']['PATH'] = ccc['ENV']['PATH'] + os.pathsep + os.environ['PATH'] -ddd = ccc.Copy(AS = r'%(_python_)s wrapper.py ' + ccc['AS']) +ddd = ccc.Clone(AS = r'%(_python_)s wrapper.py ' + ccc['AS']) ccc.Program(target = 'ccc', source = ['ccc.asm', 'ccc_main.c']) ddd.Program(target = 'ddd', source = ['ddd.asm', 'ddd_main.c']) """ % locals()) @@ -407,7 +407,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ eee = Environment(tools = ['gcc', 'gnulink', 'nasm'], ASFLAGS = '-f %(nasm_format)s') -fff = eee.Copy(AS = r'%(_python_)s wrapper.py ' + WhereIs('nasm')) +fff = eee.Clone(AS = r'%(_python_)s wrapper.py ' + WhereIs('nasm')) eee.Program(target = 'eee', source = ['eee.asm', 'eee_main.c']) fff.Program(target = 'fff', source = ['fff.asm', 'fff_main.c']) """ % locals()) diff --git a/test/Actions/pre-post.py b/test/Actions/pre-post.py index e076f24..7566f2f 100644 --- a/test/Actions/pre-post.py +++ b/test/Actions/pre-post.py @@ -121,7 +121,7 @@ print "B =", B print "B.env =", B.env env1.Append(BUILDERS = {'B' : B}) env2.Append(BUILDERS = {'B' : B}) -env3 = env1.Copy(X='333') +env3 = env1.Clone(X='333') print "env1 =", env1 print "env2 =", env2 print "env3 =", env3 diff --git a/test/BuildDir/BuildDir.py b/test/BuildDir/BuildDir.py index f655bf9..f308579 100644 --- a/test/BuildDir/BuildDir.py +++ b/test/BuildDir/BuildDir.py @@ -113,7 +113,7 @@ env.Command(target='f3.h', source='f3h.in', action=buildIt) env.Command(target='f4.h', source='f4h.in', action=buildIt) env.Command(target='f4.c', source='f4.in', action=buildIt) -env2=env.Copy(CPPPATH='.') +env2=env.Clone(CPPPATH='.') env2.Program(target='foo3', source='f3.c') env2.Program(target='foo4', source='f4.c') @@ -124,8 +124,8 @@ except: if fortran and env.Detect(fortran): env.Command(target='b2.f', source='b2.in', action=buildIt) - env.Copy(LIBS = %s).Program(target='bar2', source='b2.f') - env.Copy(LIBS = %s).Program(target='bar1', source='b1.f') + env.Clone(LIBS = %s).Program(target='bar2', source='b2.f') + env.Clone(LIBS = %s).Program(target='bar1', source='b1.f') """ % (fortran_runtime, fortran_runtime)) test.write(['work1', 'src', 'f1.c'], r""" diff --git a/test/BuildDir/CPPPATH-subdir.py b/test/BuildDir/CPPPATH-subdir.py index 2ae50b5..7254279 100644 --- a/test/BuildDir/CPPPATH-subdir.py +++ b/test/BuildDir/CPPPATH-subdir.py @@ -51,7 +51,7 @@ SConscript(dirs=['glscry']) test.write(['src', 'glscry', 'SConscript'], """\ Import('*') -env = env.Copy() +env = env.Clone() env.Append(CPPPATH=['.']) env.Library('foo', 'foo.c') """) diff --git a/test/BuildDir/nested-sconscripts.py b/test/BuildDir/nested-sconscripts.py index d9e110e..f6dd13b 100644 --- a/test/BuildDir/nested-sconscripts.py +++ b/test/BuildDir/nested-sconscripts.py @@ -43,7 +43,7 @@ BUILD_DIR = '../build' base_env = Environment() for flavor in ['prod', 'debug']: - build_env = base_env.Copy() + build_env = base_env.Clone() # In real life, we would modify build_env appropriately here FLAVOR_DIR = BUILD_DIR + '/' + flavor Export('build_env') diff --git a/test/CC/SHCCFLAGS.py b/test/CC/SHCCFLAGS.py index 316da0f..fc9264f 100644 --- a/test/CC/SHCCFLAGS.py +++ b/test/CC/SHCCFLAGS.py @@ -50,11 +50,11 @@ foo.SharedLibrary(target = 'foo', source = foo_obj) bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c') bar.SharedLibrary(target = 'bar', source = bar_obj) -fooMain = foo.Copy(LIBS='foo', LIBPATH='.') +fooMain = foo.Clone(LIBS='foo', LIBPATH='.') foomain_obj = fooMain.Object(target='foomain', source='main.c') fooMain.Program(target='fooprog', source=foomain_obj) -barMain = bar.Copy(LIBS='bar', LIBPATH='.') +barMain = bar.Clone(LIBS='bar', LIBPATH='.') barmain_obj = barMain.Object(target='barmain', source='main.c') barMain.Program(target='barprog', source=barmain_obj) """ % (fooflags, barflags)) @@ -116,7 +116,7 @@ bar.SharedLibrary(target = 'foo', source = foo_obj) bar_obj = bar.SharedObject(target = 'bar', source = 'prog.c') bar.SharedLibrary(target = 'bar', source = bar_obj) -barMain = bar.Copy(LIBS='bar', LIBPATH='.') +barMain = bar.Clone(LIBS='bar', LIBPATH='.') foomain_obj = barMain.Object(target='foomain', source='main.c') barmain_obj = barMain.Object(target='barmain', source='main.c') barMain.Program(target='barprog', source=foomain_obj) diff --git a/test/CFILESUFFIX.py b/test/CFILESUFFIX.py index 9cbadf2..1fa615a 100644 --- a/test/CFILESUFFIX.py +++ b/test/CFILESUFFIX.py @@ -48,7 +48,7 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(LEX = r'%(_python_)s mylex.py', tools = ['lex']) env.CFile(target = 'foo', source = 'foo.l') -env.Copy(CFILESUFFIX = '.xyz').CFile(target = 'bar', source = 'bar.l') +env.Clone(CFILESUFFIX = '.xyz').CFile(target = 'bar', source = 'bar.l') """ % locals()) input = r""" diff --git a/test/CPPDEFINES.py b/test/CPPDEFINES.py index 8639eb2..61aaecd 100644 --- a/test/CPPDEFINES.py +++ b/test/CPPDEFINES.py @@ -55,10 +55,10 @@ test_list = [ ] env = Environment(CPPDEFPREFIX='-D', CPPDEFSUFFIX='') for i in test_list: - print env.Copy(CPPDEFINES=i).subst('$_CPPDEFFLAGS') + print env.Clone(CPPDEFINES=i).subst('$_CPPDEFFLAGS') env = Environment(CPPDEFPREFIX='|', CPPDEFSUFFIX='|') for i in test_list: - print env.Copy(CPPDEFINES=i).subst('$_CPPDEFFLAGS') + print env.Clone(CPPDEFINES=i).subst('$_CPPDEFFLAGS') """) expect = test.wrap_stdout(build_str="scons: `.' is up to date.\n", diff --git a/test/CXX/CXXFILESUFFIX.py b/test/CXX/CXXFILESUFFIX.py index 62e8cc1..b156f74 100644 --- a/test/CXX/CXXFILESUFFIX.py +++ b/test/CXX/CXXFILESUFFIX.py @@ -48,7 +48,7 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(LEX = r'%(_python_)s mylex.py', tools = ['lex']) env.CXXFile(target = 'foo', source = 'foo.ll') -env.Copy(CXXFILESUFFIX = '.xyz').CXXFile(target = 'bar', source = 'bar.ll') +env.Clone(CXXFILESUFFIX = '.xyz').CXXFile(target = 'bar', source = 'bar.ll') """ % locals()) input = r""" diff --git a/test/CXX/SHCXXFLAGS.py b/test/CXX/SHCXXFLAGS.py index 049835c..bfe1a79 100644 --- a/test/CXX/SHCXXFLAGS.py +++ b/test/CXX/SHCXXFLAGS.py @@ -50,11 +50,11 @@ bar.SharedObject(target = 'bar%s', source = 'prog.cpp') foo.SharedLibrary(target = 'foo', source = 'foo%s') bar.SharedLibrary(target = 'bar', source = 'bar%s') -fooMain = foo.Copy(LIBS='foo', LIBPATH='.') +fooMain = foo.Clone(LIBS='foo', LIBPATH='.') foo_obj = fooMain.Object(target='foomain', source='main.c') fooMain.Program(target='fooprog', source=foo_obj) -barMain = bar.Copy(LIBS='bar', LIBPATH='.') +barMain = bar.Clone(LIBS='bar', LIBPATH='.') bar_obj = barMain.Object(target='barmain', source='main.c') barMain.Program(target='barprog', source=bar_obj) """ % (fooflags, barflags, _obj, _obj, _obj, _obj)) @@ -114,7 +114,7 @@ bar.SharedObject(target = 'bar%s', source = 'prog.cpp') bar.SharedLibrary(target = 'foo', source = 'foo%s') bar.SharedLibrary(target = 'bar', source = 'bar%s') -barMain = bar.Copy(LIBS='bar', LIBPATH='.') +barMain = bar.Clone(LIBS='bar', LIBPATH='.') foo_obj = barMain.Object(target='foomain', source='main.c') bar_obj = barMain.Object(target='barmain', source='main.c') barMain.Program(target='barprog', source=foo_obj) diff --git a/test/Clone-compatibility.py b/test/Clone-compatibility.py new file mode 100644 index 0000000..53719e9 --- /dev/null +++ b/test/Clone-compatibility.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Verify that a specific snippet of backwards-compatibility code works. + +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ + +# When the 0.96.93 release introduced the env.Clone() we advertised this +# code as the correct pattern for maintaining the backwards compatibility +# of SConstruct files to earlier release of SCons. Going forward, make +# sure it still works (or at least doesn't blow up). +import SCons.Environment +try: + SCons.Environment.Environment.Clone +except AttributeError: + SCons.Environment.Environment.Clone = SCons.Environment.Environment.Copy + +env1 = Environment(X = 1) +env2 = env1.Clone(X = 2) + +print env1['X'] +print env2['X'] +""") + +test.run(arguments = '-q -Q', stdout = "1\n2\n") + +test.pass_test() diff --git a/test/Copy-Option.py b/test/Copy-Option.py index 505d69b..25b6054 100644 --- a/test/Copy-Option.py +++ b/test/Copy-Option.py @@ -47,7 +47,7 @@ opts.AddOptions( gpib_options), ) env = Environment(options = opts, CPPPATH = ['#/']) -new_env=env.Copy() +new_env=env.Clone() """) test.run(arguments = '.') diff --git a/test/DirSource.py b/test/DirSource.py index 3b8566c..fa07a88 100644 --- a/test/DirSource.py +++ b/test/DirSource.py @@ -57,7 +57,7 @@ env = Environment() env['BUILDERS']['TestDir'] = test_bld_dir env['BUILDERS']['TestFile'] = test_bld_file -env_bsig = env.Copy() +env_bsig = env.Clone() env_bsig.TargetSignatures('build') env_bsig.TestFile(source='junk.txt', target='bsig/junk.out') env_bsig.TestDir(source='bsig', target='bsig.out') @@ -65,7 +65,7 @@ env_bsig.Command('cmd-bsig-noscan.out', 'cmd-bsig', writeTarget) env_bsig.Command('cmd-bsig.out', 'cmd-bsig', writeTarget, source_scanner=DirScanner) -env_csig = env.Copy() +env_csig = env.Clone() env_csig.TargetSignatures('content') env_csig.TestFile(source='junk.txt', target='csig/junk.out') env_csig.TestDir(source='csig', target='csig.out') diff --git a/test/Fortran/F77.py b/test/Fortran/F77.py index 682cfb0..536483d 100644 --- a/test/Fortran/F77.py +++ b/test/Fortran/F77.py @@ -193,7 +193,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f77 = foo.Dictionary('F77') -bar = foo.Copy(F77 = r'%(_python_)s wrapper.py ' + f77) +bar = foo.Clone(F77 = r'%(_python_)s wrapper.py ' + f77) foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/F77FLAGS.py b/test/Fortran/F77FLAGS.py index b1d9142..cd25167 100644 --- a/test/Fortran/F77FLAGS.py +++ b/test/Fortran/F77FLAGS.py @@ -148,7 +148,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %FTN_LIBs) f77 = foo.Dictionary('F77') -bar = foo.Copy(F77 = r'%(_python_)s wrapper.py ' + f77, F77FLAGS = '-Ix') +bar = foo.Clone(F77 = r'%(_python_)s wrapper.py ' + f77, F77FLAGS = '-Ix') foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/F90.py b/test/Fortran/F90.py index 6b38e8e..cadfb01 100644 --- a/test/Fortran/F90.py +++ b/test/Fortran/F90.py @@ -159,7 +159,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f90 = foo.Dictionary('F90') -bar = foo.Copy(F90 = r'%(_python_)s wrapper.py ' + f90) +bar = foo.Clone(F90 = r'%(_python_)s wrapper.py ' + f90) foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/F90FLAGS.py b/test/Fortran/F90FLAGS.py index 9a57eae..2243ba6 100644 --- a/test/Fortran/F90FLAGS.py +++ b/test/Fortran/F90FLAGS.py @@ -163,7 +163,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f90 = foo.Dictionary('F90') -bar = foo.Copy(F90 = r'%(_python_)s wrapper.py ' + f90, F90FLAGS = '-Ix') +bar = foo.Clone(F90 = r'%(_python_)s wrapper.py ' + f90, F90FLAGS = '-Ix') foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/F95.py b/test/Fortran/F95.py index 1b5fc41..767a3b4 100644 --- a/test/Fortran/F95.py +++ b/test/Fortran/F95.py @@ -159,7 +159,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f95 = foo.Dictionary('F95') -bar = foo.Copy(F95 = r'%(_python_)s wrapper.py ' + f95) +bar = foo.Clone(F95 = r'%(_python_)s wrapper.py ' + f95) foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/F95FLAGS.py b/test/Fortran/F95FLAGS.py index 7ccffed..7d32419 100644 --- a/test/Fortran/F95FLAGS.py +++ b/test/Fortran/F95FLAGS.py @@ -163,7 +163,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f95 = foo.Dictionary('F95') -bar = foo.Copy(F95 = r'%(_python_)s wrapper.py ' + f95, F95FLAGS = '-Ix') +bar = foo.Clone(F95 = r'%(_python_)s wrapper.py ' + f95, F95FLAGS = '-Ix') foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/FORTRAN.py b/test/Fortran/FORTRAN.py index 1bd4407..235de74 100644 --- a/test/Fortran/FORTRAN.py +++ b/test/Fortran/FORTRAN.py @@ -156,7 +156,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f77 = foo.Dictionary('FORTRAN') -bar = foo.Copy(FORTRAN = r'%(_python_)s wrapper.py ' + f77) +bar = foo.Clone(FORTRAN = r'%(_python_)s wrapper.py ' + f77) foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/FORTRANFLAGS.py b/test/Fortran/FORTRANFLAGS.py index 6dd27d7..8ae00f8 100644 --- a/test/Fortran/FORTRANFLAGS.py +++ b/test/Fortran/FORTRANFLAGS.py @@ -160,7 +160,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) f77 = foo.Dictionary('FORTRAN') -bar = foo.Copy(FORTRAN = r'%(_python_)s wrapper.py ' + f77, FORTRANFLAGS = '-Ix') +bar = foo.Clone(FORTRAN = r'%(_python_)s wrapper.py ' + f77, FORTRANFLAGS = '-Ix') foo.Program(target = 'foo', source = 'foo.f') bar.Program(target = 'bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF77.py b/test/Fortran/SHF77.py index c9569c9..3f1f7e7 100644 --- a/test/Fortran/SHF77.py +++ b/test/Fortran/SHF77.py @@ -148,7 +148,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = 'g2c') shf77 = foo.Dictionary('SHF77') -bar = foo.Copy(SHF77 = r'%(_python_)s wrapper.py ' + shf77) +bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77) foo.SharedObject(target = 'foo/foo', source = 'foo.f') bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF77FLAGS.py b/test/Fortran/SHF77FLAGS.py index 5354a57..5099edf 100644 --- a/test/Fortran/SHF77FLAGS.py +++ b/test/Fortran/SHF77FLAGS.py @@ -119,7 +119,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) shf77 = foo.Dictionary('SHF77') -bar = foo.Copy(SHF77 = r'%(_python_)s wrapper.py ' + shf77, SHF77FLAGS = '-Ix') +bar = foo.Clone(SHF77 = r'%(_python_)s wrapper.py ' + shf77, SHF77FLAGS = '-Ix') foo.SharedLibrary(target = 'foo/foo', source = 'foo.f') bar.SharedLibrary(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF90.py b/test/Fortran/SHF90.py index 1696b4a..36d0a31 100644 --- a/test/Fortran/SHF90.py +++ b/test/Fortran/SHF90.py @@ -121,7 +121,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = 'g2c') shf90 = foo.Dictionary('SHF90') -bar = foo.Copy(SHF90 = r'%(_python_)s wrapper.py ' + shf90) +bar = foo.Clone(SHF90 = r'%(_python_)s wrapper.py ' + shf90) foo.SharedObject(target = 'foo/foo', source = 'foo.f') bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF90FLAGS.py b/test/Fortran/SHF90FLAGS.py index 62bb7d0..daf6366 100644 --- a/test/Fortran/SHF90FLAGS.py +++ b/test/Fortran/SHF90FLAGS.py @@ -134,7 +134,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) shf90 = foo.Dictionary('SHF90') -bar = foo.Copy(SHF90 = r'%(_python_)s wrapper.py ' + shf90, SHF90FLAGS = '-Ix') +bar = foo.Clone(SHF90 = r'%(_python_)s wrapper.py ' + shf90, SHF90FLAGS = '-Ix') foo.SharedLibrary(target = 'foo/foo', source = 'foo.f') bar.SharedLibrary(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF95.py b/test/Fortran/SHF95.py index 85702df..b9db6ba 100644 --- a/test/Fortran/SHF95.py +++ b/test/Fortran/SHF95.py @@ -121,7 +121,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = 'g2c') shf95 = foo.Dictionary('SHF95') -bar = foo.Copy(SHF95 = r'%(_python_)s wrapper.py ' + shf95) +bar = foo.Clone(SHF95 = r'%(_python_)s wrapper.py ' + shf95) foo.SharedObject(target = 'foo/foo', source = 'foo.f') bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHF95FLAGS.py b/test/Fortran/SHF95FLAGS.py index 2288a4a..09f9b98 100644 --- a/test/Fortran/SHF95FLAGS.py +++ b/test/Fortran/SHF95FLAGS.py @@ -134,7 +134,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) shf95 = foo.Dictionary('SHF95') -bar = foo.Copy(SHF95 = r'%(_python_)s wrapper.py ' + shf95, SHF95FLAGS = '-Ix') +bar = foo.Clone(SHF95 = r'%(_python_)s wrapper.py ' + shf95, SHF95FLAGS = '-Ix') foo.SharedLibrary(target = 'foo/foo', source = 'foo.f') bar.SharedLibrary(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHFORTRAN.py b/test/Fortran/SHFORTRAN.py index 586b54e..5b9cfc6 100644 --- a/test/Fortran/SHFORTRAN.py +++ b/test/Fortran/SHFORTRAN.py @@ -119,7 +119,7 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = 'g2c') shfortran = foo.Dictionary('SHFORTRAN') -bar = foo.Copy(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran) +bar = foo.Clone(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran) foo.SharedObject(target = 'foo/foo', source = 'foo.f') bar.SharedObject(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/Fortran/SHFORTRANFLAGS.py b/test/Fortran/SHFORTRANFLAGS.py index d09a283..ec74061 100644 --- a/test/Fortran/SHFORTRANFLAGS.py +++ b/test/Fortran/SHFORTRANFLAGS.py @@ -131,8 +131,8 @@ os.system(string.join(sys.argv[1:], " ")) test.write('SConstruct', """ foo = Environment(LIBS = %(FTN_LIB)s) shfortran = foo.Dictionary('SHFORTRAN') -bar = foo.Copy(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran, - SHFORTRANFLAGS = '-Ix') +bar = foo.Clone(SHFORTRAN = r'%(_python_)s wrapper.py ' + shfortran, + SHFORTRANFLAGS = '-Ix') foo.SharedLibrary(target = 'foo/foo', source = 'foo.f') bar.SharedLibrary(target = 'bar/bar', source = 'bar.f') """ % locals()) diff --git a/test/HeaderGen.py b/test/HeaderGen.py index 3cdd207..a47d22c 100644 --- a/test/HeaderGen.py +++ b/test/HeaderGen.py @@ -66,7 +66,7 @@ def gen_a_h(target, source, env): t.write(s.readline()[:-1] + ';\\n') MakeHeader = Builder(action = gen_a_h) -env_no_scan = env.Copy(SCANNERS=[], BUILDERS={'MakeHeader' : MakeHeader}) +env_no_scan = env.Clone(SCANNERS=[], BUILDERS={'MakeHeader' : MakeHeader}) env_no_scan.MakeHeader('a.h', 'a.c') env.StaticObject('a.c') diff --git a/test/IDL/midl.py b/test/IDL/midl.py index 6f3f986..15ac086 100644 --- a/test/IDL/midl.py +++ b/test/IDL/midl.py @@ -63,7 +63,7 @@ import os.path Import('env') -local = env.Copy(WINDOWS_INSERT_DEF = 1) +local = env.Clone(WINDOWS_INSERT_DEF = 1) barsrc = [ 'BarObject.cpp', diff --git a/test/Install/Install.py b/test/Install/Install.py index e24641b..3c1dc49 100644 --- a/test/Install/Install.py +++ b/test/Install/Install.py @@ -64,7 +64,7 @@ def my_install(dest, source, env): env1 = Environment() env1.Append(BUILDERS={'Cat':Builder(action=cat)}) -env3 = env1.Copy(INSTALL = my_install) +env3 = env1.Clone(INSTALL = my_install) t = env1.Cat(target='f1.out', source='f1.in') env1.Install(dir='export', source=t) @@ -74,7 +74,7 @@ Install(dir='export', source=t) t = env3.Cat(target='f3.out', source='f3.in') env3.Install(dir='export', source=t) -env4 = env1.Copy(EXPORT='export', SUBDIR='sub') +env4 = env1.Clone(EXPORT='export', SUBDIR='sub') t = env4.Cat(target='sub/f4.out', source='sub/f4.in') env4.Install(dir='$EXPORT', source=r'%(_SUBDIR_f4_out)s') diff --git a/test/Java/JAR.py b/test/Java/JAR.py index 5342a48..f0951c6 100644 --- a/test/Java/JAR.py +++ b/test/Java/JAR.py @@ -150,7 +150,7 @@ foo = Environment(tools = ['javac', 'jar'], JAVAC = r'%(where_javac)s', JAR = r'%(where_jar)s') jar = foo.Dictionary('JAR') -bar = foo.Copy(JAR = r'%(_python_)s wrapper.py ' + jar) +bar = foo.Clone(JAR = r'%(_python_)s wrapper.py ' + jar) foo.Java(target = 'classes', source = 'com/sub/foo') bar.Java(target = 'classes', source = 'com/sub/bar') foo.Jar(target = 'foo', source = 'classes/com/sub/foo') diff --git a/test/Java/JAVAC.py b/test/Java/JAVAC.py index b5fb3f8..7c06324 100644 --- a/test/Java/JAVAC.py +++ b/test/Java/JAVAC.py @@ -116,7 +116,7 @@ test.write('SConstruct', """ foo = Environment(tools = ['javac'], JAVAC = r'%(where_javac)s') javac = foo.Dictionary('JAVAC') -bar = foo.Copy(JAVAC = r'%(_python_)s wrapper.py ' + javac) +bar = foo.Clone(JAVAC = r'%(_python_)s wrapper.py ' + javac) foo.Java(target = 'class1', source = 'com/sub/foo') bar.Java(target = 'class2', source = 'com/sub/bar') foo.Java(target = 'class3', source = ['src1', 'src2']) diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py index 9901764..15adf34 100644 --- a/test/Java/JAVAH.py +++ b/test/Java/JAVAH.py @@ -126,7 +126,7 @@ foo = Environment(tools = ['javac', 'javah'], JAVAC = r'%(where_javac)s', JAVAH = r'%(where_javah)s') javah = foo.Dictionary('JAVAH') -bar = foo.Copy(JAVAH = r'%(_python_)s wrapper.py ' + javah) +bar = foo.Clone(JAVAH = r'%(_python_)s wrapper.py ' + javah) foo.Java(target = 'class1', source = 'com/sub/foo') bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar') foo_classes = foo.Java(target = 'class3', source = 'src') diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py index bb098e7..a66f885 100644 --- a/test/Java/RMIC.py +++ b/test/Java/RMIC.py @@ -128,7 +128,7 @@ foo.RMIC(target = 'outdir1', JAVACLASSDIR = 'class1') rmic = foo.Dictionary('RMIC') -bar = foo.Copy(RMIC = r'%(_python_)s wrapper.py ' + rmic) +bar = foo.Clone(RMIC = r'%(_python_)s wrapper.py ' + rmic) bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar') # XXX This is kind of a Python brute-force way to do what Ant # does with its "excludes" attribute. We should probably find diff --git a/test/NodeOps.py b/test/NodeOps.py index ff3e0ca..17a0f02 100644 --- a/test/NodeOps.py +++ b/test/NodeOps.py @@ -83,7 +83,7 @@ if %(_E)s: foo.SharedLibrary(target = 'foo', source = 'foo%(_obj)s') bar.SharedLibrary(target = 'bar', source = 'bar%(_obj)s') -fooMain = foo.Copy(LIBS='foo', LIBPATH='.') +fooMain = foo.Clone(LIBS='foo', LIBPATH='.') foo_obj = fooMain.Object(target='foomain', source='main.c') fooMain.Program(target='fooprog', source=foo_obj) diff --git a/test/QT/copied-env.py b/test/QT/copied-env.py index 312df44..dc96317 100644 --- a/test/QT/copied-env.py +++ b/test/QT/copied-env.py @@ -42,7 +42,7 @@ test.write('SConscript', """\ Import("env") env.Append(CPPDEFINES = ['FOOBAZ']) -copy = env.Copy() +copy = env.Clone() copy.Append(CPPDEFINES = ['MYLIB_IMPL']) copy.SharedLibrary( diff --git a/test/QT/empty-env.py b/test/QT/empty-env.py index de8daa1..5bf173a 100644 --- a/test/QT/empty-env.py +++ b/test/QT/empty-env.py @@ -36,11 +36,11 @@ test.Qt_dummy_installation('qt') test.write('SConstruct', """\ orig = Environment() -env = orig.Copy(QTDIR = r'%s', - QT_LIB = r'%s', - QT_MOC = r'%s', - QT_UIC = r'%s', - tools=['qt']) +env = orig.Clone(QTDIR = r'%s', + QT_LIB = r'%s', + QT_MOC = r'%s', + QT_UIC = r'%s', + tools=['qt']) env.Program('main', 'main.cpp', CPPDEFINES=['FOO'], LIBS=[]) """ % (test.QT, test.QT_LIB, test.QT_MOC, test.QT_UIC)) diff --git a/test/QT/reentrant.py b/test/QT/reentrant.py index ef0b292..336aa13 100644 --- a/test/QT/reentrant.py +++ b/test/QT/reentrant.py @@ -50,7 +50,7 @@ test.Qt_create_SConstruct('SConstruct') test.write('SConscript', """\ Import("env") -env = env.Copy(tools=['qt']) +env = env.Clone(tools=['qt']) env.Program('main', 'main.cpp', CPPDEFINES=['FOO'], LIBS=[]) """) diff --git a/test/SWIG/SWIG.py b/test/SWIG/SWIG.py index 0fb1da4..ed995a9 100644 --- a/test/SWIG/SWIG.py +++ b/test/SWIG/SWIG.py @@ -73,7 +73,7 @@ test.write('SConstruct', """ env = Environment(tools=['default', 'swig'], SWIG = r'%(_python_)s myswig.py') env.Program(target = 'test1', source = 'test1.i') env.CFile(target = 'test2', source = 'test2.i') -env.Copy(SWIGFLAGS = '-c++').Program(target = 'test3', source = 'test3.i') +env.Clone(SWIGFLAGS = '-c++').Program(target = 'test3', source = 'test3.i') """ % locals()) test.write('test1.i', r""" @@ -151,7 +151,7 @@ foo = Environment(SWIGFLAGS='-python', ) swig = foo.Dictionary('SWIG') -bar = foo.Copy(SWIG = r'%(_python_)s wrapper.py ' + swig) +bar = foo.Clone(SWIG = r'%(_python_)s wrapper.py ' + swig) foo.LoadableModule(target = 'foo', source = ['foo.c', 'foo.i']) bar.LoadableModule(target = 'bar', source = ['bar.c', 'bar.i']) """ % locals()) @@ -258,7 +258,7 @@ foo = Environment(SWIGFLAGS='-python', ) swig = foo.Dictionary('SWIG') -bar = foo.Copy(SWIG = r'%(_python_)s wrapper.py ' + swig) +bar = foo.Clone(SWIG = r'%(_python_)s wrapper.py ' + swig) foo.CFile(target = 'dependent', source = ['dependent.i']) """ % locals()) diff --git a/test/Scanner/Scanner.py b/test/Scanner/Scanner.py index 09c5680..16f3d19 100644 --- a/test/Scanner/Scanner.py +++ b/test/Scanner/Scanner.py @@ -97,7 +97,7 @@ env.Command('foo', 'foo.k', r'%(_python_)s build.py $SOURCES $TARGET') ########################################################## # Test resetting the environment scanners (and specifying as a list). -env2 = env.Copy() +env2 = env.Clone() env2.Append(SCANNERS = [k2scan]) env2.Command('junk', 'junk.k2', r'%(_python_)s build.py $SOURCES $TARGET') diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py index 36f35f6..a88303f 100644 --- a/test/Scanner/generated.py +++ b/test/Scanner/generated.py @@ -184,12 +184,12 @@ test.write(['src', 'SConscript'], """\ import Mylib Import("env") -#env = env.Copy() # Yes, clobber intentionally +#env = env.Clone() # Yes, clobber intentionally #Make environment changes, such as: Mylib.AddCFlags(env, "-g -D_TEST") #Mylib.Subdirs(env, "lib_a lib_b lib_mergej prog_x") Mylib.Subdirs(env, "lib_geng") -env = env.Copy() # Yes, clobber intentionally +env = env.Clone() # Yes, clobber intentionally # --- End SConscript boilerplate --- """) @@ -201,11 +201,11 @@ import sys import Mylib Import("env") -#env = env.Copy() # Yes, clobber intentionally +#env = env.Clone() # Yes, clobber intentionally #Make environment changes, such as: Mylib.AddCFlags(env, "-g -D_TEST") #Mylib.Subdirs(env, "foo_dir") -env = env.Copy() # Yes, clobber intentionally +env = env.Clone() # Yes, clobber intentionally # --- End SConscript boilerplate --- Mylib.AddCFlags(env, "-DGOOFY_DEMO") @@ -215,7 +215,7 @@ Mylib.AddIncludeDirs(env, ".") # On Windows, it's import to use the original test environment # when we invoke SCons recursively. import os -recurse_env = env.Copy() +recurse_env = env.Clone() recurse_env["ENV"] = os.environ # Icky code to set up process environment for "make" diff --git a/test/SourceSignatures.py b/test/SourceSignatures.py index 36a9195..b85f8ec 100644 --- a/test/SourceSignatures.py +++ b/test/SourceSignatures.py @@ -131,7 +131,7 @@ def build(env, target, source): open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) B = Builder(action = build) env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Copy() +env2 = env.Clone() env2.SourceSignatures('MD5') env.B(target = 'f5.out', source = 'f5.in') env.B(target = 'f6.out', source = 'f6.in') diff --git a/test/TEX/LATEXFLAGS.py b/test/TEX/LATEXFLAGS.py index b887038..6df1daf 100644 --- a/test/TEX/LATEXFLAGS.py +++ b/test/TEX/LATEXFLAGS.py @@ -59,7 +59,7 @@ env = Environment(LATEX = r'%(_python_)s mylatex.py', LATEXFLAGS = '-x', tools=['latex']) env.DVI(target = 'test1.dvi', source = 'test1.ltx') -env.Copy(LATEXFLAGS = '-t').DVI(target = 'test2.dvi', source = 'test2.latex') +env.Clone(LATEXFLAGS = '-t').DVI(target = 'test2.dvi', source = 'test2.latex') """ % locals()) test.write('test1.ltx', r"""This is a .ltx test. diff --git a/test/TEX/PDFLATEXFLAGS.py b/test/TEX/PDFLATEXFLAGS.py index a3948fe..0ab76a1 100644 --- a/test/TEX/PDFLATEXFLAGS.py +++ b/test/TEX/PDFLATEXFLAGS.py @@ -59,7 +59,7 @@ env = Environment(PDFLATEX = r'%(_python_)s mypdflatex.py', PDFLATEXFLAGS = '-x', tools=['pdflatex']) env.PDF(target = 'test1.pdf', source = 'test1.ltx') -env.Copy(PDFLATEXFLAGS = '-t').PDF(target = 'test2.pdf', source = 'test2.latex') +env.Clone(PDFLATEXFLAGS = '-t').PDF(target = 'test2.pdf', source = 'test2.latex') """ % locals()) test.write('test1.ltx', r"""This is a .ltx test. diff --git a/test/TargetSignatures.py b/test/TargetSignatures.py index 11dee8a..c3b506b 100644 --- a/test/TargetSignatures.py +++ b/test/TargetSignatures.py @@ -43,7 +43,7 @@ env['BUILDERS']['Copy2'] = Builder(action=copy2) env.Copy2('foo.mid', 'foo.in') env.Copy1('foo.out', 'foo.mid') -env2 = env.Copy() +env2 = env.Clone() env2.TargetSignatures('build') env2.Copy2('bar.mid', 'bar.in') env2.Copy1('bar.out', 'bar.mid') @@ -80,7 +80,7 @@ env['BUILDERS']['Copy2'] = Builder(action=copy2) env.Copy2('foo.mid', 'foo.in') env.Copy1('foo.out', 'foo.mid') -env2 = env.Copy() +env2 = env.Clone() env2.TargetSignatures('build') env2.Copy2('bar.mid', 'bar.in') env2.Copy1('bar.out', 'bar.mid') diff --git a/test/multi.py b/test/multi.py index c8b8df4..8bcb1f7 100644 --- a/test/multi.py +++ b/test/multi.py @@ -197,7 +197,7 @@ def build(env, target, source): B = Builder(action=build, multi=1) env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Copy(DIFFERENT_VARIABLE = 'true') +env2 = env.Clone(DIFFERENT_VARIABLE = 'true') env.B(target = 'file5.out', source = 'file5a.in') env2.B(target = 'file5.out', source = 'file5b.in') """) @@ -227,7 +227,7 @@ def build(env, target, source): B = Builder(action=Action(build, varlist=['XXX']), multi=1) env = Environment(BUILDERS = { 'B' : B }, XXX = 'foo') -env2 = env.Copy(XXX = 'var') +env2 = env.Clone(XXX = 'var') env.B(target = 'file6.out', source = 'file6a.in') env2.B(target = 'file6.out', source = 'file6b.in') """) diff --git a/test/option--warn.py b/test/option--warn.py index 3553f4f..4b81e25 100644 --- a/test/option--warn.py +++ b/test/option--warn.py @@ -112,7 +112,7 @@ def build(env, target, source): B = Builder(action=build, multi=1) env = Environment(BUILDERS = { 'B' : B }) -env2 = env.Copy(DIFFERENT_VARIABLE = 'true') +env2 = env.Clone(DIFFERENT_VARIABLE = 'true') env.B(target = 'file1.out', source = 'file1a.in') env2.B(target = 'file1.out', source = 'file1b.in') """) diff --git a/test/sconsign/script.py b/test/sconsign/script.py index d94a956..9612560 100644 --- a/test/sconsign/script.py +++ b/test/sconsign/script.py @@ -86,7 +86,7 @@ test.write(['work1', 'SConstruct'], """ SConsignFile(None) env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') env1.Program('sub1/hello.c') -env2 = env1.Copy(CPPPATH = ['sub2']) +env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') """) @@ -251,7 +251,7 @@ SourceSignatures('timestamp') TargetSignatures('content') env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') env1.Program('sub1/hello.c') -env2 = env1.Copy(CPPPATH = ['sub2']) +env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') """) @@ -282,7 +282,7 @@ test.write(['work2', 'SConstruct'], """ SConsignFile() env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') env1.Program('sub1/hello.c') -env2 = env1.Copy(CPPPATH = ['sub2']) +env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') """) @@ -510,7 +510,7 @@ SourceSignatures('timestamp') TargetSignatures('content') env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj') env1.Program('sub1/hello.c') -env2 = env1.Copy(CPPPATH = ['sub2']) +env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') """) diff --git a/test/srcchange.py b/test/srcchange.py index ac549f6..7c2e510 100644 --- a/test/srcchange.py +++ b/test/srcchange.py @@ -59,7 +59,7 @@ def subrevision(target, source ,env): SubRevision = Action(subrevision) env=Environment() -content_env=env.Copy() +content_env=env.Clone() content_env.TargetSignatures('content') content_env.Command('revision.in', [], '%(_python_)s getrevision > $TARGET') content_env.AlwaysBuild('revision.in') diff --git a/test/toolpath.py b/test/toolpath.py index 55b70fd..7e08f8a 100644 --- a/test/toolpath.py +++ b/test/toolpath.py @@ -89,7 +89,7 @@ print "env0['TOOL_SCCS1'] =", env0.get('TOOL_SCCS1') print "env0['TOOL_SCCS2'] =", env0.get('TOOL_SCCS2') base = Environment(tools=[], toolpath=['tools']) -derived = base.Copy(tools=['bar']) +derived = base.Clone(tools=['bar']) print "derived['TOOL_BAR'] =", derived.get('TOOL_BAR') """) |