summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--SConstruct33
-rw-r--r--doc/man/scons.19
-rw-r--r--src/CHANGES.txt1
-rw-r--r--src/engine/SCons/Environment.py8
-rw-r--r--src/engine/SCons/EnvironmentTests.py11
-rw-r--r--test/Command.py7
-rw-r--r--www/index.html3
8 files changed, 54 insertions, 24 deletions
diff --git a/README b/README
index f5325f1..c9b464e 100644
--- a/README
+++ b/README
@@ -97,7 +97,7 @@ system, populate the build/scons/ directory by running:
$ 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:
@@ -203,13 +203,13 @@ PACKAGES" section below.
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:
diff --git a/SConstruct b/SConstruct
index 00de8e3..0822095 100644
--- a/SConstruct
+++ b/SConstruct
@@ -848,8 +848,8 @@ for p in [ scons ]:
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),
@@ -858,8 +858,8 @@ for p in [ scons ]:
"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
@@ -979,10 +979,12 @@ if change:
#
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',
@@ -999,12 +1001,12 @@ if change:
'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}.
@@ -1033,10 +1035,12 @@ if change:
#
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',
@@ -1053,4 +1057,5 @@ if change:
'build',
'scons',
'setup.py'),
- ])
+ ],
+ ENV = ENV)
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index caba4a5..c12595e 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -2308,15 +2308,17 @@ Clean('dist', env.Program('hello', 'hello.c'))
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.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,
@@ -2330,7 +2332,8 @@ env.Command('foo.out', 'foo.in',
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
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 285ffbe..20c3b35 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -14,6 +14,7 @@ RELEASE 0.96 - XXX
- 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
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index ca25021..0edff88 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -892,13 +892,15 @@ class Base:
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):
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index ca0b458..3850ef6 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -1671,6 +1671,17 @@ class EnvironmentTestCase(unittest.TestCase):
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.
diff --git a/test/Command.py b/test/Command.py
index ff81f66..49a6ae3 100644
--- a/test/Command.py
+++ b/test/Command.py
@@ -47,6 +47,9 @@ import os
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
@@ -72,6 +75,8 @@ env.Command(target = 'f3.out', source = 'f3.in',
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")
@@ -80,6 +85,7 @@ test.write('f3.in', "f3.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 = '.')
@@ -87,5 +93,6 @@ test.fail_test(test.read('f1.out') != "f1.in\n")
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()
diff --git a/www/index.html b/www/index.html
index 26f2a49..1acf07a 100644
--- a/www/index.html
+++ b/www/index.html
@@ -3,7 +3,8 @@
</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.