diff options
author | Steven Knight <knight@baldmt.com> | 2002-11-25 17:22:28 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-11-25 17:22:28 (GMT) |
commit | 22c249b07f1831b86aca87ba1728a0cf19884b80 (patch) | |
tree | da3663b86e140824200771d866cfa6a01ee724d3 /test | |
parent | eaef3f7c8cd75bd92b75233bfbee8589f2b9e82b (diff) | |
download | SCons-22c249b07f1831b86aca87ba1728a0cf19884b80.zip SCons-22c249b07f1831b86aca87ba1728a0cf19884b80.tar.gz SCons-22c249b07f1831b86aca87ba1728a0cf19884b80.tar.bz2 |
Make env.SideEffect work for Dir nodes. (Anthony Roach)
Diffstat (limited to 'test')
-rw-r--r-- | test/SideEffect.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/SideEffect.py b/test/SideEffect.py index 6337f68..3f3b75d 100644 --- a/test/SideEffect.py +++ b/test/SideEffect.py @@ -118,5 +118,39 @@ foo.in -> foo.out """ assert test.read('log.txt') == expect +test.write('SConstruct', +""" +import os.path +import os + +def copy(source, target): + print 'copy() < %s > %s' % (source, target) + open(target, "wb").write(open(source, "rb").read()) + +def build(env, source, target): + copy(str(source[0]), str(target[0])) + if target[0].side_effects: + try: os.mkdir('log') + except: pass + copy(str(target[0]), os.path.join('log', str(target[0]))) + +Build = Builder(action=build) +env = Environment(BUILDERS={'Build':Build}) +env.Build('foo.out', 'foo.in') +env.Build('bar.out', 'bar.in') +env.Build('blat.out', 'blat.in') +env.SideEffect(Dir('log'), ['foo.out', 'bar.out', 'blat.out']) +""") + +test.run(arguments='foo.out') + +test.fail_test(not os.path.exists(test.workpath('foo.out'))) +test.fail_test(not os.path.exists(test.workpath('log/foo.out'))) +test.fail_test(os.path.exists(test.workpath('log/bar.out'))) +test.fail_test(os.path.exists(test.workpath('log/blat.out'))) + +test.run(arguments='log') +test.fail_test(not os.path.exists(test.workpath('log/bar.out'))) +test.fail_test(not os.path.exists(test.workpath('log/blat.out'))) test.pass_test() |