Anonymous avatar Anonymous committed b946845

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().
........

Comments (0)

Files changed (67)

 
         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)
 
 
 Import('env', 'whereis')
 
-env = env.Copy()
+env = env.Clone()
 
 env.TargetSignatures('content')
 
 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.
 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
 
 
 '\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 .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,
 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
 
 .ES
 def MyTool(env): env['FOO'] = 'bar'
-env4 = env.Copy(tools = ['msvc', MyTool])
-.EE
+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
 .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

doc/user/environments.in

    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>
    <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,
    <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')
 

doc/user/environments.sgml

    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>
    <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,
 
    <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')
 

doc/user/hierarchy.in

 
       <sconstruct>
         Import('env', 'debug')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </sconstruct>
 
 
       <sconstruct>
         Import('env debug')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </sconstruct>
 
 
       <sconstruct>
         Import('*')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </sconstruct>
 

doc/user/hierarchy.sgml

 
       <programlisting>
         Import('env', 'debug')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </programlisting>
 
 
       <programlisting>
         Import('env debug')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </programlisting>
 
 
       <programlisting>
         Import('*')
-        env = env.Copy(DEBUG = debug)
+        env = env.Clone(DEBUG = debug)
         env.Program('prog', ['prog.c'])
       </programlisting>
 
 """)
     sys.exit(1)
 
+if sys.platform in ('win32', 'cygwin'):
 
-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
+    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
+
+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
   - 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.
 
             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

src/engine/SCons/ActionTests.py

         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():
         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
         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
         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
         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
 
         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')
         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')
         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
 
         # 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))

src/engine/SCons/Environment.py

         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
                     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
         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__
         """

src/engine/SCons/EnvironmentTests.py

         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)
 
         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
 
         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.Clone()
+        env1copy = env1.Clone()
+        assert env1copy == env1copy
+        assert env2 == env2
+        env2.Replace(YYY = 'yyy')
+        assert env2 == env2
+        assert env1 != env2
+        assert env1 == env1copy
+
+        env3 = env1.Clone(XXX = 'x3', ZZZ = 'z3')
+        assert env3 == env3
+        assert env3.Dictionary('XXX') == 'x3'
+        assert env3.Dictionary('YYY') == 'y'
+        assert env3.Dictionary('ZZZ') == 'z3'
+        assert env1 == env1copy
+
+        # Ensure that lists and dictionaries are
+        # deep copied, but not instances.
+        class TestA:
+            pass
+        env1 = self.TestEnvironment(XXX=TestA(), YYY = [ 1, 2, 3 ],
+                           ZZZ = { 1:2, 3:4 })
+        env2=env1.Clone()
+        env2.Dictionary('YYY').append(4)
+        env2.Dictionary('ZZZ')[5] = 6
+        assert env1.Dictionary('XXX') is env2.Dictionary('XXX')
+        assert 4 in env2.Dictionary('YYY')
+        assert not 4 in env1.Dictionary('YYY')
+        assert env2.Dictionary('ZZZ').has_key(5)
+        assert not env1.Dictionary('ZZZ').has_key(5)
+
+        #
+        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.Clone(BUILDERS = {'b2' : 2})
+        assert env2 is env2
+        assert env2 == env2
+        assert hasattr(env1, 'b1'), "b1 was mistakenly cleared from env1"
+        assert env1.b1.env == env1, "b1.env was changed"
+        assert not hasattr(env2, 'b1'), "b1 was not cleared from env2"
+        assert hasattr(env2, 'b2'), "env2.b2 was not set"
+        assert env2.b2.env == env2, "b2.env doesn't point to env2"
+
+        # Ensure that specifying new tools in a copied environment
+        # works.
+        def foo(env): env['FOO'] = 1
+        def bar(env): env['BAR'] = 2
+        def baz(env): env['BAZ'] = 3
+        env1 = self.TestEnvironment(tools=[foo])
+        env2 = env1.Clone()
+        env3 = env1.Clone(tools=[bar, baz])
+
+        assert env1.get('FOO') is 1
+        assert env1.get('BAR') is None
+        assert env1.get('BAZ') is None
+        assert env2.get('FOO') is 1
+        assert env2.get('BAR') is None
+        assert env2.get('BAZ') is None
+        assert env3.get('FOO') is 1
+        assert env3.get('BAR') is 2
+        assert env3.get('BAZ') is 3
+
+        # Ensure that recursive variable substitution when copying
+        # environments works properly.
+        env1 = self.TestEnvironment(CCFLAGS = '-DFOO', XYZ = '-DXYZ')
+        env2 = env1.Clone(CCFLAGS = '$CCFLAGS -DBAR',
+                         XYZ = ['-DABC', 'x $XYZ y', '-DDEF'])
+        x = env2.get('CCFLAGS')
+        assert x == '-DFOO -DBAR', x
+        x = env2.get('XYZ')
+        assert x == ['-DABC', 'x -DXYZ y', '-DDEF'], x
+
+        # Ensure that special properties of a class don't get
+        # lost on copying.
+        env1 = self.TestEnvironment(FLAGS = CLVar('flag1 flag2'))
+        x = env1.get('FLAGS')
+        assert x == ['flag1', 'flag2'], x
+        env2 = env1.Clone()
+        env2.Append(FLAGS = 'flag3 flag4')
+        x = env2.get('FLAGS')
+        assert x == ['flag1', 'flag2', 'flag3', 'flag4'], x
+
+        # Test that the environment stores the toolpath and
+        # re-uses it for copies.
+        test = TestCmd.TestCmd(workdir = '')
+
+        test.write('xxx.py', """\
+def exists(env):
+    1
+def generate(env):
+    env['XXX'] = 'one'
+""")
+
+        test.write('yyy.py', """\
+def exists(env):
+    1
+def generate(env):
+    env['YYY'] = 'two'
+""")
+
+        env = self.TestEnvironment(tools=['xxx'], toolpath=[test.workpath('')])
+        assert env['XXX'] == 'one', env['XXX']
+        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 env1 != env2
         assert env1 == env1copy
 
