Add warnings for use of the (already) deprecated Options object
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 20 Dec 2008 16:23:36 +0000 (16:23 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 20 Dec 2008 16:23:36 +0000 (16:23 +0000)
and its related functions.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@3839 fdb21ef1-2011-0410-befe-b5e4ea1792b1

17 files changed:
src/CHANGES.txt
src/engine/SCons/Options/BoolOption.py
src/engine/SCons/Options/EnumOption.py
src/engine/SCons/Options/ListOption.py
src/engine/SCons/Options/PackageOption.py
src/engine/SCons/Options/PathOption.py
src/engine/SCons/Options/__init__.py
src/engine/SCons/Warnings.py
test/Deprecated/Options/BoolOption.py
test/Deprecated/Options/EnumOption.py
test/Deprecated/Options/ListOption.py
test/Deprecated/Options/Options.py
test/Deprecated/Options/PackageOption.py
test/Deprecated/Options/PathOption.py
test/Deprecated/Options/chdir.py
test/Deprecated/Options/help.py
test/Deprecated/Options/import.py

index d334b64d5d206663d0e0dc3681ff9d7294ca385a..fb44ad7f83472add3f67bc99365186b244144e8d 100644 (file)
@@ -20,6 +20,8 @@ RELEASE 1.X - XXX
 
     - Don't fail if can't import a _subprocess module on Windows.
 
+    - Add warnings for use of the deprecated Options object.
+
   From Greg Spencer:
 
     - Support implicit dependency scanning of files encoded in utf-8
index c3b50b3075bb61ea8a416805d759dbdbbafd8019..a247ef5359db018e559c458d6020a8858dced060 100644 (file)
@@ -31,5 +31,14 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
-BoolOption = SCons.Variables.BoolVariable
+warned = False
+
+def BoolOption(*args, **kw):
+    global warned
+    if not warned:
+        msg = "The BoolOption() function is deprecated; use the BoolVariable() function instead."
+        SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+        warned = True
+    return apply(SCons.Variables.BoolVariable, args, kw)
index 24ccf28049eba2a0c38e5ea46b272da7ec5ce767..f4c3c0322bf7b00ed3561b4de2083a379f3e331f 100644 (file)
@@ -31,5 +31,14 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
-EnumOption = SCons.Variables.EnumVariable
+warned = False
+
+def EnumOption(*args, **kw):
+    global warned
+    if not warned:
+        msg = "The EnumOption() function is deprecated; use the EnumVariable() function instead."
+        SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+        warned = True
+    return apply(SCons.Variables.EnumVariable, args, kw)
index 1a56806795f5178dc93047a2673ebb714c89e10c..88334d44211823a579cb4caf01ef2e36b5ef3c71 100644 (file)
@@ -31,5 +31,14 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
-ListOption = SCons.Variables.ListVariable
+warned = False
+
+def ListOption(*args, **kw):
+    global warned
+    if not warned:
+        msg = "The ListOption() function is deprecated; use the ListVariable() function instead."
+        SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+        warned = True
+    return apply(SCons.Variables.ListVariable, args, kw)
index 479a8a28abe56790a8876e152b51c9e7649fc743..0f5ef7f6dea57dfcafac85c0223876e75e287491 100644 (file)
@@ -31,5 +31,14 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
-PackageOption = SCons.Variables.PackageVariable
+warned = False
+
+def PackageOption(*args, **kw):
+    global warned
+    if not warned:
+        msg = "The PackageOption() function is deprecated; use the PackageVariable() function instead."
+        SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+        warned = True
+    return apply(SCons.Variables.PackageVariable, args, kw)
index e694127235ced55a2350ecc68a1084fe24a8ed88..3223ac3698d0d5a095dff671116b2148a6424423 100644 (file)
@@ -31,5 +31,40 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
-PathOption = SCons.Variables.PathVariable
+warned = False
+
+class _PathOptionClass:
+    def warn(self):
+        global warned
+        if not warned:
+            msg = "The PathOption() function is deprecated; use the PathVariable() function instead."
+            SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+            warned = True
+
+    def __call__(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable, args, kw)
+
+    def PathAccept(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable.PathAccept, args, kw)
+
+    def PathIsDir(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable.PathIsDir, args, kw)
+
+    def PathIsDirCreate(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable.PathIsDirCreate, args, kw)
+
+    def PathIsFile(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable.PathIsFile, args, kw)
+
+    def PathExists(self, *args, **kw):
+        self.warn()
+        return apply(SCons.Variables.PathVariable.PathExists, args, kw)
+
+PathOption = _PathOptionClass()
index 5cc09a7fd578990999e2d16e1f37cff7a6bba5ab..e1e8b3fb922ced39547198f7575e9421acde84ad 100644 (file)
@@ -31,6 +31,7 @@ and will then be removed entirely (some day).
 """
 
 import SCons.Variables
+import SCons.Warnings
 
 from BoolOption import BoolOption  # okay
 from EnumOption import EnumOption  # okay
@@ -38,7 +39,18 @@ from ListOption import ListOption  # naja
 from PackageOption import PackageOption # naja
 from PathOption import PathOption # okay
 
+warned = False
+
 class Options(SCons.Variables.Variables):
+    def __init__(self, *args, **kw):
+        global warned
+        if not warned:
+            msg = "The Options class is deprecated; use the Variables class instead."
+            SCons.Warnings.warn(SCons.Warnings.DeprecatedOptionsWarning, msg)
+            warned = True
+        apply(SCons.Variables.Variables.__init__,
+              (self,) + args,
+              kw)
 
     def AddOptions(self, *args, **kw):
         return apply(SCons.Variables.Variables.AddVariables,
index 83e3ccbaf262f5d590b4429935e6ae49e3f45f0c..e23d1efa9e740a0dcee4b3b4ca94bd753d079a19 100644 (file)
@@ -67,6 +67,9 @@ class DependencyWarning(Warning):
 class DeprecatedCopyWarning(DeprecatedWarning):
     pass
 
+class DeprecatedOptionsWarning(DeprecatedWarning):
+    pass
+
 class DeprecatedSourceSignaturesWarning(DeprecatedWarning):
     pass
 
index d45ad1bcd38a70e9f91e745c9ef48de4b55dd2f8..99c2cd7a2548eeb8ba07a6e6574d6b20748af831 100644 (file)
@@ -28,7 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 Test the BoolOption canned Option type.
 """
 
-import os.path
 import string
 
 try:
@@ -39,7 +38,7 @@ except NameError:
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 SConstruct_path = test.workpath('SConstruct')
 
@@ -71,19 +70,25 @@ Default(env.Alias('dummy', None))
 """)
 
 
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%s
+scons: warning: The BoolOption\\(\\) function is deprecated; use the BoolVariable\\(\\) function instead.
+%s""" % (TestSCons.file_expr, TestSCons.file_expr)
+
+test.run(stderr=warnings)
 
-test.run()
 check([str(True), str(False)])
 
-test.run(arguments='warnings=0 profile=no profile=true')
+test.run(arguments='warnings=0 profile=no profile=true', stderr=warnings)
 check([str(False), str(True)])
 
-expect_stderr = """
-scons: *** Error converting option: warnings
+expect_stderr = (warnings + """
+scons: \\*\\*\\* Error converting option: warnings
 Invalid value for boolean option: irgendwas
-""" + test.python_file_line(SConstruct_path, 12)
+""" + TestSCons.file_expr)
 
-test.run(arguments='warnings=irgendwas', stderr = expect_stderr, status=2)
+test.run(arguments='warnings=irgendwas', stderr=expect_stderr, status=2)
 
 
 
index 29724f3d2fc88f37d6bbd85a44a6ec10ceec34aa..d46b89864239e2f4f3ed681e08547a55838f4768 100644 (file)
@@ -33,7 +33,7 @@ import string
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 SConstruct_path = test.workpath('SConstruct')
 
@@ -75,29 +75,36 @@ Default(env.Alias('dummy', None))
 """)
 
 
-test.run(); check(['no', 'gtk', 'xaver'])
 
-test.run(arguments='debug=yes guilib=Motif some=xAVER')
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%s
+scons: warning: The EnumOption\\(\\) function is deprecated; use the EnumVariable\\(\\) function instead.
+%s""" % (TestSCons.file_expr, TestSCons.file_expr)
+
+test.run(stderr=warnings); check(['no', 'gtk', 'xaver'])
+
+test.run(arguments='debug=yes guilib=Motif some=xAVER', stderr=warnings)
 check(['yes', 'Motif', 'xaver'])
 
-test.run(arguments='debug=full guilib=KdE some=EiNs')
+test.run(arguments='debug=full guilib=KdE some=EiNs', stderr=warnings)
 check(['full', 'KdE', 'eins'])
 
-expect_stderr = """
-scons: *** Invalid value for option debug: FULL
-""" + test.python_file_line(SConstruct_path, 21)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Invalid value for option debug: FULL
+""" + TestSCons.file_expr
 
 test.run(arguments='debug=FULL', stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Invalid value for option guilib: irgendwas
-""" + test.python_file_line(SConstruct_path, 21)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Invalid value for option guilib: irgendwas
+""" + TestSCons.file_expr
 
 test.run(arguments='guilib=IrGeNdwas', stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Invalid value for option some: irgendwas
-""" + test.python_file_line(SConstruct_path, 21)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Invalid value for option some: irgendwas
+""" + TestSCons.file_expr
 
 test.run(arguments='some=IrGeNdwas', stderr=expect_stderr, status=2)
 
index 7e7b18fbd84c82f67de5aff1a650fb5a45043599..62792b6ce6c18876d8e8f59ba40fe007eacc7e90 100644 (file)
@@ -35,7 +35,7 @@ import string
 import TestSCons
 
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 SConstruct_path = test.workpath('SConstruct')
 
@@ -81,7 +81,13 @@ print env.subst_path('$shared')
 Default(env.Alias('dummy', None))
 """)
 
-test.run()
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%s
+scons: warning: The ListOption\\(\\) function is deprecated; use the ListVariable\\(\\) function instead.
+%s""" % (TestSCons.file_expr, TestSCons.file_expr)
+
+test.run(stderr=warnings)
 check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
        "['gl ical qt x11']"])
 
@@ -91,61 +97,61 @@ test.must_match(test.workpath('scons.options'), expect)
 check(['all', '1', 'gl ical qt x11', 'gl ical qt x11',
        "['gl ical qt x11']"])
 
-test.run(arguments='shared=none')
+test.run(arguments='shared=none', stderr=warnings)
 check(['none', '0', '', '', "['']"])
 
-test.run(arguments='shared=')
+test.run(arguments='shared=', stderr=warnings)
 check(['none', '0', '', '', "['']"])
 
-test.run(arguments='shared=x11,ical')
+test.run(arguments='shared=x11,ical', stderr=warnings)
 check(['ical,x11', '1', 'ical x11', 'ical x11',
        "['ical x11']"])
 
-test.run(arguments='shared=x11,,ical,,')
+test.run(arguments='shared=x11,,ical,,', stderr=warnings)
 check(['ical,x11', '1', 'ical x11', 'ical x11',
        "['ical x11']"])
 
-test.run(arguments='shared=GL')
+test.run(arguments='shared=GL', stderr=warnings)
 check(['gl', '0', 'gl', 'gl'])
 
-test.run(arguments='shared=QT,GL')
+test.run(arguments='shared=QT,GL', stderr=warnings)
 check(['gl,qt', '0', 'gl qt', 'gl qt', "['gl qt']"])
 
 
-expect_stderr = """
-scons: *** Error converting option: shared
-Invalid value(s) for option: foo
-""" + test.python_file_line(SConstruct_path, 19)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Error converting option: shared
+Invalid value\\(s\\) for option: foo
+""" + TestSCons.file_expr
 
 test.run(arguments='shared=foo', stderr=expect_stderr, status=2)
 
 # be paranoid in testing some more combinations
 
-expect_stderr = """
-scons: *** Error converting option: shared
-Invalid value(s) for option: foo
-""" + test.python_file_line(SConstruct_path, 19)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Error converting option: shared
+Invalid value\\(s\\) for option: foo
+""" + TestSCons.file_expr
 
 test.run(arguments='shared=foo,ical', stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Error converting option: shared
-Invalid value(s) for option: foo
-""" + test.python_file_line(SConstruct_path, 19)
+expect_stderr = warnings +"""
+scons: \\*\\*\\* Error converting option: shared
+Invalid value\\(s\\) for option: foo
+""" + TestSCons.file_expr
 
 test.run(arguments='shared=ical,foo', stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Error converting option: shared
-Invalid value(s) for option: foo
-""" + test.python_file_line(SConstruct_path, 19)
+expect_stderr = warnings +"""
+scons: \\*\\*\\* Error converting option: shared
+Invalid value\\(s\\) for option: foo
+""" + TestSCons.file_expr
 
 test.run(arguments='shared=ical,foo,x11', stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Error converting option: shared
-Invalid value(s) for option: foo,bar
-""" + test.python_file_line(SConstruct_path, 19)
+expect_stderr = warnings +"""
+scons: \\*\\*\\* Error converting option: shared
+Invalid value\\(s\\) for option: foo,bar
+""" + TestSCons.file_expr
 
 test.run(arguments='shared=foo,x11,,,bar', stderr=expect_stderr, status=2)
 
@@ -169,9 +175,11 @@ print env['gpib']
 Default(env.Alias('dummy', None))
 """)
 
-test.run(stdout=test.wrap_stdout(read_str="ENET,GPIB\n", build_str="""\
+expect = test.wrap_stdout(read_str="ENET,GPIB\n", build_str="""\
 scons: Nothing to be done for `dummy'.
-"""))
+""")
+
+test.run(stdout=expect, stderr=warnings)
 
 
 
index 11452b125437e1bc9e575e404f32efdc16360614..1edfa97cc2e2adc06ed400299f10e34581ea7a74 100644 (file)
@@ -27,7 +27,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 import TestSCons
 import string
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 test.write('SConstruct', """
 import string
@@ -127,26 +127,31 @@ Default(env.Alias('dummy', None))
 
 """)
 
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+""" + TestSCons.file_expr
+
+
 def check(expect):
     result = string.split(test.stdout(), '\n')
     assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
 
-test.run()
+test.run(stderr=warnings)
 check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
 
-test.run(arguments='RELEASE_BUILD=1')
+test.run(arguments='RELEASE_BUILD=1', stderr=warnings)
 check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
 
-test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0')
+test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0', stderr=warnings)
 check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
 
-test.run(arguments='CC=not_a_c_compiler')
+test.run(arguments='CC=not_a_c_compiler', stderr=warnings)
 check(['0', '1', 'not_a_c_compiler', string.strip(ccflags + ' -g'), 'v', 'v'])
 
-test.run(arguments='UNDECLARED=foo')
+test.run(arguments='UNDECLARED=foo', stderr=warnings)
 check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
 
-test.run(arguments='CCFLAGS=--taco')
+test.run(arguments='CCFLAGS=--taco', stderr=warnings)
 check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
 
 test.write('custom.py', """
@@ -154,10 +159,10 @@ DEBUG_BUILD=0
 RELEASE_BUILD=1
 """)
 
-test.run()
+test.run(stderr=warnings)
 check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
 
-test.run(arguments='DEBUG_BUILD=1')
+test.run(arguments='DEBUG_BUILD=1', stderr=warnings)
 check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
 
 test.run(arguments='-h',
@@ -201,7 +206,8 @@ UNSPECIFIED: An option with no value
     actual: None
 
 Use scons -H for help about command-line options.
-"""%(cc, ccflags and ccflags + ' -O' or '-O', cc))
+"""%(cc, ccflags and ccflags + ' -O' or '-O', cc),
+         stderr=warnings)
 
 # Test saving of options and multi loading
 #
@@ -240,17 +246,17 @@ def checkSave(file, expected):
 
 # First test with no command line options
 # This should just leave the custom.py settings
-test.run()
+test.run(stderr=warnings)
 check(['1','0'])
 checkSave('options.saved', { 'RELEASE_BUILD':1, 'DEBUG_BUILD':0})
 
 # Override with command line arguments
-test.run(arguments='DEBUG_BUILD=3')
+test.run(arguments='DEBUG_BUILD=3', stderr=warnings)
 check(['1','3'])
 checkSave('options.saved', {'RELEASE_BUILD':1, 'DEBUG_BUILD':3})
 
 # Now make sure that saved options are overridding the custom.py
-test.run()
+test.run(stderr=warnings)
 check(['1','3'])
 checkSave('options.saved', {'DEBUG_BUILD':3, 'RELEASE_BUILD':1})
 
@@ -288,17 +294,17 @@ opts.Save('options.saved', env)
 """)
 
 # First check for empty output file when nothing is passed on command line
-test.run()
+test.run(stderr=warnings)
 check(['0','1'])
 checkSave('options.saved', {})
 
 # Now specify one option the same as default and make sure it doesn't write out
-test.run(arguments='DEBUG_BUILD=1')
+test.run(arguments='DEBUG_BUILD=1', stderr=warnings)
 check(['0','1'])
 checkSave('options.saved', {})
 
 # Now specify same option non-default and make sure only it is written out
-test.run(arguments='DEBUG_BUILD=0 LISTOPTION_TEST=a,b')
+test.run(arguments='DEBUG_BUILD=0 LISTOPTION_TEST=a,b', stderr=warnings)
 check(['0','0'])
 checkSave('options.saved',{'DEBUG_BUILD':0, 'LISTOPTION_TEST':'a,b'})
 
@@ -351,7 +357,8 @@ UNSPECIFIED: An option with no value
     actual: None
 
 Use scons -H for help about command-line options.
-"""%cc)
+"""%cc,
+         stderr=warnings)
 
 test.write('SConstruct', """
 import SCons.Options
@@ -359,6 +366,6 @@ env1 = Environment(options = Options())
 env2 = Environment(options = SCons.Options.Options())
 """)
 
-test.run()
+test.run(stderr=warnings)
 
 test.pass_test()
index b7dbc7107cc7aad4dfa1b0bafbda63e920918a28..11b8df0d9d72d8c02c5b9c86d8ee7643ab0d4ae4 100644 (file)
@@ -39,7 +39,7 @@ except NameError:
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 SConstruct_path = test.workpath('SConstruct')
 
@@ -70,21 +70,27 @@ print env['x11']
 Default(env.Alias('dummy', None))
 """)
 
-test.run()
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%s
+scons: warning: The PackageOption\\(\\) function is deprecated; use the PackageVariable\\(\\) function instead.
+%s""" % (TestSCons.file_expr, TestSCons.file_expr)
+
+test.run(stderr=warnings)
 check([str(True)])
 
-test.run(arguments='x11=no')
+test.run(arguments='x11=no', stderr=warnings)
 check([str(False)])
 
-test.run(arguments='x11=0')
+test.run(arguments='x11=0', stderr=warnings)
 check([str(False)])
 
-test.run(arguments=['x11=%s' % test.workpath()])
+test.run(arguments=['x11=%s' % test.workpath()], stderr=warnings)
 check([test.workpath()])
 
-expect_stderr = """
-scons: *** Path does not exist for option x11: /non/existing/path/
-""" + test.python_file_line(SConstruct_path, 14)
+expect_stderr = warnings + """
+scons: \\*\\*\\* Path does not exist for option x11: /non/existing/path/
+""" + TestSCons.file_expr
 
 test.run(arguments='x11=/non/existing/path/', stderr=expect_stderr, status=2)
 
index 3fa7e818d2b3de789e7d926ab465c5305eb7b6ec..9b845a130470bd69996ab1fcfadf08e4fb53ec50 100644 (file)
@@ -34,7 +34,7 @@ import string
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 SConstruct_path = test.workpath('SConstruct')
 
@@ -72,40 +72,43 @@ print env.subst('$qt_libraries')
 Default(env.Alias('dummy', None))
 """ % (workpath, os.path.join('$qtdir', 'lib') ))
 
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%s
+scons: warning: The PathOption\\(\\) function is deprecated; use the PathVariable\\(\\) function instead.
+%s""" % (TestSCons.file_expr, TestSCons.file_expr)
+
 qtpath = workpath
 libpath = os.path.join(qtpath, 'lib')
-test.run()
+test.run(stderr=warnings)
 check([qtpath, os.path.join('$qtdir', 'lib'), libpath])
 
 qtpath = os.path.join(workpath, 'qt')
 libpath = os.path.join(qtpath, 'lib')
-test.run(arguments=['qtdir=%s' % qtpath])
+test.run(arguments=['qtdir=%s' % qtpath], stderr=warnings)
 check([qtpath, os.path.join('$qtdir', 'lib'), libpath])
 
 qtpath = workpath
 libpath = os.path.join(qtpath, 'nolib')
-test.run(arguments=['qt_libraries=%s' % libpath])
+test.run(arguments=['qt_libraries=%s' % libpath], stderr=warnings)
 check([qtpath, libpath, libpath])
 
 qtpath = os.path.join(workpath, 'qt')
 libpath = os.path.join(workpath, 'nolib')
-test.run(arguments=['qtdir=%s' % qtpath, 'qt_libraries=%s' % libpath])
+test.run(arguments=['qtdir=%s' % qtpath, 'qt_libraries=%s' % libpath], stderr=warnings)
 check([qtpath, libpath, libpath])
 
 qtpath = os.path.join(workpath, 'non', 'existing', 'path')
-SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 14)[:-1]
 
-expect_stderr = """
-scons: *** Path for option qtdir does not exist: %(qtpath)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Path for option qtdir does not exist: %(qtpath)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['qtdir=%s' % qtpath], stderr=expect_stderr, status=2)
 
-expect_stderr = """
-scons: *** Path for option qt_libraries does not exist: %(qtpath)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Path for option qt_libraries does not exist: %(qtpath)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['qt_libraries=%s' % qtpath], stderr=expect_stderr, status=2)
 
@@ -138,19 +141,19 @@ print env['X']
 Default(env.Alias('dummy', None))
 """ % default_subdir)
 
-test.run()
+test.run(stderr=warnings)
 check([default_subdir])
 
-test.run(arguments=['X=%s' % existing_file])
+test.run(arguments=['X=%s' % existing_file], stderr=warnings)
 check([existing_file])
 
-test.run(arguments=['X=%s' % non_existing_file])
+test.run(arguments=['X=%s' % non_existing_file], stderr=warnings)
 check([non_existing_file])
 
-test.run(arguments=['X=%s' % existing_subdir])
+test.run(arguments=['X=%s' % existing_subdir], stderr=warnings)
 check([existing_subdir])
 
-test.run(arguments=['X=%s' % non_existing_subdir])
+test.run(arguments=['X=%s' % non_existing_subdir], stderr=warnings)
 check([non_existing_subdir])
 
 test.must_not_exist(non_existing_file)
@@ -171,34 +174,29 @@ print env['X']
 Default(env.Alias('dummy', None))
 """ % default_file)
 
-SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 6)[:-1]
-
-expect_stderr = """
-scons: *** File path for option X does not exist: %(default_file)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* File path for option X does not exist: %(default_file)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(status=2, stderr=expect_stderr)
 
 test.write(default_file, "default_file\n")
 
-test.run()
+test.run(stderr=warnings)
 check([default_file])
 
-expect_stderr = """
-scons: *** File path for option X is a directory: %(existing_subdir)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* File path for option X is a directory: %(existing_subdir)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['X=%s' % existing_subdir], status=2, stderr=expect_stderr)
 
-test.run(arguments=['X=%s' % existing_file])
+test.run(arguments=['X=%s' % existing_file], stderr=warnings)
 check([existing_file])
 
-expect_stderr = """
-scons: *** File path for option X does not exist: %(non_existing_file)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* File path for option X does not exist: %(non_existing_file)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['X=%s' % non_existing_file], status=2, stderr=expect_stderr)
 
@@ -217,34 +215,31 @@ print env['X']
 Default(env.Alias('dummy', None))
 """ % default_subdir)
 
-expect_stderr = """
-scons: *** Directory path for option X does not exist: %(default_subdir)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Directory path for option X does not exist: %(default_subdir)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(status=2, stderr=expect_stderr)
 
 test.subdir(default_subdir)
 
-test.run()
+test.run(stderr=warnings)
 check([default_subdir])
 
-expect_stderr = """
-scons: *** Directory path for option X is a file: %(existing_file)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Directory path for option X is a file: %(existing_file)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['X=%s' % existing_file],
          status=2,
          stderr=expect_stderr)
 
-test.run(arguments=['X=%s' % existing_subdir])
+test.run(arguments=['X=%s' % existing_subdir], stderr=warnings)
 check([existing_subdir])
 
-expect_stderr = """
-scons: *** Directory path for option X does not exist: %(non_existing_subdir)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Directory path for option X does not exist: %(non_existing_subdir)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['X=%s' % non_existing_subdir],
          status=2,
@@ -265,20 +260,19 @@ print env['X']
 Default(env.Alias('dummy', None))
 """ % default_subdir)
 
-test.run()
+test.run(stderr=warnings)
 check([default_subdir])
 
-expect_stderr = """
-scons: *** Path for option X is a file, not a directory: %(existing_file)s
-%(SConstruct_file_line)s
-""" % locals()
+expect_stderr = warnings + ("""
+scons: \\*\\*\\* Path for option X is a file, not a directory: %(existing_file)s
+""" % locals()) + TestSCons.file_expr
 
 test.run(arguments=['X=%s' % existing_file], status=2, stderr=expect_stderr)
 
-test.run(arguments=['X=%s' % existing_subdir])
+test.run(arguments=['X=%s' % existing_subdir], stderr=warnings)
 check([existing_subdir])
 
-test.run(arguments=['X=%s' % non_existing_subdir])
+test.run(arguments=['X=%s' % non_existing_subdir], stderr=warnings)
 check([non_existing_subdir])
 
 test.must_exist(non_existing_subdir)
index 7ba85eafbddca58c34952c48c87fb320283f50a8..dd4eb70b7e1731b1ff3905772632d3be85e6d953 100644 (file)
@@ -31,7 +31,7 @@ file lives by using the __name__ value.
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 test.subdir('bin', 'subdir')
 
@@ -66,6 +66,10 @@ expect = """\
 VARIABLE = 'opts2.cfg value'
 """
 
-test.run(arguments = '-q -Q .', stdout=expect)
+warnings = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+""" + TestSCons.file_expr
+
+test.run(arguments = '-q -Q .', stdout=expect, stderr=warnings)
 
 test.pass_test()
index d3fa9ad0ba36a13b907cc970c45788d595b055b7..049cb1e1fc050ad26dbd3e70d78e5e80c34d3b22 100644 (file)
@@ -42,7 +42,7 @@ str_False = str(False)
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 
 
@@ -97,54 +97,71 @@ Default(env.Alias('dummy', None))
 """ % locals())
 
 
-test.run(arguments='-h',
-         stdout = """\
+expected_stdout = """\
 scons: Reading SConscript files ...
 %(str_True)s
 %(str_False)s
 scons: done reading SConscript files.
 
-warnings: compilation with -Wall and similiar (yes|no)
+warnings: compilation with -Wall and similiar \\(yes|no\\)
     default: 1
     actual: %(str_True)s
 
-profile: create profiling informations (yes|no)
+profile: create profiling informations \\(yes|no\\)
     default: 0
     actual: %(str_False)s
 
-debug: debug output and symbols (yes|no|full)
+debug: debug output and symbols \\(yes|no|full\\)
     default: no
     actual: no
 
-guilib: gui lib to use (motif|gtk|kde)
+guilib: gui lib to use \\(motif|gtk|kde\\)
     default: gtk
     actual: gtk
 
-some: some option (xaver|eins)
+some: some option \\(xaver|eins\\)
     default: xaver
     actual: xaver
 
 shared: libraries to build as shared libraries
-    (all|none|comma-separated list of names)
+    \\(all|none|comma-separated list of names\\)
     allowed names: x11 gl qt ical
     default: all
     actual: x11 gl qt ical
 
-x11: use X11 installed here (yes = search some places)
-    ( yes | no | /path/to/x11 )
+x11: use X11 installed here \\(yes = search some places\\)
+    \\( yes | no | /path/to/x11 \\)
     default: yes
     actual: %(str_True)s
 
-qtdir: where the root of Qt is installed ( /path/to/qtdir )
+qtdir: where the root of Qt is installed \\( /path/to/qtdir \\)
     default: %(qtpath)s
     actual: %(qtpath)s
 
-qt_libraries: where the Qt library is installed ( /path/to/qt_libraries )
+qt_libraries: where the Qt library is installed \\( /path/to/qt_libraries \\)
     default: %(libdirvar)s
     actual: %(libpath)s
 
 Use scons -H for help about command-line options.
-""" % locals())
+""" % locals()
+
+file_expr = TestSCons.file_expr
+
+expected_stderr = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+%(file_expr)s
+scons: warning: The BoolOption\\(\\) function is deprecated; use the BoolVariable\\(\\) function instead.
+%(file_expr)s
+scons: warning: The EnumOption\\(\\) function is deprecated; use the EnumVariable\\(\\) function instead.
+%(file_expr)s
+scons: warning: The ListOption\\(\\) function is deprecated; use the ListVariable\\(\\) function instead.
+%(file_expr)s
+scons: warning: The PackageOption\\(\\) function is deprecated; use the PackageVariable\\(\\) function instead.
+%(file_expr)s
+scons: warning: The PathOption\\(\\) function is deprecated; use the PathVariable\\(\\) function instead.
+%(file_expr)s""" % locals()
+
+test.run(arguments='-h', stdout=expected_stdout, stderr=expected_stderr)
 
 
 
index 0a3d3670da64f2ce1e00bf52efa4a60e637581d6..93849867ed45704122861f9b4b3c1a6970179086 100644 (file)
@@ -31,7 +31,7 @@ a module in that directory.
 
 import TestSCons
 
-test = TestSCons.TestSCons()
+test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 
 workpath = test.workpath('')
 
@@ -62,8 +62,12 @@ VARIABLE = 'bin/local_options.py'
 
 test.write(['subdir', 'SConscript'], SConscript_contents)
 
-expect = "VARIABLE = bin/local_options.py\n"
+stdout = "VARIABLE = bin/local_options.py\n"
 
-test.run(arguments = '-q -Q .', stdout = expect)
+stderr = """
+scons: warning: The Options class is deprecated; use the Variables class instead.
+""" + TestSCons.file_expr
+
+test.run(arguments = '-q -Q .', stdout = stdout, stderr = stderr)
 
 test.pass_test()