Merge pull request #4655 from bdbaddog/fix_new_ninja_package
[scons.git] / test / Removed / TargetSignatures / Old / content.py
blobaca63f306d7ba417f8c9f48c7e311d742c884542
1 #!/usr/bin/env python
3 # __COPYRIGHT__
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__"
27 """
28 Verify use of the TargetSignatures('content') setting to override
29 SourceSignatures('timestamp') settings.
30 """
32 import TestSCons
34 test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
36 expect = TestSCons.re_escape("""
37 scons: warning: The env.SourceSignatures() method is deprecated;
38 \tconvert your build to use the env.Decider() method instead.
39 """) + TestSCons.file_expr + TestSCons.re_escape("""
40 scons: warning: The env.TargetSignatures() method is deprecated;
41 \tconvert your build to use the env.Decider() method instead.
42 """) + TestSCons.file_expr
45 test.write('SConstruct', """\
46 SetOption('warn', 'deprecated-source-signatures')
47 SetOption('warn', 'deprecated-target-signatures')
48 env = Environment()
50 def copy(env, source, target):
51 with open(str(target[0]), 'wb') as ofp:
52 for s in source:
53 with open(str(s), 'rb') as ifp:
54 ofp.write(ifp.read())
56 copyAction = Action(copy, "Copying $TARGET")
58 SourceSignatures('timestamp')
60 env['BUILDERS']['Copy'] = Builder(action=copyAction)
62 env.Copy('foo.out', 'foo.in')
64 env2 = env.Clone()
65 env2.TargetSignatures('content')
66 env2.Copy('bar.out', 'bar.in')
67 AlwaysBuild('bar.out')
69 env.Copy('final', ['foo.out', 'bar.out', 'extra.in'])
70 env.Ignore('final', 'extra.in')
71 """)
73 test.write('foo.in', "foo.in\n")
74 test.write('bar.in', "bar.in\n")
75 test.write('extra.in', "extra.in 1\n")
77 test.run(stderr = expect)
79 test.must_match('final', "foo.in\nbar.in\nextra.in 1\n")
81 test.sleep()
82 test.write('extra.in', "extra.in 2\n")
84 test.run(stderr = expect)
86 test.must_match('final', "foo.in\nbar.in\nextra.in 1\n")
89 test.pass_test()
91 # Local Variables:
92 # tab-width:4
93 # indent-tabs-mode:nil
94 # End:
95 # vim: set expandtab tabstop=4 shiftwidth=4: