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 that switching SourceSignature() types no longer causes rebuilds.
35 test
= TestSCons
.TestSCons(match
= TestSCons
.match_re_dotall
)
37 expect
= TestSCons
.re_escape("""
38 scons: warning: The env.SourceSignatures() method is deprecated;
39 \tconvert your build to use the env.Decider() method instead.
40 """) + TestSCons
.file_expr
43 base_sconstruct_contents
= """\
44 SetOption('warn', 'deprecated-source-signatures')
45 SourceSignatures('%s')
47 def build(env, target, source):
48 with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp:
50 B = Builder(action = build)
51 env = Environment(BUILDERS = { 'B' : B })
52 env.B(target = 'switch.out', source = 'switch.in')
55 def write_SConstruct(test
, sig_type
):
56 contents
= base_sconstruct_contents
% sig_type
57 test
.write('SConstruct', contents
)
60 write_SConstruct(test
, 'MD5')
62 test
.write('switch.in', "switch.in\n")
64 switch_out_switch_in
= re
.escape(test
.wrap_stdout('build(["switch.out"], ["switch.in"])\n'))
66 test
.run(arguments
= 'switch.out',
67 stdout
= switch_out_switch_in
,
70 test
.up_to_date(arguments
= 'switch.out', stderr
= None)
73 write_SConstruct(test
, 'timestamp')
75 test
.up_to_date(arguments
= 'switch.out', stderr
= None)
78 write_SConstruct(test
, 'MD5')
80 test
.not_up_to_date(arguments
= 'switch.out', stderr
= None)
83 test
.write('switch.in', "switch.in 2\n")
85 test
.run(arguments
= 'switch.out',
86 stdout
= switch_out_switch_in
,
94 # indent-tabs-mode:nil
96 # vim: set expandtab tabstop=4 shiftwidth=4: