.PP
.fi
+Additional methods include:
+
+.IP Install
+Installs one or more files in a destination directory.
+The file names remain the same.
+.IP
+.nf
+env.Install(dir = '/usr/local/bin', source = 'foo bar')
+.PP
+.fi
+
+.IP InstallAs
+Installs one or more files as specific file names.
+This allows changing a file name as part of the
+installation:
+.IP
+.nf
+env.Install(dir = '/usr/local/bin/foo', source = 'foo_debug')
+env.Install(target = '../lib/libfoo.a ../lib/libbar.a',
+ source = 'libFOO.a libBAR.a')
+.PP
+.fi
+It is an error if the target and source
+list different numbers of files.
+
.SS Construction Variables
A construction environment has an associated dictionary of construction
- 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
- 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
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
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)
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