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 setting the $CVSCOM 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 env.Cat('aaa.out', 'aaa.in')
69 env.Cat('bbb.out', 'bbb.in')
70 env.Cat('ccc.out', 'ccc.in')
71 env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out'])
72 env.SourceCode('.', env.CVS(None))
73 SConscript('sub/SConscript', "env")
76 test.write(['CVS', 'sub', 'SConscript'], """\
78 env.Cat('ddd.out', 'ddd.in')
79 env.Cat('eee.out', 'eee.in')
80 env.Cat('fff.out', 'fff.in')
81 env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
84 test.write(['CVS', 'aaa.in'], "CVS/aaa.in\n")
85 test.write('bbb.in', "checked-out bbb.in\n")
86 test.write(['CVS', 'ccc.in'], "CVS/ccc.in\n")
88 test.write(['CVS', 'sub', 'ddd.in'], "CVS/sub/ddd.in\n")
89 test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
90 test.write(['CVS', 'sub', 'fff.in'], "CVS/sub/fff.in\n")
92 test.run(arguments = '.',
93 stdout = test.wrap_stdout(read_str = """\
94 %(_python_)s my-cvs-co-.py %(sub_SConscript)s
97 %(_python_)s my-cvs-co-.py aaa.in
98 cat(["aaa.out"], ["aaa.in"])
99 cat(["bbb.out"], ["bbb.in"])
100 %(_python_)s my-cvs-co-.py ccc.in
101 cat(["ccc.out"], ["ccc.in"])
102 cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
103 %(_python_)s my-cvs-co-.py %(sub_ddd_in)s
104 cat(["%(sub_ddd_out)s"], ["%(sub_ddd_in)s"])
105 cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"])
106 %(_python_)s my-cvs-co-.py %(sub_fff_in)s
107 cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"])
108 cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"])
111 test.must_match('all',
112 "CVS/aaa.in\nchecked-out bbb.in\nCVS/ccc.in\n")
114 test.must_match(['sub', 'all'],
115 "CVS/sub/ddd.in\nchecked-out sub/eee.in\nCVS/sub/fff.in\n")
124 # indent-tabs-mode:nil
126 # vim: set expandtab tabstop=4 shiftwidth=4: