summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--QMTest/TestSCons.py20
-rw-r--r--src/engine/SCons/Builder.py4
-rw-r--r--src/engine/SCons/Script/SConsOptions.py2
-rw-r--r--src/engine/SCons/Sig.py2
-rw-r--r--src/engine/SCons/Taskmaster.py5
-rw-r--r--src/engine/SCons/Warnings.py82
-rw-r--r--src/engine/SCons/WarningsTests.py8
-rw-r--r--test/Deprecated/Copy-Method.py12
-rw-r--r--test/Deprecated/SourceSignatures/basic.py23
-rw-r--r--test/Deprecated/SourceSignatures/env.py16
-rw-r--r--test/Deprecated/SourceSignatures/implicit-cache.py22
-rw-r--r--test/Deprecated/SourceSignatures/no-csigs.py10
-rw-r--r--test/Deprecated/SourceSignatures/overrides.py13
-rw-r--r--test/Deprecated/SourceSignatures/switch-rebuild.py15
-rw-r--r--test/Deprecated/TargetSignatures/build-content.py12
-rw-r--r--test/Deprecated/TargetSignatures/content.py16
-rw-r--r--test/Deprecated/TargetSignatures/overrides.py10
-rw-r--r--test/Deprecated/TaskmasterNeedsExecute.py17
18 files changed, 159 insertions, 130 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index f9e2250..2122977 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -409,6 +409,26 @@ class TestSCons(TestCommon):
kw['arguments'] = option + ' ' + arguments
return self.run(**kw)
+ def deprecated_warning(self, warn, msg):
+ """
+ Verifies the expected behavior occurs for deprecation warnings.
+ TODO: Need something else for deprecation errors.
+ """
+ # all warnings off, should get no output
+ self.run(arguments = '--warn=no-deprecated .', stderr='')
+
+ # warning enabled, should get expected output
+ stderr = '\nscons: warning: ' + re_escape(msg) + '\n' + file_expr
+ self.run(arguments = '--warn=%s .' % warn, stderr=stderr)
+
+ # no --warn option, should get either nothing or expected output
+ expect = """()|(%s)""" % (stderr)
+ self.run(arguments = '--warn=no-%s .' % warn, stderr=expect)
+
+ # warning disabled, should get either nothing or mandatory message
+ expect = """()|(Can not disable mandataory warning: 'no-%s'\n\n%s)""" % (warn, stderr)
+ self.run(arguments = '--warn=no-%s .' % warn, stderr=expect)
+
def diff_substr(self, expect, actual, prelen=20, postlen=40):
i = 0
for x, y in zip(expect, actual):
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index b062678..6dc9e17 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -388,13 +388,13 @@ class BuilderBase(object):
self.env = env
self.single_source = single_source
if 'overrides' in overrides:
- SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
+ SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning,
"The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
"\tspecify the items as keyword arguments to the Builder() call instead.")
overrides.update(overrides['overrides'])
del overrides['overrides']
if 'scanner' in overrides:
- SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
+ SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning,
"The \"scanner\" keyword to Builder() creation has been deprecated;\n"
"\tuse: source_scanner or target_scanner as appropriate.")
del overrides['scanner']
diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py
index db52509..141f9e8 100644
--- a/src/engine/SCons/Script/SConsOptions.py
+++ b/src/engine/SCons/Script/SConsOptions.py
@@ -613,7 +613,7 @@ def Parser(version):
parser.values.delayed_warnings = []
msg = deprecated_debug_options[value]
w = "The --debug=%s option is deprecated%s." % (value, msg)
- t = (SCons.Warnings.DeprecatedWarning, w)
+ t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
parser.values.delayed_warnings.append(t)
else:
raise OptionValueError("Warning: %s is not a valid debug type" % value)
diff --git a/src/engine/SCons/Sig.py b/src/engine/SCons/Sig.py
index 935596e..35fffc1 100644
--- a/src/engine/SCons/Sig.py
+++ b/src/engine/SCons/Sig.py
@@ -40,7 +40,7 @@ import SCons.Warnings
msg = 'The SCons.Sig module no longer exists.\n' \
' Remove the following "import SCons.Sig" line to eliminate this warning:'
-SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning, msg)
+SCons.Warnings.warn(SCons.Warnings.DeprecatedSigModuleWarning, msg)
default_calc = None
default_module = None
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py
index 2ab6980..8cf5595 100644
--- a/src/engine/SCons/Taskmaster.py
+++ b/src/engine/SCons/Taskmaster.py
@@ -201,8 +201,9 @@ class Task(object):
# Deprecation Cycle) so the desired behavior is explicitly
# determined by which concrete subclass is used.
#raise NotImplementedError
- msg = ('Direct use of the Taskmaster.Task class will be deprecated\n'
- + '\tin a future release.')
+ msg = ('Taskmaster.Task is an abstract base class; instead of\n'
+ '\tusing it directly, '
+ 'derive from it and override the abstract methods.')
SCons.Warnings.warn(SCons.Warnings.TaskmasterNeedsExecuteWarning, msg)
return True
diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py
index 1fa6302..b17d863 100644
--- a/src/engine/SCons/Warnings.py
+++ b/src/engine/SCons/Warnings.py
@@ -36,20 +36,6 @@ import SCons.Errors
class Warning(SCons.Errors.UserError):
pass
-class MandatoryWarning(Warning):
- pass
-
-
-
-class FutureDeprecatedWarning(Warning):
- pass
-
-class DeprecatedWarning(Warning):
- pass
-
-class MandatoryDeprecatedWarning(MandatoryWarning):
- pass
-
# NOTE: If you add a new warning class, add it to the man page, too!
@@ -63,18 +49,6 @@ class CorruptSConsignWarning(Warning):
class DependencyWarning(Warning):
pass
-class DeprecatedCopyWarning(DeprecatedWarning):
- pass
-
-class DeprecatedOptionsWarning(DeprecatedWarning):
- pass
-
-class DeprecatedSourceSignaturesWarning(DeprecatedWarning):
- pass
-
-class DeprecatedTargetSignaturesWarning(DeprecatedWarning):
- pass
-
class DuplicateEnvironmentWarning(Warning):
pass
@@ -102,18 +76,12 @@ class NoObjectCountWarning(Warning):
class NoParallelSupportWarning(Warning):
pass
-class PythonVersionWarning(DeprecatedWarning):
- pass
-
class ReservedVariableWarning(Warning):
pass
class StackSizeWarning(Warning):
pass
-class TaskmasterNeedsExecuteWarning(FutureDeprecatedWarning):
- pass
-
class VisualCMissingWarning(Warning):
pass
@@ -128,12 +96,55 @@ class VisualStudioMissingWarning(Warning):
class FortranCxxMixWarning(LinkWarning):
pass
-_warningAsException = 0
+
+# Deprecation warnings
+
+class FutureDeprecatedWarning(Warning):
+ pass
+
+class DeprecatedWarning(Warning):
+ pass
+
+class MandatoryDeprecatedWarning(DeprecatedWarning):
+ pass
+
+
+class PythonVersionWarning(DeprecatedWarning):
+ pass
+
+class DeprecatedCopyWarning(MandatoryDeprecatedWarning):
+ pass
+
+class DeprecatedOptionsWarning(MandatoryDeprecatedWarning):
+ pass
+
+class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning):
+ pass
+
+class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning):
+ pass
+
+class TaskmasterNeedsExecuteWarning(DeprecatedWarning):
+ pass
+
+class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning):
+ pass
+
+class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning):
+ pass
+
+class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning):
+ pass
+
# The below is a list of 2-tuples. The first element is a class object.
# The second element is true if that class is enabled, false if it is disabled.
_enabled = []
+# If set, raise the warning as an exception
+_warningAsException = 0
+
+# If not None, a function to call with the warning
_warningOut = None
def suppressWarningClass(clazz):
@@ -142,7 +153,7 @@ def suppressWarningClass(clazz):
_enabled.insert(0, (clazz, 0))
def enableWarningClass(clazz):
- """Suppresses all warnings that are of type clazz or
+ """Enable all warnings that are of type clazz or
derived from clazz."""
_enabled.insert(0, (clazz, 1))
@@ -181,8 +192,7 @@ def process_warn_strings(arguments):
"Warning" is appended to get the class name.
For example, 'deprecated' will enable the DeprecatedWarning
- class. 'no-dependency' will disable the .DependencyWarning
- class.
+ class. 'no-dependency' will disable the DependencyWarning class.
As a special case, --warn=all and --warn=no-all will enable or
disable (respectively) the base Warning class of all warnings.
diff --git a/src/engine/SCons/WarningsTests.py b/src/engine/SCons/WarningsTests.py
index 37cb623..583b12a 100644
--- a/src/engine/SCons/WarningsTests.py
+++ b/src/engine/SCons/WarningsTests.py
@@ -94,10 +94,6 @@ class WarningsTestCase(unittest.TestCase):
"Foo")
assert to.out is None, to.out
- SCons.Warnings.warn(SCons.Warnings.MandatoryWarning,
- "Foo")
- assert to.out is None, to.out
-
SCons.Warnings.enableWarningClass(SCons.Warnings.Warning)
SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
"Foo")
@@ -109,6 +105,10 @@ class WarningsTestCase(unittest.TestCase):
"Foo")
assert to.out is None, to.out
+ SCons.Warnings.warn(SCons.Warnings.MandatoryDeprecatedWarning,
+ "Foo")
+ assert to.out is None, to.out
+
# Dependency warnings should still be enabled though
SCons.Warnings.enableWarningClass(SCons.Warnings.Warning)
SCons.Warnings.warn(SCons.Warnings.DependencyWarning,
diff --git a/test/Deprecated/Copy-Method.py b/test/Deprecated/Copy-Method.py
index 3864b16..6909666 100644
--- a/test/Deprecated/Copy-Method.py
+++ b/test/Deprecated/Copy-Method.py
@@ -38,16 +38,8 @@ env = Environment().Copy()
env.Copy()
""")
-expect = """
-scons: warning: The env.Copy() method is deprecated; use the env.Clone() method instead.
-"""
-
-test.run(arguments = '.',
- stderr = TestSCons.re_escape(expect) + TestSCons.file_expr)
-
-test.run(arguments = '--warn=no-deprecated .')
-
-test.run(arguments = '--warn=no-deprecated-copy .')
+msg = """The env.Copy() method is deprecated; use the env.Clone() method instead."""
+test.deprecated_warning('deprecated-copy', msg)
test.pass_test()
diff --git a/test/Deprecated/SourceSignatures/basic.py b/test/Deprecated/SourceSignatures/basic.py
index 1340bc4..c762a73 100644
--- a/test/Deprecated/SourceSignatures/basic.py
+++ b/test/Deprecated/SourceSignatures/basic.py
@@ -32,9 +32,8 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
-
base_sconstruct_contents = """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
def build(env, target, source):
open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
B = Builder(action = build)
@@ -52,6 +51,10 @@ def write_SConstruct(test, sigtype):
test.write('SConstruct', contents)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
write_SConstruct(test, 'timestamp')
@@ -60,8 +63,7 @@ test.write('f2.in', "f2.in\n")
test.write('f3.in', "f3.in\n")
test.write('f4.in', "f4.in\n")
-test.run(arguments = 'f1.out f3.out',
- stderr = TestSCons.deprecated_python_expr)
+test.run(arguments = 'f1.out f3.out', stderr = expect)
test.run(arguments = 'f1.out f2.out f3.out f4.out',
stdout = re.escape(test.wrap_stdout("""\
@@ -70,8 +72,7 @@ build(["f2.out"], ["f2.in"])
scons: `f3.out' is up to date.
build(["f4.out"], ["f4.in"])
""")),
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
os.utime(test.workpath('f1.in'),
@@ -88,8 +89,7 @@ scons: `f2.out' is up to date.
build(["f3.out"], ["f3.in"])
scons: `f4.out' is up to date.
""")),
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
# Switching to content signatures from timestamps should rebuild,
@@ -97,9 +97,7 @@ scons: `f4.out' is up to date.
write_SConstruct(test, 'MD5')
-test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out',
- stderr = TestSCons.deprecated_python_expr)
-
+test.not_up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = expect)
test.sleep()
@@ -112,20 +110,17 @@ test.write('f4.in', "f4.in\n")
test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None)
-
test.touch('f1.in', os.path.getmtime(test.workpath('f1.in'))+10)
test.touch('f3.in', os.path.getmtime(test.workpath('f3.in'))+10)
test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None)
-
write_SConstruct(test, None)
test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None)
-
test.pass_test()
# Local Variables:
diff --git a/test/Deprecated/SourceSignatures/env.py b/test/Deprecated/SourceSignatures/env.py
index b2d6241..4851140 100644
--- a/test/Deprecated/SourceSignatures/env.py
+++ b/test/Deprecated/SourceSignatures/env.py
@@ -37,7 +37,7 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
base_sconstruct_contents = """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
def build(env, target, source):
open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
B = Builder(action = build)
@@ -57,6 +57,11 @@ def write_SConstruct(test, env_sigtype, default_sigtype):
test.write('SConstruct', contents)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+
write_SConstruct(test, 'MD5', 'timestamp')
@@ -65,8 +70,7 @@ test.write('f2.in', "f2.in\n")
test.write('f3.in', "f3.in\n")
test.write('f4.in', "f4.in\n")
-test.run(arguments = 'f1.out f3.out',
- stderr = TestSCons.deprecated_python_expr)
+test.run(arguments = 'f1.out f3.out', stderr = expect)
test.run(arguments = 'f1.out f2.out f3.out f4.out',
stdout = re.escape(test.wrap_stdout("""\
@@ -75,8 +79,7 @@ build(["f2.out"], ["f2.in"])
scons: `f3.out' is up to date.
build(["f4.out"], ["f4.in"])
""")),
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.sleep()
@@ -91,12 +94,11 @@ scons: `f2.out' is up to date.
scons: `f3.out' is up to date.
scons: `f4.out' is up to date.
""")),
- stderr = TestSCons.deprecated_python_expr)
+ stderr = expect)
test.up_to_date(arguments = 'f1.out f2.out f3.out f4.out', stderr = None)
-
test.pass_test()
# Local Variables:
diff --git a/test/Deprecated/SourceSignatures/implicit-cache.py b/test/Deprecated/SourceSignatures/implicit-cache.py
index 3911e25..ee43ae4 100644
--- a/test/Deprecated/SourceSignatures/implicit-cache.py
+++ b/test/Deprecated/SourceSignatures/implicit-cache.py
@@ -36,7 +36,7 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
test.write('SConstruct', """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
SetOption('implicit_cache', 1)
SourceSignatures('timestamp')
@@ -47,16 +47,20 @@ env = Environment(BUILDERS = { 'B' : B })
env.B(target = 'both.out', source = 'both.in')
""")
-both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n'))
+
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n'))
test.write('both.in', "both.in 1\n")
test.run(arguments = 'both.out',
stdout = both_out_both_in,
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.sleep(2)
@@ -65,8 +69,7 @@ test.write('both.in', "both.in 2\n")
test.run(arguments = 'both.out',
stdout = both_out_both_in,
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.sleep(2)
@@ -75,8 +78,7 @@ test.write('both.in', "both.in 3\n")
test.run(arguments = 'both.out',
stdout = both_out_both_in,
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.sleep(2)
@@ -85,8 +87,7 @@ test.write('both.in', "both.in 4\n")
test.run(arguments = 'both.out',
stdout = both_out_both_in,
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.sleep(2)
@@ -94,7 +95,6 @@ test.sleep(2)
test.up_to_date(arguments = 'both.out', stderr = None)
-
test.pass_test()
# Local Variables:
diff --git a/test/Deprecated/SourceSignatures/no-csigs.py b/test/Deprecated/SourceSignatures/no-csigs.py
index 5f47d9b..93ad408 100644
--- a/test/Deprecated/SourceSignatures/no-csigs.py
+++ b/test/Deprecated/SourceSignatures/no-csigs.py
@@ -34,7 +34,7 @@ test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
test.write('SConstruct', """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
def build(env, target, source):
open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
B = Builder(action = build)
@@ -47,9 +47,12 @@ SourceSignatures('timestamp')
test.write('f1.in', "f1.in\n")
test.write('f2.in', "f2.in\n")
-test.run(arguments = '.',
- stderr = TestSCons.deprecated_python_expr)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+test.run(arguments = '.', stderr = expect)
expect = r"""=== .:
@@ -68,7 +71,6 @@ test.run_sconsign(arguments = test.workpath('.sconsign'),
stdout = expect)
-
test.pass_test()
# Local Variables:
diff --git a/test/Deprecated/SourceSignatures/overrides.py b/test/Deprecated/SourceSignatures/overrides.py
index 63ee095..78e7bad 100644
--- a/test/Deprecated/SourceSignatures/overrides.py
+++ b/test/Deprecated/SourceSignatures/overrides.py
@@ -36,8 +36,13 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+
test.write('SConstruct', """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
DefaultEnvironment().SourceSignatures('MD5')
env = Environment()
env.SourceSignatures('timestamp')
@@ -46,15 +51,13 @@ env.Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=1)
test.write('foo.in', "foo.in 1\n")
-test.run(arguments = 'foo.out',
- stderr = TestSCons.deprecated_python_expr)
+test.run(arguments = 'foo.out', stderr = expect)
test.sleep()
test.write('foo.in', "foo.in 1\n")
-test.not_up_to_date(arguments = 'foo.out',
- stderr = TestSCons.deprecated_python_expr)
+test.not_up_to_date(arguments = 'foo.out', stderr = expect)
test.pass_test()
diff --git a/test/Deprecated/SourceSignatures/switch-rebuild.py b/test/Deprecated/SourceSignatures/switch-rebuild.py
index c8e64e3..70ebfbe 100644
--- a/test/Deprecated/SourceSignatures/switch-rebuild.py
+++ b/test/Deprecated/SourceSignatures/switch-rebuild.py
@@ -34,9 +34,14 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+
base_sconstruct_contents = """\
-SetOption('warn', 'no-deprecated-source-signatures')
+SetOption('warn', 'deprecated-source-signatures')
SourceSignatures('%s')
def build(env, target, source):
@@ -59,30 +64,26 @@ switch_out_switch_in = re.escape(test.wrap_stdout('build(["switch.out"], ["switc
test.run(arguments = 'switch.out',
stdout = switch_out_switch_in,
- stderr = TestSCons.deprecated_python_expr)
+ stderr = expect)
test.up_to_date(arguments = 'switch.out', stderr = None)
-
write_SConstruct(test, 'timestamp')
test.up_to_date(arguments = 'switch.out', stderr = None)
-
write_SConstruct(test, 'MD5')
test.not_up_to_date(arguments = 'switch.out', stderr = None)
-
test.write('switch.in', "switch.in 2\n")
test.run(arguments = 'switch.out',
stdout = switch_out_switch_in,
- stderr = TestSCons.deprecated_python_expr)
-
+ stderr = expect)
test.pass_test()
diff --git a/test/Deprecated/TargetSignatures/build-content.py b/test/Deprecated/TargetSignatures/build-content.py
index 7cf8ab8..6213ef6 100644
--- a/test/Deprecated/TargetSignatures/build-content.py
+++ b/test/Deprecated/TargetSignatures/build-content.py
@@ -36,10 +36,14 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+expect = TestSCons.re_escape("""
+scons: warning: The env.TargetSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
sconstruct_contents = """\
-SetOption('warn', 'no-deprecated-target-signatures')
+SetOption('warn', 'deprecated-target-signatures')
env = Environment()
def copy1(env, source, target):
@@ -81,7 +85,7 @@ copy1(["bar.out"], ["bar.mid"])
copy2(["foo.mid"], ["foo.in"])
copy1(["foo.out"], ["foo.mid"])
""")),
- stderr = TestSCons.deprecated_python_expr)
+ stderr = expect)
test.up_to_date(arguments='bar.out foo.out', stderr=None)
@@ -99,7 +103,7 @@ copy1(["bar.out"], ["bar.mid"])
copy2(["foo.mid"], ["foo.in"])
scons: `foo.out' is up to date.
""")),
- stderr = TestSCons.deprecated_python_expr)
+ stderr = expect)
@@ -124,7 +128,7 @@ scons: `bar.out' is up to date.
copy2(["foo.mid"], ["foo.in"])
copy1(["foo.out"], ["foo.mid"])
""")),
- stderr = TestSCons.deprecated_python_expr)
+ stderr = expect)
diff --git a/test/Deprecated/TargetSignatures/content.py b/test/Deprecated/TargetSignatures/content.py
index 3b2638f..5bd1a89 100644
--- a/test/Deprecated/TargetSignatures/content.py
+++ b/test/Deprecated/TargetSignatures/content.py
@@ -33,11 +33,18 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
+expect = TestSCons.re_escape("""
+scons: warning: The env.SourceSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.re_escape("""
+scons: warning: The env.TargetSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
test.write('SConstruct', """\
-SetOption('warn', 'no-deprecated-source-signatures')
-SetOption('warn', 'no-deprecated-target-signatures')
+SetOption('warn', 'deprecated-source-signatures')
+SetOption('warn', 'deprecated-target-signatures')
env = Environment()
def copy(env, source, target):
@@ -67,19 +74,18 @@ test.write('foo.in', "foo.in\n")
test.write('bar.in', "bar.in\n")
test.write('extra.in', "extra.in 1\n")
-test.run(stderr = TestSCons.deprecated_python_expr)
+test.run(stderr = expect)
test.must_match('final', "foo.in\nbar.in\nextra.in 1\n")
test.sleep()
test.write('extra.in', "extra.in 2\n")
-test.run(stderr = TestSCons.deprecated_python_expr)
+test.run(stderr = expect)
test.must_match('final', "foo.in\nbar.in\nextra.in 1\n")
-
test.pass_test()
# Local Variables:
diff --git a/test/Deprecated/TargetSignatures/overrides.py b/test/Deprecated/TargetSignatures/overrides.py
index 055c06b..bc8de34 100644
--- a/test/Deprecated/TargetSignatures/overrides.py
+++ b/test/Deprecated/TargetSignatures/overrides.py
@@ -36,7 +36,7 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
test.write('SConstruct', """\
-SetOption('warn', 'no-deprecated-target-signatures')
+SetOption('warn', 'deprecated-target-signatures')
env = Environment()
env.TargetSignatures('content')
env.Command('foo.out', 'foo.mid', Copy('$TARGET', '$SOURCE'), FOO=1)
@@ -45,8 +45,12 @@ env.Command('foo.mid', 'foo.in', Copy('$TARGET', '$SOURCE'), FOO=2)
test.write('foo.in', "foo.in\n")
-test.run(arguments = '.',
- stderr = TestSCons.deprecated_python_expr)
+expect = TestSCons.re_escape("""
+scons: warning: The env.TargetSignatures() method is deprecated;
+\tconvert your build to use the env.Decider() method instead.
+""") + TestSCons.file_expr + TestSCons.deprecated_python_expr
+
+test.run(arguments = '.', stderr = expect)
test.must_match('foo.mid', "foo.in\n")
test.must_match('foo.out', "foo.in\n")
diff --git a/test/Deprecated/TaskmasterNeedsExecute.py b/test/Deprecated/TaskmasterNeedsExecute.py
index 95e37b2..eb3de40 100644
--- a/test/Deprecated/TaskmasterNeedsExecute.py
+++ b/test/Deprecated/TaskmasterNeedsExecute.py
@@ -40,20 +40,9 @@ task = SCons.Taskmaster.Task(tm, [], True, None)
task.needs_execute()
""")
-expect = """
-scons: warning: Direct use of the Taskmaster.Task class will be deprecated
-\tin a future release.
-"""
-
-test.run(arguments = '.')
-
-test.run(arguments = '--warn=taskmaster-needs-execute .',
- stderr = TestSCons.re_escape(expect) + TestSCons.file_expr)
-
-test.run(arguments = '--warn=no-taskmaster-needs-execute .')
-
-test.run(arguments = '--warn=future-deprecated .',
- stderr = TestSCons.re_escape(expect) + TestSCons.file_expr)
+msg ="""Taskmaster.Task is an abstract base class; instead of
+\tusing it directly, derive from it and override the abstract methods."""
+test.deprecated_warning('taskmaster-needs-execute', msg)
test.pass_test()