3 # Copyright (c) 2001, 2002 Steven Knight
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__"
33 test = TestSCons.TestSCons()
36 file, name, desc = imp.find_module('md5')
40 if desc[2] == imp.C_BUILTIN:
41 print "The 'md5' module is built in to this version of Python."
42 print "Cannot test falling back to timestamps."
45 test.write('md5.py', r"""
49 os.environ['PYTHONPATH'] = test.workpath('.')
51 test.write('SConstruct', """
52 def build(env, target, source):
53 open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
54 B = Builder(name = 'B', action = build)
55 env = Environment(BUILDERS = [B])
56 env.B(target = 'f1.out', source = 'f1.in')
57 env.B(target = 'f2.out', source = 'f2.in')
58 env.B(target = 'f3.out', source = 'f3.in')
59 env.B(target = 'f4.out', source = 'f4.in')
62 test.write('f1.in', "f1.in\n")
63 test.write('f2.in', "f2.in\n")
64 test.write('f3.in', "f3.in\n")
65 test.write('f4.in', "f4.in\n")
67 test.run(arguments = 'f1.out f3.out')
69 test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
70 """scons: "f1.out" is up to date.
71 scons: "f3.out" is up to date.
74 os.utime(test.workpath('f1.in'),
75 (os.path.getatime(test.workpath('f1.in')),
76 os.path.getmtime(test.workpath('f1.in'))+10))
77 os.utime(test.workpath('f3.in'),
78 (os.path.getatime(test.workpath('f3.in')),
79 os.path.getmtime(test.workpath('f3.in'))+10))
81 test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
82 """scons: "f2.out" is up to date.
83 scons: "f4.out" is up to date.