summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-01-16 10:13:42 (GMT)
committerSteven Knight <knight@baldmt.com>2003-01-16 10:13:42 (GMT)
commitc62170e2be12536add8df51ecbf414e560d93733 (patch)
tree7c13598eef89788b6a6a1557076610b430d30fb5
parent96dd44b54ee802476e86ad58dcc68a79fd757f9a (diff)
downloadSCons-c62170e2be12536add8df51ecbf414e560d93733.zip
SCons-c62170e2be12536add8df51ecbf414e560d93733.tar.gz
SCons-c62170e2be12536add8df51ecbf414e560d93733.tar.bz2
Fix bug in Clean() functionality. (Steve Leblanc)
-rw-r--r--src/engine/SCons/Script/SConscript.py13
-rw-r--r--test/option-c.py12
2 files changed, 21 insertions, 4 deletions
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index fcb08cf..29338a6 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -317,19 +317,24 @@ def SetJobs(num):
raise SCons.Errors.UserError, "A positive integer is required: %s"%repr(num)
def Clean(target, files):
- target = str(target)
+ if not isinstance(target, SCons.Node.Node):
+ target = SCons.Node.FS.default_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(SCons.Node.arg2nodes(f, SCons.Node.FS.default_fs.Entry))
- if clean_targets.has_key(target):
- clean_targets[target].extend(nodes)
+
+ s = str(target)
+ if clean_targets.has_key(s):
+ clean_targets[s].extend(nodes)
else:
- clean_targets[target] = nodes
+ clean_targets[s] = nodes
def BuildDefaultGlobals():
"""
diff --git a/test/option-c.py b/test/option-c.py
index f406574..15a33f3 100644
--- a/test/option-c.py
+++ b/test/option-c.py
@@ -152,6 +152,7 @@ test.writable('.', 1)
test.subdir('subd')
test.write(['subd', 'foon.in'], "foon.in\n")
+test.write(['subd', 'foox.in'], "foox.in\n")
test.write('aux1.x', "aux1.x\n")
test.write('aux2.x', "aux2.x\n")
test.write('SConstruct', """
@@ -161,11 +162,16 @@ env.B(target = 'foo1.out', source = 'foo1.in')
env.B(target = 'foo2.out', source = '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'])
Clean('foo2.xxx', ['aux2.x'])
Clean('.', ['subd'])
""" % python)
+test.write(['subd', 'SConscript'], """
+Clean('.', 'foox.in')
+""")
+
expect = test.wrap_stdout("""Removed foo2.xxx
Removed aux1.x
Removed aux2.x
@@ -176,10 +182,16 @@ test.fail_test(os.path.exists(test.workpath('foo2.xxx')))
test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n")
test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n")
+expect = test.wrap_stdout("""Removed subd/foox.in
+""")
+test.run(arguments = '-c subd', stdout=expect)
+test.fail_test(os.path.exists(test.workpath('foox.in')))
+
expect = test.wrap_stdout("""Removed foo1.out
Removed foo2.out
Removed foo3.out
Removed %s
+Removed subd/SConscript
Removed directory subd
""" % os.path.join('subd','foon.in'))
test.run(arguments = '-c .', stdout=expect)