-        env3 = env1.Copy(XXX = 'x3', ZZZ = 'z3')
-        assert env3 == env3
-        assert env3.Dictionary('XXX') == 'x3'
-        assert env3.Dictionary('YYY') == 'y'
-        assert env3.Dictionary('ZZZ') == 'z3'
-        assert env1 == env1copy
-
-        # Ensure that lists and dictionaries are
-        # deep copied, but not instances.
-        class TestA:
-            pass
-        env1 = self.TestEnvironment(XXX=TestA(), YYY = [ 1, 2, 3 ],
-                           ZZZ = { 1:2, 3:4 })
-        env2=env1.Copy()
-        env2.Dictionary('YYY').append(4)
-        env2.Dictionary('ZZZ')[5] = 6
-        assert env1.Dictionary('XXX') is env2.Dictionary('XXX')
-        assert 4 in env2.Dictionary('YYY')
-        assert not 4 in env1.Dictionary('YYY')
-        assert env2.Dictionary('ZZZ').has_key(5)
-        assert not env1.Dictionary('ZZZ').has_key(5)
-
-        #
-        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})
-        assert env2 is env2
-        assert env2 == env2
-        assert hasattr(env1, 'b1'), "b1 was mistakenly cleared from env1"
-        assert env1.b1.env == env1, "b1.env was changed"
-        assert not hasattr(env2, 'b1'), "b1 was not cleared from env2"
-        assert hasattr(env2, 'b2'), "env2.b2 was not set"
-        assert env2.b2.env == env2, "b2.env doesn't point to env2"
-
-        # Ensure that specifying new tools in a copied environment
-        # works.
-        def foo(env): env['FOO'] = 1
-        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])
-
-        assert env1.get('FOO') is 1
-        assert env1.get('BAR') is None
-        assert env1.get('BAZ') is None
-        assert env2.get('FOO') is 1
-        assert env2.get('BAR') is None
-        assert env2.get('BAZ') is None
-        assert env3.get('FOO') is 1
-        assert env3.get('BAR') is 2
-        assert env3.get('BAZ') is 3
-
-        # Ensure that recursive variable substitution when copying
-        # environments works properly.
-        env1 = self.TestEnvironment(CCFLAGS = '-DFOO', XYZ = '-DXYZ')
-        env2 = env1.Copy(CCFLAGS = '$CCFLAGS -DBAR',
-                         XYZ = ['-DABC', 'x $XYZ y', '-DDEF'])
-        x = env2.get('CCFLAGS')
-        assert x == '-DFOO -DBAR', x
-        x = env2.get('XYZ')
-        assert x == ['-DABC', 'x -DXYZ y', '-DDEF'], x
-
-        # Ensure that special properties of a class don't get
-        # lost on copying.
-        env1 = self.TestEnvironment(FLAGS = CLVar('flag1 flag2'))
-        x = env1.get('FLAGS')
-        assert x == ['flag1', 'flag2'], x
-        env2 = env1.Copy()
-        env2.Append(FLAGS = 'flag3 flag4')
-        x = env2.get('FLAGS')
-        assert x == ['flag1', 'flag2', 'flag3', 'flag4'], x
-
-        # Test that the environment stores the toolpath and
-        # re-uses it for copies.
-        test = TestCmd.TestCmd(workdir = '')
-
-        test.write('xxx.py', """\
-def exists(env):
-    1
-def generate(env):
-    env['XXX'] = 'one'
-""")
-
-        test.write('yyy.py', """\
-def exists(env):
-    1
-def generate(env):
-    env['YYY'] = 'two'
-""")
-
-        env = self.TestEnvironment(tools=['xxx'], toolpath=[test.workpath('')])
-        assert env['XXX'] == 'one', env['XXX']
-        env = env.Copy(tools=['yyy'])
-        assert env['YYY'] == 'two', env['YYY']
-
     def test_Detect(self):
         """Test Detect()ing tools"""
         test = TestCmd.TestCmd(workdir = '')
         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']:
     # 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):

