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():
"""
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', """
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
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)