diff options
author | Steven Knight <knight@baldmt.com> | 2004-12-01 03:27:20 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-12-01 03:27:20 (GMT) |
commit | 0669f3c1e4f2c646d5bb53add2dfd389885c7172 (patch) | |
tree | f8eaf6856e88b24a68597c81b79afadf26a9500b /test/ZIP/ZIPCOMSTR.py | |
parent | aecc084531f05e110277d52d560b3e3c17fbf09a (diff) | |
download | SCons-0669f3c1e4f2c646d5bb53add2dfd389885c7172.zip SCons-0669f3c1e4f2c646d5bb53add2dfd389885c7172.tar.gz SCons-0669f3c1e4f2c646d5bb53add2dfd389885c7172.tar.bz2 |
More command-line customizability: and .
Diffstat (limited to 'test/ZIP/ZIPCOMSTR.py')
-rw-r--r-- | test/ZIP/ZIPCOMSTR.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/test/ZIP/ZIPCOMSTR.py b/test/ZIP/ZIPCOMSTR.py new file mode 100644 index 0000000..0ee90fd --- /dev/null +++ b/test/ZIP/ZIPCOMSTR.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that the $ZIPCOMSTR construction variable allows you to customize +the displayed string when zip is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myzip.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*zip*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['zip'], + ZIPCOM = r'%s myzip.py $TARGET $SOURCES', + ZIPCOMSTR = 'Zipping $TARGET from $SOURCE') +env.Zip('aaa.zip', 'aaa.in') +""" % python) + +test.write('aaa.in', "aaa.in\n/*zip*/\n") + +test.run(stdout = test.wrap_stdout("""\ +Zipping aaa.zip from aaa.in +""")) + +test.must_match('aaa.zip', "aaa.in\n") + + + +test.pass_test() |