src/engine/SCons/SConfTests.py

             def libs(env):
                 return env.get('LIBS', [])
 
-            env = sconf.env.Copy()
+            env = sconf.env.Clone()
 
             try:
                 r = sconf.CheckLib( existing_lib, "main", autoadd=1 )
                 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)
             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 )
                 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)

src/engine/SCons/Subst.py

     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...
     """
 
     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'])
 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())
     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())

test/Actions/pre-post.py

 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

test/BuildDir/BuildDir.py

 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')
 
 
 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"""

test/BuildDir/CPPPATH-subdir.py

 
 test.write(['src', 'glscry', 'SConscript'], """\
 Import('*')
-env = env.Copy()
+env = env.Clone()
 env.Append(CPPPATH=['.'])
 env.Library('foo', 'foo.c')
 """)

test/BuildDir/nested-sconscripts.py

 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')

test/CC/SHCCFLAGS.py

 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))
 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)

test/CFILESUFFIX.py

 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"""

test/CPPDEFINES.py

 ]
 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", 

test/CXX/CXXFILESUFFIX.py

 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"""

test/CXX/SHCXXFLAGS.py

 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))
 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)

test/Clone-compatibility.py

+#!/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()

test/Copy-Option.py

         gpib_options),
     )
 env = Environment(options = opts, CPPPATH = ['#/'])
-new_env=env.Copy()
+new_env=env.Clone()
 """)
 
 test.run(arguments = '.')

test/DirSource.py

 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')
 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')

test/Fortran/F77.py

     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())

test/Fortran/F77FLAGS.py

     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())

test/Fortran/F90.py

     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())

test/Fortran/F90FLAGS.py

     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())

test/Fortran/F95.py

     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())

test/Fortran/F95FLAGS.py

     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())

test/Fortran/FORTRAN.py

     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())

test/Fortran/FORTRANFLAGS.py

     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())

test/Fortran/SHF77.py

     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())

test/Fortran/SHF77FLAGS.py

     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())

test/Fortran/SHF90.py

     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())

test/Fortran/SHF90FLAGS.py

     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())

test/Fortran/SHF95.py

     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())

test/Fortran/SHF95FLAGS.py

     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())

test/Fortran/SHFORTRAN.py

     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())

test/Fortran/SHFORTRANFLAGS.py

     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())

test/HeaderGen.py

     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')
 
 Import('env')
 
-local = env.Copy(WINDOWS_INSERT_DEF = 1)
+local = env.Clone(WINDOWS_INSERT_DEF = 1)
 
 barsrc = [
     'BarObject.cpp',

test/Install/Install.py

 
 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)
 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')
 
                   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')

test/Java/JAVAC.py

 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'])

test/Java/JAVAH.py

                   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')

test/Java/RMIC.py

           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
 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)
 

test/QT/copied-env.py

 Import("env")
 env.Append(CPPDEFINES = ['FOOBAZ'])
                                                                                 
-copy = env.Copy()
+copy = env.Clone()
 copy.Append(CPPDEFINES = ['MYLIB_IMPL'])
                                                                                 
 copy.SharedLibrary(

test/QT/empty-env.py

 
 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))
 

test/QT/reentrant.py

 
 test.write('SConscript', """\
 Import("env")
-env = env.Copy(tools=['qt'])
+env = env.Clone(tools=['qt'])
 env.Program('main', 'main.cpp', CPPDEFINES=['FOO'], LIBS=[])
 """)
 

test/SWIG/SWIG.py

 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"""
                   )
 
 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())
                   )
 
 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())
 

test/Scanner/Scanner.py

 ##########################################################
 # 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')
 

test/Scanner/generated.py

 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 ---
 
 """)
 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")
 # 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"

test/SourceSignatures.py

     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')

test/TEX/LATEXFLAGS.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.

test/TEX/PDFLATEXFLAGS.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.

test/TargetSignatures.py

 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')
 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')
 
 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')
 """)
 
 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')
 """)

test/option--warn.py

 
 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')
 """)

test/sconsign/script.py

 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')
 """)
 
 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')
 """)
 
 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')
 """)
 
 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')
 """)
 

test/srcchange.py

 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')
 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')
 """)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.