diff options
| author | Steven Knight <knight@baldmt.com> | 2002-01-11 00:02:51 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2002-01-11 00:02:51 (GMT) |
| commit | 726f4a0214cd69aae4b5ca5104bcac483cd9e6f0 (patch) | |
| tree | ae581e6d6f1ef1ceeeb3a7767c58cd012bcaf7b4 /src | |
| parent | 3856fae9d787b6da0a3d0cf6eea33193454cd78a (diff) | |
| download | SCons-726f4a0214cd69aae4b5ca5104bcac483cd9e6f0.zip SCons-726f4a0214cd69aae4b5ca5104bcac483cd9e6f0.tar.gz SCons-726f4a0214cd69aae4b5ca5104bcac483cd9e6f0.tar.bz2 | |
Add the InstallAs() method (Charles Crain).
Diffstat (limited to 'src')
| -rw-r--r-- | src/CHANGES.txt | 4 | ||||
| -rw-r--r-- | src/engine/SCons/Environment.py | 11 | ||||
| -rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 11 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index e739fea..43860f1 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,8 @@ RELEASE 0.03 - - Performance improvements in the Node.FS and Sig.Calculator classes. + - Add the InstallAs() method. + From Steven Knight: - Search both /usr/lib and /usr/local/lib for scons directories by @@ -45,6 +47,8 @@ RELEASE 0.03 - - Use one CPlusPlusAction in the Object Builder's action dictionary, instead of letting it create multiple identical instances. + - Document the Install() and InstallAs() methods. + From Steve Leblanc: - Require that a Builder be given a name argument, supplying a diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 6f77354..612ae9a 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -204,6 +204,17 @@ class Environment: tgt = tgt[0] return tgt + def InstallAs(self, target, source): + """Install sources as targets.""" + sources = SCons.Util.scons_str2nodes(source) + targets = SCons.Util.scons_str2nodes(target) + ret = [] + for src, tgt in map(lambda x, y: (x, y), sources, targets): + ret.append(InstallBuilder(self, tgt, src)) + if len(ret) == 1: + ret = ret[0] + return ret + def subst(self, string): """Recursively interpolates construction variables from the Environment into the specified string, returning the expanded diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 878e736..a65cc33 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -215,7 +215,7 @@ class EnvironmentTestCase(unittest.TestCase): assert env1 == env2 def test_Install(self): - """Test Install method""" + """Test Install and InstallAs methods""" env=Environment() tgt = env.Install('export', [ 'build/foo1', 'build/foo2' ]) paths = map(str, tgt) @@ -225,6 +225,15 @@ class EnvironmentTestCase(unittest.TestCase): for tnode in tgt: assert tnode.builder == InstallBuilder + tgt = env.InstallAs(target='foo1 foo2', source='bar1 bar2') + assert len(tgt) == 2, len(tgt) + paths = map(lambda x: str(x.sources[0]), tgt) + paths.sort() + expect = map(os.path.normpath, [ 'bar1', 'bar2' ]) + assert paths == expect, paths + for tnode in tgt: + assert tnode.builder == InstallBuilder + def test_InstallAs(self): pass # XXX |
