import anydbm
SConsignFile('.sconsign_file_name', anydbm)
- - The internal Scanner.add_skey() method longer works for the default
- scanners, which now use construction variables to hold their lists
- of suffixes. If you had a custom Tool specification that was
+ - The scan_check function that can be supplied to a custom Scanner now
+ must take two arguments, the Node to be checked and a construction
+ environment. It previously only used the Node as an argument.
+
+ - The internal Scanner.add_skey() method no longer works for the
+ default scanners, which now use construction variables to hold their
+ lists of suffixes. If you had a custom Tool specification that was
reaching into the internals in this way to add a suffix to one of
the following scanner, you must now add the suffix to a construction
environment through which you plan to call the scanner, as follows:
import sys
import unittest
import UserDict
+import SCons.Sig
import SCons.Scanner
if type(path) != type([]):
path = [path]
return map(self.subst, path)
+ def get_calculator(self):
+ return SCons.Sig.default_calc
class FindPathDirsTestCase(unittest.TestCase):
def test_FindPathDirs(self):
assert result == ('xxx', 'foo'), result
class ScannerTestCase(unittest.TestCase):
-
+
def func(self, filename, env, target, *args):
self.filename = filename
self.env = env
if len(args) > 0:
self.arg = args[0]
-
+
return self.deps
def test(self, scanner, env, filename, deps, *args):
"""Test the Scanner.Base class scan_check() method"""
def my_scan(filename, env, target, *args):
return []
- def check(node, s=self):
+ def check(node, env, s=self):
s.checked[node] = 1
return 1
env = DummyEnvironment()
import imp
import os
import os.path
+import time
import TestSCons
test.up_to_date(arguments = 'f5.out f6.out f7.out f8.out')
+# Ensure that switching signature types causes a rebuild:
+test.write('SConstruct', """
+SourceSignatures('MD5')
+
+def build(env, target, source):
+ open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
+B = Builder(action = build)
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'switch.out', source = 'switch.in')
+""")
+
+test.write('switch.in', "switch.in\n")
+
+test.run(arguments = 'switch.out',
+ stdout = test.wrap_stdout("""\
+build("switch.out", "switch.in")
+"""))
+
+test.up_to_date(arguments = 'switch.out')
+
+test.write('SConstruct', """
+SourceSignatures('timestamp')
+
+def build(env, target, source):
+ open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
+B = Builder(action = build)
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'switch.out', source = 'switch.in')
+""")
+
+test.run(arguments = 'switch.out',
+ stdout = test.wrap_stdout("""\
+build("switch.out", "switch.in")
+"""))
+
+test.up_to_date(arguments = 'switch.out')
+
+test.write('SConstruct', """
+SourceSignatures('MD5')
+
+def build(env, target, source):
+ open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
+B = Builder(action = build)
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'switch.out', source = 'switch.in')
+""")
+
+test.run(arguments = 'switch.out',
+ stdout = test.wrap_stdout("""\
+build("switch.out", "switch.in")
+"""))
+
+test.up_to_date(arguments = 'switch.out')
+
+test.write('switch.in', "switch.in 2\n")
+
+test.run(arguments = 'switch.out',
+ stdout = test.wrap_stdout("""\
+build("switch.out", "switch.in")
+"""))
+
+
+# Test both implicit_cache and timestamp signatures at the same time:
+test.write('SConstruct', """
+SetOption('implicit_cache', 1)
+SourceSignatures('timestamp')
+
+def build(env, target, source):
+ open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
+B = Builder(action = build)
+env = Environment(BUILDERS = { 'B' : B })
+env.B(target = 'both.out', source = 'both.in')
+""")
+
+test.write('both.in', "both.in 1\n")
+
+test.run(arguments = 'both.out',
+ stdout = test.wrap_stdout("""\
+build("both.out", "both.in")
+"""))
+
+time.sleep(2)
+
+test.write('both.in', "both.in 2\n")
+
+test.run(arguments = 'both.out',
+ stdout = test.wrap_stdout("""\
+build("both.out", "both.in")
+"""))
+
+time.sleep(2)
+
+test.write('both.in', "both.in 3\n")
+
+test.run(arguments = 'both.out',
+ stdout = test.wrap_stdout("""\
+build("both.out", "both.in")
+"""))
+
+time.sleep(2)
+
+test.write('both.in', "both.in 4\n")
+
+test.run(arguments = 'both.out',
+ stdout = test.wrap_stdout("""\
+build("both.out", "both.in")
+"""))
+
+time.sleep(2)
+
+
+test.up_to_date(arguments = 'both.out')
+
test.pass_test()