diff options
author | Steven Knight <knight@baldmt.com> | 2005-05-14 14:32:44 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-05-14 14:32:44 (GMT) |
commit | a3bf620d551aea0cba3aa56a6c4cb33dc4de5f6a (patch) | |
tree | 479378732781cf8c06a2fbc935c149b4313eee6d /test | |
parent | cf2fb56d5c6956aa70b9314afd37fa6f90eff19b (diff) | |
download | SCons-a3bf620d551aea0cba3aa56a6c4cb33dc4de5f6a.zip SCons-a3bf620d551aea0cba3aa56a6c4cb33dc4de5f6a.tar.gz SCons-a3bf620d551aea0cba3aa56a6c4cb33dc4de5f6a.tar.bz2 |
Move pre- and post-actions lists from Node to Executor so expansions of ${TARGETS[1:]} work, and the actions aren't executed multiple times.
Diffstat (limited to 'test')
-rw-r--r-- | test/Actions/actions.py (renamed from test/actions.py) | 0 | ||||
-rw-r--r-- | test/Actions/append.py (renamed from test/append-action.py) | 0 | ||||
-rw-r--r-- | test/Actions/pre-post.py (renamed from test/pre-post-actions.py) | 35 |
3 files changed, 34 insertions, 1 deletions
diff --git a/test/actions.py b/test/Actions/actions.py index c805a05..c805a05 100644 --- a/test/actions.py +++ b/test/Actions/actions.py diff --git a/test/append-action.py b/test/Actions/append.py index fa3bb64..fa3bb64 100644 --- a/test/append-action.py +++ b/test/Actions/append.py diff --git a/test/pre-post-actions.py b/test/Actions/pre-post.py index 2d8458c..e25def5 100644 --- a/test/pre-post-actions.py +++ b/test/Actions/pre-post.py @@ -34,10 +34,11 @@ import sys import TestSCons _exe = TestSCons._exe +python = TestSCons.python test = TestSCons.TestSCons() -test.subdir('work1', 'work2', 'work3') +test.subdir('work1', 'work2', 'work3', 'work4') @@ -170,4 +171,36 @@ test.must_match(['work3', 'dir', 'file'], "build()\n") +test.write(['work4', 'build.py'], """\ +import sys +outfp = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + outfp.write(open(f, 'rb').read()) +outfp.close() +""") + +test.write(['work4', 'SConstruct'], """\ +def pre_action(target, source, env): + open(str(target[0]), 'ab').write('pre %%s\\n' %% source[0]) +def post_action(target, source, env): + open(str(target[0]), 'ab').write('post %%s\\n' %% source[0]) +env = Environment() +o = env.Command(['pre-post', 'file.out'], + 'file.in', + "%(python)s build.py ${TARGETS[1]} $SOURCE") +env.AddPreAction(o, pre_action) +env.AddPostAction(o, post_action) +""" % locals()) + +test.write(['work4', 'file.in'], "file.in\n") + +test.run(chdir='work4', arguments='.') + +test.must_match(['work4', 'file.out'], "file.in\n") +test.must_match(['work4', 'pre-post'], "pre file.in\npost file.in\n") + +test.pass_test() + + + test.pass_test() |