summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-08-06 13:12:16 (GMT)
committerSteven Knight <knight@baldmt.com>2004-08-06 13:12:16 (GMT)
commitd2ffc02b7ca645f2c9bbd3042d739128b528124b (patch)
treeaa082468c1adc548cc9e419b70f9c30b96f1f6e6
parentb7dc7fc461b3a9170b14d8a026d69c0a28c2883d (diff)
downloadSCons-d2ffc02b7ca645f2c9bbd3042d739128b528124b.zip
SCons-d2ffc02b7ca645f2c9bbd3042d739128b528124b.tar.gz
SCons-d2ffc02b7ca645f2c9bbd3042d739128b528124b.tar.bz2
Fix fallout from having everything return a list.
-rw-r--r--doc/man/scons.113
-rw-r--r--src/engine/SCons/Environment.py36
-rw-r--r--test/option-c.py6
3 files changed, 23 insertions, 32 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index fac9635..957853e 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -2359,18 +2359,20 @@ or retrieved from the cache.
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
-.RI Clean( target ", " files_or_dirs )
+.RI Clean( targets ", " files_or_dirs )
.TP
-.RI env.Clean( target ", " files_or_dirs )
+.RI env.Clean( targets ", " files_or_dirs )
This specifies a list of files or directories which should be removed
-whenever the target is specified with the
+whenever the targets are specified with the
.B -c
command line option.
+The specified targets may be a list
+or an individual target.
Multiple calls to
.BR Clean ()
are legal,
-and create a new target or add files and directories to the
-clean list for the specified target.
+and create new targets or add files and directories to the
+clean list for the specified targets.
Multiple files or directories should be specified
either as separate arguments to the
@@ -2384,6 +2386,7 @@ Examples:
.ES
Clean('foo', ['bar', 'baz'])
Clean('dist', env.Program('hello', 'hello.c'))
+Clean(['foo', 'bar'], 'something_else_to_clean')
.EE
'\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 8e0c5ee..e38ebbb 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -356,15 +356,15 @@ class Base:
n = self.subst(n, raw=1)
if node_factory:
n = node_factory(n)
- try:
+ if SCons.Util.is_List(n):
nodes.extend(n)
- except TypeError:
+ else:
nodes.append(n)
elif node_factory:
v = node_factory(self.subst(v, raw=1))
- try:
+ if SCons.Util.is_List(v):
nodes.extend(v)
- except TypeError:
+ else:
nodes.append(v)
else:
nodes.append(v)
@@ -994,27 +994,15 @@ class Base:
def CacheDir(self, path):
self.fs.CacheDir(self.subst(path))
- def Clean(self, target, files):
+ def Clean(self, targets, files):
global CleanTargets
-
- if not isinstance(target, SCons.Node.Node):
- target = self.subst(target)
- target = self.fs.Entry(target, create=1)
-
- if not SCons.Util.is_List(files):
- files = [files]
-
- nodes = []
- for f in files:
- if isinstance(f, SCons.Node.Node):
- nodes.append(f)
- else:
- nodes.extend(self.arg2nodes(f, self.fs.Entry))
-
- try:
- CleanTargets[target].extend(nodes)
- except KeyError:
- CleanTargets[target] = nodes
+ tlist = self.arg2nodes(targets, self.fs.Entry)
+ flist = self.arg2nodes(files, self.fs.Entry)
+ for t in tlist:
+ try:
+ CleanTargets[t].extend(flist)
+ except KeyError:
+ CleanTargets[t] = flist
def Configure(self, *args, **kw):
nargs = [self]
diff --git a/test/option-c.py b/test/option-c.py
index 1596d9f..26d40ea 100644
--- a/test/option-c.py
+++ b/test/option-c.py
@@ -167,11 +167,11 @@ B = Builder(action = r'%s build.py $TARGETS $SOURCES')
env = Environment(BUILDERS = { 'B' : B }, FOO = 'foo2')
env.B(target = 'foo1.out', source = 'foo1.in')
env.B(target = 'foo2.out', source = 'foo2.xxx')
-env.B(target = 'foo2.xxx', source = 'foo2.in')
+foo2_xxx = env.B(target = 'foo2.xxx', source = 'foo2.in')
env.B(target = 'foo3.out', source = 'foo3.in')
SConscript('subd/SConscript')
-Clean('foo2.xxx', ['aux1.x'])
-env.Clean('${FOO}.xxx', ['aux2.x'])
+Clean(foo2_xxx, ['aux1.x'])
+env.Clean(['${FOO}.xxx'], ['aux2.x'])
Clean('.', ['subd'])
""" % python)