$ scons build/scons
-If you don't have SCons version 0.11 or later already installed on your
+If you don't have SCons version 0.96 or later already installed on your
system, you can use SCons itself to populate the build/scons/ directory
with a little more typing:
BUILDING PACKAGES
=================
-We use SCons (version 0.11 or later) to build its own packages. If you
+We use SCons (version 0.96 or later) to build its own packages. If you
already have an appropriate version of SCons installed on your system,
you can build everything by simply running it:
$ scons
-If you don't have SCons version 0.11 or later already installed on your
+If you don't have SCons version 0.96 or later already installed on your
system, you can build this version of SCons with itself with a little
more typing:
env.Command(unpack_targets, local_tar_gz, commands)
if zipit:
- zipenv = env.Copy(CD = local, PSV = '.')
- zipenv.Command(local_zip, local_targets, zipit)
+ env.Command(local_zip, local_targets, zipit,
+ CD = local, PSV = '.')
unpack_targets = map(lambda x, d=test_local_zip_dir:
os.path.join(d, x),
"mkdir %s" % test_local_zip_dir,
unzipit]
- zipenv = env.Copy(UNPACK_ZIP_DIR = test_local_zip_dir)
- zipenv.Command(unpack_targets, local_zip, unzipit)
+ env.Command(unpack_targets, local_zip, unzipit,
+ UNPACK_ZIP_DIR = test_local_zip_dir)
#
# And, lastly, install the appropriate packages in the
#
dfiles = map(lambda x, d=test_src_tar_gz_dir: os.path.join(d, x),
dst_files)
- ENV = env.Dictionary('ENV')
- ENV['SCONS_LIB_DIR'] = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine')
+ scons_lib_dir = os.path.join(unpack_tar_gz_dir, psv, 'src', 'engine')
+ ENV = env.Dictionary('ENV').copy()
+ ENV['SCONS_LIB_DIR'] = scons_lib_dir
ENV['USERNAME'] = developer
- env.Copy(ENV = ENV).Command(dfiles, unpack_tar_gz_files, [
+ env.Command(dfiles, unpack_tar_gz_files,
+ [
"rm -rf %s" % os.path.join(unpack_tar_gz_dir,
psv,
'build',
'build',
'scons',
'setup.py'),
- ])
+ ],
+ ENV = ENV)
if zipit:
- zipenv = env.Copy(CD = 'build', PSV = psv)
- zipenv.Command(src_zip, b_psv_stamp, zipit)
+ env.Command(src_zip, b_psv_stamp, zipit, CD = 'build', PSV = psv)
#
# Unpack the archive into build/unpack/scons-{version}.
#
dfiles = map(lambda x, d=test_src_zip_dir: os.path.join(d, x),
dst_files)
- ENV = env.Dictionary('ENV')
- ENV['SCONS_LIB_DIR'] = os.path.join(unpack_zip_dir, psv, 'src', 'engine')
+ scons_lib_dir = os.path.join(unpack_zip_dir, psv, 'src', 'engine')
+ ENV = env.Dictionary('ENV').copy()
+ ENV['SCONS_LIB_DIR'] = scons_lib_dir
ENV['USERNAME'] = developer
- env.Copy(ENV = ENV).Command(dfiles, unpack_zip_files, [
+ env.Command(dfiles, unpack_zip_files,
+ [
"rm -rf %s" % os.path.join(unpack_zip_dir,
psv,
'build',
'build',
'scons',
'setup.py'),
- ])
+ ],
+ ENV = ENV)
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
-.RI Command( target ", " source ", " commands )
+.RI Command( target ", " source ", " commands ", [" key = val ", ...])"
.TP
-.RI env.Command( target ", " source ", " commands )
+.RI env.Command( target ", " source ", " commands ", [" key = val ", ...])"
Executes a specific action
(or list of actions)
to build a target file or files.
This is more convenient
than defining a separate Builder object
for a single special-case build.
+Any keyword arguments specified override any
+same-named existing construction variables.
Note that an action can be an external command,
specified as a string,
env.Command('bar.out', 'bar.in',
["rm -f $TARGET",
- "$BAR_BUILD < $SOURCES > $TARGET"])
+ "$BAR_BUILD < $SOURCES > $TARGET"],
+ ENV = {'PATH' : '/usr/local/bin/'})
def rename(env, target, source):
import os
- Add an Execute() method for executing actions directly.
+ - Support passing environment override keyword arguments to Command().
RELEASE 0.95 - Mon, 08 Mar 2004 06:43:20 -0600
pass
return apply(SCons.SConf.SConf, nargs, nkw)
- def Command(self, target, source, action):
+ def Command(self, target, source, action, **kw):
"""Builds the supplied target files from the supplied
source files using the supplied action. Action may
be any type that the Builder constructor will accept
for an action."""
- bld = SCons.Builder.Builder(action=action,
- source_factory=self.fs.Entry)
+ nkw = self.subst_kw(kw)
+ nkw['action'] = action
+ nkw['source_factory'] = self.fs.Entry
+ bld = apply(SCons.Builder.Builder, (), nkw)
return bld(self, target, source)
def Depends(self, target, dependency):
assert 'foo1.in' in map(lambda x: x.path, t.sources)
assert 'foo2.in' in map(lambda x: x.path, t.sources)
+ x = []
+ def test2(baz, x=x):
+ x.append(baz)
+ env = Environment(TEST2 = test2)
+ t = env.Command(target='baz.out', source='baz.in',
+ action='${TEST2(XYZ)}',
+ XYZ='magic word')
+ assert not t.builder is None
+ t.build()
+ assert x[0] == 'magic word', x
+
def test_Configure(self):
"""Test the Configure() method"""
# Configure() will write to a local temporary file.
def buildIt(env, target, source):
contents = open(str(source[0]), 'rb').read()
file = open(str(target[0]), 'wb')
+ xyzzy = env.get('XYZZY', '')
+ if xyzzy:
+ file.write(xyzzy + '\\n')
file.write(contents)
file.close()
return 0
action = [ [ r'%s', 'build.py', 'temp3', '$SOURCES' ],
[ r'%s', 'build.py', '$TARGET', 'temp3'] ])
Command(target = 'f4.out', source = 'sub', action = sub)
+env.Command(target = 'f5.out', source = 'f5.in', action = buildIt,
+ XYZZY="XYZZY is set")
""" % (python, python, python, python))
test.write('f1.in', "f1.in\n")
test.write(['sub', 'f4a'], "sub/f4a\n")
test.write(['sub', 'f4b'], "sub/f4b\n")
test.write(['sub', 'f4c'], "sub/f4c\n")
+test.write('f5.in', "f5.in\n")
test.run(arguments = '.')
test.fail_test(test.read('f2.out') != "f2.in\n")
test.fail_test(test.read('f3.out') != "f3.in\n")
test.fail_test(test.read('f4.out') != "sub/f4a\nsub/f4b\nsub/f4c\n")
+test.fail_test(test.read('f5.out') != "XYZZY is set\nf5.in\n")
test.pass_test()
</head>
<body>
-<p>This is the initial web content for your project. Please customize
+<p>SCons is a next-generation,
+cross-platform build tool
this to fit your project. You dont need to anwser all these questions
or follow this exact format, but we do like to see this kind of
information before we approve projects for public viewing.