5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test customizing the output with the the $CVSCOMSTR variable.
35 _python_ = TestSCons._python_
37 test = TestSCons.TestSCons()
39 test.subdir('CVS', ['CVS', 'sub'], 'sub')
41 sub_CVS = os.path.join('sub', 'CVS')
42 sub_SConscript = os.path.join('sub', 'SConscript')
43 sub_all = os.path.join('sub', 'all')
44 sub_ddd_in = os.path.join('sub', 'ddd.in')
45 sub_ddd_out = os.path.join('sub', 'ddd.out')
46 sub_eee_in = os.path.join('sub', 'eee.in')
47 sub_eee_out = os.path.join('sub', 'eee.out')
48 sub_fff_in = os.path.join('sub', 'fff.in')
49 sub_fff_out = os.path.join('sub', 'fff.out')
51 test.write('my-cvs-co.py', """
54 for f in sys.argv[1:]:
55 shutil.copy('CVS/'+f, f)
58 test.write('SConstruct', """
59 def cat(env, source, target):
60 target = str(target[0])
61 f = open(target, "wb")
63 f.write(open(str(src), "rb").read())
65 env = Environment(TOOLS = ['default', 'CVS'],
66 BUILDERS={'Cat':Builder(action=cat)},
67 CVSCOM='%(_python_)s my-cvs-co.py $TARGET',
68 CVSCOMSTR='Checking out $TARGET from our fake CVS')
69 env.Cat('aaa.out', 'aaa.in')
70 env.Cat('bbb.out', 'bbb.in')
71 env.Cat('ccc.out', 'ccc.in')
72 env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
73 env.SourceCode('.', env.CVS(None))
74 SConscript('sub/SConscript', "env")
77 test.write(['CVS', 'sub', 'SConscript'], """\
79 env.Cat('ddd.out', 'ddd.in')
80 env.Cat('eee.out', 'eee.in')
81 env.Cat('fff.out', 'fff.in')
82 env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
85 test.write(['CVS', 'aaa.in'], "CVS/aaa.in\n")
86 test.write('bbb.in', "checked-out bbb.in\n")
87 test.write(['CVS', 'ccc.in'], "CVS/ccc.in\n")
89 test.write(['CVS', 'sub', 'ddd.in'], "CVS/sub/ddd.in\n")
90 test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
91 test.write(['CVS', 'sub', 'fff.in'], "CVS/sub/fff.in\n")
93 test.run(arguments = '.',
94 stdout = test.wrap_stdout(read_str = """\
95 Checking out %(sub_SConscript)s from our fake CVS
98 Checking out aaa.in from our fake CVS
99 cat(["aaa.out"], ["aaa.in"])
100 cat(["bbb.out"], ["bbb.in"])
101 Checking out ccc.in from our fake CVS
102 cat(["ccc.out"], ["ccc.in"])
103 cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
104 Checking out %(sub_ddd_in)s from our fake CVS
105 cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
106 cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
107 Checking out %(sub_fff_in)s from our fake CVS
108 cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
109 cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
112 test.must_match('all',
113 "CVS/aaa.in\nchecked-out bbb.in\nCVS/ccc.in\n")
115 test.must_match(['sub', 'all'],
116 "CVS/sub/ddd.in\nchecked-out sub/eee.in\nCVS/sub/fff.in\n")
125 # indent-tabs-mode:nil
127 # vim: set expandtab tabstop=4 shiftwidth=4: