5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 _python_
= TestSCons
._python
_
32 test
= TestSCons
.TestSCons()
34 test
.file_fixture('wrapper.py')
36 test
.write('SConstruct', """
37 DefaultEnvironment(tools=[])
38 foo = Environment(LIBS = ['foo'], LIBPATH = ['.'])
39 bar = Environment(LIBS = ['bar'], LIBPATH = ['.'],
40 AR = '', ARFLAGS = foo.subst(r'%(_python_)s wrapper.py $AR $ARFLAGS'))
41 foo.Library(target = 'foo', source = 'foo.c')
42 bar.Library(target = 'bar', source = 'bar.c')
44 obj = foo.Object('main', 'main.c')
46 foo.Program(target = 'f', source = obj)
47 bar.Program(target = 'b', source = obj)
50 test
.write('foo.c', r
"""
54 library_function(void)
60 test
.write('bar.c', r
"""
64 library_function(void)
70 test
.write('main.c', r
"""
77 main(int argc, char *argv[])
86 test
.run(arguments
= 'f' + _exe
,
87 stderr
=TestSCons
.noisy_ar
,
88 match
=TestSCons
.match_re_dotall
)
90 test
.must_not_exist(test
.workpath('wrapper.out'))
92 test
.run(arguments
= 'b' + _exe
,
93 stderr
=TestSCons
.noisy_ar
,
94 match
=TestSCons
.match_re_dotall
)
96 test
.must_match('wrapper.out', 'wrapper.py\n', mode
='r')
102 # indent-tabs-mode:nil
104 # vim: set expandtab tabstop=4 shiftwidth=4: