diff options
author | Steven Knight <knight@baldmt.com> | 2002-03-31 06:03:14 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-03-31 06:03:14 (GMT) |
commit | a7669bc6a02999a3375c7e732a27ded5f9bb9935 (patch) | |
tree | 61beac46b020f72a91ce050f1dd1c6f407015352 | |
parent | 37bd22efa578e0c407a4e50fd3c40e20193a9260 (diff) | |
download | SCons-a7669bc6a02999a3375c7e732a27ded5f9bb9935.zip SCons-a7669bc6a02999a3375c7e732a27ded5f9bb9935.tar.gz SCons-a7669bc6a02999a3375c7e732a27ded5f9bb9935.tar.bz2 |
Make -c work with -n: don't remove the files!
-rw-r--r-- | src/CHANGES.txt | 8 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 9 | ||||
-rw-r--r-- | test/option-c.py | 17 | ||||
-rw-r--r-- | test/option-n.py | 13 |
4 files changed, 46 insertions, 1 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c78106b..0fc473c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -8,6 +8,14 @@ +RELEASE 0.07 - + + From Steven Knight: + + - Fix so that -c -n does *not* remove the targets! + + + RELEASE 0.06 - Thu, 28 Mar 2002 01:24:29 -0600 From Charles Crain: diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 6866e35..bd4f2ae 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -103,7 +103,11 @@ class BuildTask(SCons.Taskmaster.Task): class CleanTask(SCons.Taskmaster.Task): """An SCons clean task.""" - def execute(self): + def show(self): + if self.targets[0].builder: + print "Removed " + self.targets[0].path + + def remove(self): if self.targets[0].builder: try: os.unlink(self.targets[0].path) @@ -120,6 +124,8 @@ class CleanTask(SCons.Taskmaster.Task): except IndexError: pass + execute = remove + class QuestionTask(SCons.Taskmaster.Task): """An SCons task for the -q (question) option.""" def execute(self): @@ -494,6 +500,7 @@ def options_init(): def opt_n(opt, arg): SCons.Action.execute_actions = None + CleanTask.execute = CleanTask.show Option(func = opt_n, short = 'n', long = ['no-exec', 'just-print', 'dry-run', 'recon'], diff --git a/test/option-c.py b/test/option-c.py index c93a4d3..1a240de 100644 --- a/test/option-c.py +++ b/test/option-c.py @@ -104,5 +104,22 @@ test.fail_test(os.path.exists(test.workpath('foo1.out'))) test.fail_test(os.path.exists(test.workpath('foo2.out'))) test.fail_test(os.path.exists(test.workpath('foo3.out'))) +test.run(arguments = 'foo1.out foo2.out foo3.out') + +expect = """Removed foo1.out +Removed foo2.xxx +Removed foo2.out +Removed foo3.out +""" + +test.run(arguments = '-c -n foo1.out foo2.out foo3.out', stdout = expect) + +test.run(arguments = '-n -c foo1.out foo2.out foo3.out', stdout = expect) + +test.fail_test(test.read(test.workpath('foo1.out')) != "foo1.in\n") +test.fail_test(test.read(test.workpath('foo2.xxx')) != "foo2.in\n") +test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n") +test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n") + test.pass_test() diff --git a/test/option-n.py b/test/option-n.py index f0f6e11..f436dd2 100644 --- a/test/option-n.py +++ b/test/option-n.py @@ -81,5 +81,18 @@ test.run(arguments = '--recon ' + args, stdout = expect) test.fail_test(os.path.exists(test.workpath('f1.out'))) test.fail_test(os.path.exists(test.workpath('f2.out'))) +test.run(arguments = args) +test.fail_test(not os.path.exists(test.workpath('f1.out'))) +test.fail_test(not os.path.exists(test.workpath('f2.out'))) + +expect = "Removed f1.out\nRemoved f2.out\n" + +test.run(arguments = '-n -c ' + args, stdout = expect) + +test.run(arguments = '-c -n ' + args, stdout = expect) + +test.fail_test(not os.path.exists(test.workpath('f1.out'))) +test.fail_test(not os.path.exists(test.workpath('f2.out'))) + test.pass_test() |