From 56309561f2396659965eda63b30c69043e17d3f6 Mon Sep 17 00:00:00 2001 From: Greg Noel Date: Fri, 28 May 2010 09:40:40 +0000 Subject: http://scons.tigris.org/issues/show_bug.cgi?id=2365 Start the deprecation cycle for SourceCode() and its related factory functions. Deprecation messages are added to the functions. Regression tests are modified to deal with the messages being generated. Documentation is updated. --- QMTest/TestSCons.py | 93 ++++++++++-- doc/man/scons.1 | 33 ++++- src/CHANGES.txt | 2 + src/RELEASE.txt | 10 +- src/engine/SCons/Environment.py | 6 +- src/engine/SCons/Tool/BitKeeper.py | 2 + src/engine/SCons/Tool/CVS.py | 4 +- src/engine/SCons/Tool/Perforce.py | 5 +- src/engine/SCons/Tool/RCS.py | 4 +- src/engine/SCons/Tool/SCCS.py | 4 +- src/engine/SCons/Tool/Subversion.py | 4 +- src/engine/SCons/Tool/__init__.py | 37 +++-- test/Deprecated/BuildDir.py | 2 +- test/Deprecated/Copy-Method.py | 2 +- test/Deprecated/SConscript-build_dir.py | 6 +- .../SourceCode/BitKeeper/BITKEEPERCOM.py | 32 ++-- .../SourceCode/BitKeeper/BITKEEPERCOMSTR.py | 34 +++-- test/Deprecated/SourceCode/BitKeeper/BitKeeper.py | 161 +++++++++++++-------- test/Deprecated/SourceCode/CVS/CVS.py | 69 ++++++--- test/Deprecated/SourceCode/CVS/CVSCOM.py | 32 ++-- test/Deprecated/SourceCode/CVS/CVSCOMSTR.py | 32 ++-- test/Deprecated/SourceCode/Perforce/P4COM.py | 32 ++-- test/Deprecated/SourceCode/Perforce/P4COMSTR.py | 31 +++- test/Deprecated/SourceCode/Perforce/Perforce.py | 18 ++- test/Deprecated/SourceCode/RCS/RCS_COCOM.py | 34 +++-- test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py | 32 ++-- test/Deprecated/SourceCode/RCS/changed.py | 24 +-- test/Deprecated/SourceCode/RCS/diskcheck.py | 33 +++-- test/Deprecated/SourceCode/RCS/explicit.py | 33 +++-- test/Deprecated/SourceCode/RCS/implicit.py | 12 +- test/Deprecated/SourceCode/RCS/transparent.py | 31 ++-- test/Deprecated/SourceCode/SCCS/SCCSCOM.py | 32 ++-- test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py | 34 +++-- test/Deprecated/SourceCode/SCCS/diskcheck.py | 20 ++- test/Deprecated/SourceCode/SCCS/explicit.py | 11 +- test/Deprecated/SourceCode/SCCS/implicit.py | 10 +- test/Deprecated/SourceCode/SCCS/transparent.py | 10 +- test/Deprecated/SourceCode/SourceCode.py | 27 +++- test/Deprecated/SourceCode/Subversion.py | 12 ++ test/Deprecated/TaskmasterNeedsExecute.py | 2 +- test/implicit/changed-node.py | 6 - 41 files changed, 712 insertions(+), 306 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index c49077b..0668f9d 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -424,31 +424,92 @@ class TestSCons(TestCommon): kw['arguments'] = option + ' ' + arguments return self.run(**kw) + def deprecated_wrap(self, msg): + """ + Calculate the pattern that matches a deprecation warning. + """ + return '\nscons: warning: ' + re_escape(msg) + '\n' + file_expr + + def deprecated_fatal(self, warn, msg): + """ + Determines if the warning has turned into a fatal error. If so, + passes the test, as any remaining runs are now moot. + + This method expects a SConscript to be present that will causes + the warning. The method writes a SConstruct that calls the + SConsscript and looks to see what type of result occurs. + + The pattern that matches the warning is returned. + + TODO: Actually detect that it's now an error. We don't have any + cases yet, so there's no way to test it. + """ + self.write('SConstruct', """if True: + WARN = ARGUMENTS.get('WARN') + if WARN: SetOption('warn', WARN) + SConscript('SConscript') + """) + + def err_out(): + # TODO calculate stderr for fatal error + return re_escape('put something here') + + # no option, should get one of nothing, warning, or error + warning = self.deprecated_wrap(msg) + self.run(arguments = '.', stderr = None) + stderr = self.stderr() + if stderr: + # most common case done first + if match_re_dotall(stderr, warning): + # expected output + pass + elif match_re_dotall(stderr, err_out()): + # now a fatal error; skip the rest of the tests + self.pass_test() + else: + # test failed; have to do this by hand... + print self.banner('STDOUT ') + print self.stdout() + print self.diff(warning, stderr, 'STDERR ') + self.fail_test() + + return warning + def deprecated_warning(self, warn, msg): """ Verifies the expected behavior occurs for deprecation warnings. - TODO: Need something else for deprecation errors. + This method expects a SConscript to be present that will causes + the warning. The method writes a SConstruct and exercises various + combinations of command-line options and SetOption parameters to + validate that it performs correctly. + + The pattern that matches the warning is returned. """ + warning = self.deprecated_fatal(warn, msg) + + def RunPair(option, expected): + # run the same test with the option on the command line and + # then with the option passed via SetOption(). + self.run(options = '--warn=' + option, + arguments = '.', + stderr = expected, + match = match_re_dotall) + self.run(options = 'WARN=' + option, + arguments = '.', + stderr = expected, + match = match_re_dotall) + # all warnings off, should get no output - self.run(arguments = '--warn=no-deprecated .', stderr='') + RunPair('no-deprecated', '') # warning enabled, should get expected output - stderr = '\nscons: warning: ' + re_escape(msg) + '\n' + file_expr - self.run(arguments = '--warn=%s .' % warn, - stderr=stderr, - match = match_re_dotall) - - # no --warn option, should get either nothing or expected output - expect = """()|(%s)""" % (stderr) - self.run(arguments = '--warn=no-%s .' % warn, - stderr=expect, - match = match_re_dotall) + RunPair(warn, warning) # 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, - match = match_re_dotall) + expect = """()|(Can not disable mandataory warning: 'no-%s'\n\n%s)""" % (warn, warning) + RunPair('no-' + warn, expect) + + return warning def diff_substr(self, expect, actual, prelen=20, postlen=40): i = 0 diff --git a/doc/man/scons.1 b/doc/man/scons.1 index fd2baa3..da6c918 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -2786,6 +2786,10 @@ is intended to be passed to the .B SourceCode function. +This function is deprecated. For details, see the entry for the +.B SourceCode +function. + Example: .ES @@ -3168,6 +3172,10 @@ replicate part of the repository directory hierarchy in your local build directory. +This function is deprecated. For details, see the entry for the +.B SourceCode +function. + Examples: .ES @@ -3735,7 +3743,7 @@ in the path specified by .IR dirs . .I dirs may be a list of directory names or a single directory name. -In addition to searching for files that exist in the filesytem, +In addition to searching for files that exist in the filesystem, this function also searches for derived files that have not yet been built. @@ -4719,6 +4727,10 @@ is intended to be passed to the .B SourceCode function. +This function is deprecated. For details, see the entry for the +.B SourceCode +function. + Example: .ES @@ -5012,6 +5024,10 @@ is intended to be passed to the .B SourceCode function: +This function is deprecated. For details, see the entry for the +.B SourceCode +function. + Examples: .ES @@ -5180,6 +5196,10 @@ is intended to be passed to the .B SourceCode function. +This function is deprecated. For details, see the entry for the +.B SourceCode +function. + Example: .ES @@ -5638,6 +5658,13 @@ function. .RI SourceCode( entries ", " builder ) .TP .RI env.SourceCode( entries ", " builder ) +This function and its associate factory functions are deprecated. +There is no replacement. +The intended use was to keep a local tree in sync with an archive, +but in actuality the function only causes the archive +to be fetched on the first run. +Synchronizing with the archive is best done external to SCons. + Arrange for non-existent source files to be fetched from a source code management system using the specified @@ -5826,6 +5853,10 @@ source_nodes = env.subst('$EXPAND_TO_NODELIST', '\"directory hierarchy in your '\"local build directory. '\" +'\"This function is deprecated. For details, see the entry for the +'\".B SourceCode +'\"function. +'\" '\"Example: '\" '\".ES diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 628d012..e494a95 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -75,6 +75,8 @@ RELEASE 2.0.0.alpha.20100508 - Sat, 08 May 2010 14:29:17 -0700 - Start deprecation cycle for BuildDir() and build_dir. + - Start deprecation cycle for SourceCode() and related factories + RELEASE 1.3.0 - Tue, 23 Mar 2010 21:44:19 -0400 diff --git a/src/RELEASE.txt b/src/RELEASE.txt index bc12077..89508c6 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -43,6 +43,9 @@ - The BuildDir() method and the build_dir option now get warnings. + - The SourceCode() function and its associated factory functions have + started their deprecation cycle and can have a warning enabled. + CHANGED/ENHANCED EXISTING FUNCTIONALITY - Any Command() or env.Command() calls that use the following Action @@ -82,7 +85,8 @@ DOCUMENTATION - - No changes. + - The entried for SourceCode() and its associated factory functions now + state that the functions are deprecated. DEVELOPMENT @@ -90,5 +94,5 @@ Although code is tested with Python 2.3 and is still believed to work, the official new floor is Python 2.4. - Thanks to Greg Noel and Steven Knight for their contributions to this - release. + Thanks to Greg Noel, Steven Knight, Dirk Baechle, and W. Trevor King for + their contributions to this release. diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 38a712e..b2ae4de 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -2045,9 +2045,9 @@ class Base(SubstitutionEnvironment): def SourceCode(self, entry, builder): """Arrange for a source code builder for (part of) a tree.""" - #msg = """SourceCode() has been deprecated and there is no replacement. -#\tIf you need this function, please contact dev@scons.tigris.org.""" - #SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) + msg = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedSourceCodeWarning, msg) entries = self.arg2nodes(entry, self.fs.Entry) for entry in entries: entry.set_src_builder(builder) diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py index 004ffeb..191879f 100644 --- a/src/engine/SCons/Tool/BitKeeper.py +++ b/src/engine/SCons/Tool/BitKeeper.py @@ -44,6 +44,8 @@ def generate(env): def BitKeeperFactory(env=env): """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The BitKeeper() factory is deprecated and there is no replacement.""") act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR") return SCons.Builder.Builder(action = act, env = env) diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py index e71635e..a506231 100644 --- a/src/engine/SCons/Tool/CVS.py +++ b/src/engine/SCons/Tool/CVS.py @@ -8,7 +8,6 @@ selection method. """ -# # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +28,6 @@ selection method. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -43,6 +41,8 @@ def generate(env): def CVSFactory(repos, module='', env=env): """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The CVS() factory is deprecated and there is no replacement.""") # fail if repos is not an absolute path name? if module != '': # Don't use os.path.join() because the name we fetch might diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py index 8d30d12..15dd83f 100644 --- a/src/engine/SCons/Tool/Perforce.py +++ b/src/engine/SCons/Tool/Perforce.py @@ -8,7 +8,6 @@ selection method. """ -# # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +28,6 @@ selection method. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -44,7 +42,6 @@ import SCons.Util from SCons.Tool.PharLapCommon import addPathIfNotExists - # Variables that we want to import from the base OS environment. _import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD', 'P4CHARSET', 'P4LANGUAGE', 'SystemRoot' ] @@ -57,6 +54,8 @@ def generate(env): def PerforceFactory(env=env): """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The Perforce() factory is deprecated and there is no replacement.""") return SCons.Builder.Builder(action = PerforceAction, env = env) #setattr(env, 'Perforce', PerforceFactory) diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py index bb4721b..6ac1a33 100644 --- a/src/engine/SCons/Tool/RCS.py +++ b/src/engine/SCons/Tool/RCS.py @@ -8,7 +8,6 @@ selection method. """ -# # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +28,6 @@ selection method. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -43,6 +41,8 @@ def generate(env): def RCSFactory(env=env): """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The RCS() factory is deprecated and there is no replacement.""") act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR') return SCons.Builder.Builder(action = act, env = env) diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py index 99582e2..7653468 100644 --- a/src/engine/SCons/Tool/SCCS.py +++ b/src/engine/SCons/Tool/SCCS.py @@ -8,7 +8,6 @@ selection method. """ -# # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +28,6 @@ selection method. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -43,6 +41,8 @@ def generate(env): def SCCSFactory(env=env): """ """ + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The SCCS() factory is deprecated and there is no replacement.""") act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR') return SCons.Builder.Builder(action = act, env = env) diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py index 05a8adb..ee70925 100644 --- a/src/engine/SCons/Tool/Subversion.py +++ b/src/engine/SCons/Tool/Subversion.py @@ -8,7 +8,6 @@ selection method. """ -# # __COPYRIGHT__ # # Permission is hereby granted, free of charge, to any person obtaining @@ -29,7 +28,6 @@ selection method. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -46,6 +44,8 @@ def generate(env): def SubversionFactory(repos, module='', env=env): """ """ # fail if repos is not an absolute path name? + import SCons.Warnings as W + W.warn(W.DeprecatedSourceCodeWarning, """The Subversion() factory is deprecated and there is no replacement.""") if module != '': module = os.path.join(module, '') act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR') diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 05f095f..9d9855b 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -645,21 +645,28 @@ def tool_list(platform, env): fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] ar = FindTool(ars, env) or ars[0] - other_tools = FindAllTools(['BitKeeper', 'CVS', - 'dmd', - 'filesystem', - 'dvipdf', 'dvips', 'gs', - 'jar', 'javac', 'javah', - 'latex', 'lex', - 'm4', #'midl', 'msvs', - 'pdflatex', 'pdftex', 'Perforce', - 'RCS', 'rmic', 'rpcgen', - 'SCCS', - # 'Subversion', - 'swig', - 'tar', 'tex', - 'yacc', 'zip', 'rpm', 'wix']+other_plat_tools, - env) + other_tools = FindAllTools(other_plat_tools + [ + 'dmd', + #TODO: merge 'install' into 'filesystem' and + # make 'filesystem' the default + 'filesystem', + 'm4', + 'wix', #'midl', 'msvs', + # Parser generators + 'lex', 'yacc', + # Foreign function interface + 'rpcgen', 'swig', + # Java + 'jar', 'javac', 'javah', 'rmic', + # TeX + 'dvipdf', 'dvips', 'gs', + 'tex', 'latex', 'pdflatex', 'pdftex', + # Archivers + 'tar', 'zip', 'rpm', + # SourceCode factories + 'BitKeeper', 'CVS', 'Perforce', + 'RCS', 'SCCS', # 'Subversion', + ], env) tools = ([linker, c_compiler, cxx_compiler, fortran_compiler, assembler, ar] diff --git a/test/Deprecated/BuildDir.py b/test/Deprecated/BuildDir.py index 5fe10c0..b0d6610 100644 --- a/test/Deprecated/BuildDir.py +++ b/test/Deprecated/BuildDir.py @@ -35,7 +35,7 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() -test.write('SConstruct', """ +test.write('SConscript', """ BuildDir('build', 'src') """) diff --git a/test/Deprecated/Copy-Method.py b/test/Deprecated/Copy-Method.py index 6909666..2714f64 100644 --- a/test/Deprecated/Copy-Method.py +++ b/test/Deprecated/Copy-Method.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) -test.write('SConstruct', """ +test.write('SConscript', """ env = Environment().Copy() env.Copy() """) diff --git a/test/Deprecated/SConscript-build_dir.py b/test/Deprecated/SConscript-build_dir.py index 76ff688..c9ec07e 100644 --- a/test/Deprecated/SConscript-build_dir.py +++ b/test/Deprecated/SConscript-build_dir.py @@ -32,11 +32,11 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) -test.write('SConstruct', """ -SConscript('SConscript', build_dir = 'build') +test.write('SConscript', """ +SConscript('DummyScript', build_dir = 'build') """) -test.write('SConscript', """ +test.write('DummyScript', """ """) msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" diff --git a/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOM.py b/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOM.py index d01ad96..eb75a8f 100644 --- a/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOM.py +++ b/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOM.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['BitKeeper']).BitKeeper() +""") + +msg_bk = """The BitKeeper() factory is deprecated and there is no replacement.""" +warn_bk = test.deprecated_fatal('deprecated-build-dir', msg_bk) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('BitKeeper', ['BitKeeper', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -89,11 +99,11 @@ test.write(['BitKeeper', 'sub', 'ddd.in'], "BitKeeper/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['BitKeeper', 'sub', 'fff.in'], "BitKeeper/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %(_python_)s my-bk-get.py %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ %(_python_)s my-bk-get.py aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -106,7 +116,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-bk-get.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_bk + warn_sc) test.must_match('all', "BitKeeper/aaa.in\nchecked-out bbb.in\nBitKeeper/ccc.in\n") @@ -115,8 +131,6 @@ test.must_match(['sub', 'all'], "BitKeeper/sub/ddd.in\nchecked-out sub/eee.in\nBitKeeper/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOMSTR.py b/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOMSTR.py index 311ef4d..ca58b83 100644 --- a/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOMSTR.py +++ b/test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOMSTR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['BitKeeper']).BitKeeper() +""") + +msg_bk = """The BitKeeper() factory is deprecated and there is no replacement.""" +warn_bk = test.deprecated_fatal('deprecated-build-dir', msg_bk) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('BitKeeper', ['BitKeeper', 'sub'], 'sub') @@ -56,13 +65,14 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") for src in source: f.write(open(str(src), "rb").read()) f.close() -env = Environment(TOOLS = ['default', 'BitKeeper'], +env = Environment(tools = ['default', 'BitKeeper'], BUILDERS={'Cat':Builder(action=cat)}, BITKEEPERCOM='%(_python_)s my-bk-get.py $TARGET', BITKEEPERCOMSTR='Checking out $TARGET from our fake BitKeeper') @@ -90,11 +100,11 @@ test.write(['BitKeeper', 'sub', 'ddd.in'], "BitKeeper/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['BitKeeper', 'sub', 'fff.in'], "BitKeeper/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ Checking out %(sub_SConscript)s from our fake BitKeeper -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ Checking out aaa.in from our fake BitKeeper cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -107,7 +117,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake BitKeeper cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_bk + warn_sc) test.must_match('all', "BitKeeper/aaa.in\nchecked-out bbb.in\nBitKeeper/ccc.in\n") @@ -116,8 +132,6 @@ test.must_match(['sub', 'all'], "BitKeeper/sub/ddd.in\nchecked-out sub/eee.in\nBitKeeper/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py b/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py index 24b9ccc..28b8761 100644 --- a/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py +++ b/test/Deprecated/SourceCode/BitKeeper/BitKeeper.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -33,10 +32,23 @@ import os import TestSCons test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['BitKeeper']).BitKeeper() +""") + +msg_bk = """The BitKeeper() factory is deprecated and there is no replacement.""" +warn_bk = test.deprecated_fatal('deprecated-build-dir', msg_bk) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) + +test.skip_test("Need BitKeeper to debug these tests.\n") bk = test.where_is('bk') if not bk: - test.skip_test("Could not find 'bk'; skipping test(s).\n") + test.skip_test("Could not find 'bk'; skipping remaining tests.\n") try: login = os.getlogin() @@ -69,13 +81,13 @@ else: test.unlink(['work1', file]) test.unlink(['work1', ','+file]) - test.write(['work1', 'sub', 'SConscript'], """\ -Import("env") -env.Cat('ddd.out', 'ddd.in') -env.Cat('eee.out', 'eee.in') -env.Cat('fff.out', 'fff.in') -env.Cat('all', ['ddd.out', 'eee.out', 'fff.out']) -""") + test.write(['work1', 'sub', 'SConscript'], """if True: + Import("env") + env.Cat('ddd.out', 'ddd.in') + env.Cat('eee.out', 'eee.in') + env.Cat('fff.out', 'fff.in') + env.Cat('all', ['ddd.out', 'eee.out', 'fff.out']) + """) args = "create SConscript" test.run(chdir = 'work1/sub', program = sccs, arguments = args, stderr = None) test.unlink(['work1', 'sub', 'SConscript']) @@ -88,33 +100,33 @@ env.Cat('all', ['ddd.out', 'eee.out', 'fff.out']) test.unlink(['work1', 'sub', file]) test.unlink(['work1', 'sub', ','+file]) - test.write(['work1', 'SConstruct'], """ -def cat(env, source, target): - target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) - f.close() -env = Environment(BUILDERS={'Cat':Builder(action=cat)}, - BITKEEPERGETFLAGS='-e') -env.Cat('aaa.out', 'aaa.in') -env.Cat('bbb.out', 'bbb.in') -env.Cat('ccc.out', 'ccc.in') -env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) -env.SourceCode('.', env.BitKeeper()) -SConscript('sub/SConscript', "env") -""") + test.write(['work1', 'SConstruct'], """if True: + SetOption('warn', 'deprecated-source-code') + def cat(env, source, target): + target = str(target[0]) + f = open(target, "wb") + for src in source: + f.write(open(str(src), "rb").read()) + f.close() + env = Environment(BUILDERS={'Cat':Builder(action=cat)}, + BITKEEPERGETFLAGS='-e') + env.Cat('aaa.out', 'aaa.in') + env.Cat('bbb.out', 'bbb.in') + env.Cat('ccc.out', 'ccc.in') + env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) + env.SourceCode('.', env.BitKeeper()) + SConscript('sub/SConscript', "env") + """) test.write(['work1', 'bbb.in'], "checked-out work1/bbb.in\n") test.write(['work1', 'sub', 'eee.in'], "checked-out work1/sub/eee.in\n") - test.run(chdir = 'work1', - arguments = '.', - stdout = test.wrap_stdout(read_str = """\ + read_str = """\ bk get -e sub/SConscript -""", - build_str = """\ +""" + + build_str = """\ bk get -e aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -127,14 +139,21 @@ cat(["sub/eee.out"], ["sub/eee.in"]) bk get -e sub/fff.in cat(["sub/fff.out"], ["sub/fff.in"]) cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) -"""), - stderr = """\ +""" + + stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + + stderr = """\ sub/SConscript 1.1 -> 1.2: 5 lines aaa.in 1.1 -> 1.2: 1 lines ccc.in 1.1 -> 1.2: 1 lines sub/ddd.in 1.1 -> 1.2: 1 lines sub/fff.in 1.1 -> 1.2: 1 lines -""") +""" + + test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_bk + warn_sc + TestSCons.re_escape(stderr)) test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") @@ -187,34 +206,34 @@ env.Cat('all', ['ddd.out', 'eee.out', 'fff.out']) test.no_result(os.path.exists(test.workpath('work2', 'sub', 'eee.in'))) test.no_result(os.path.exists(test.workpath('work2', 'sub', 'fff.in'))) - test.write(['work2', 'SConstruct'], """\ -def cat(env, source, target): - target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) - f.close() -env = Environment(BUILDERS={'Cat':Builder(action=cat)}, - BITKEEPERGET='$BITKEEPER co', - BITKEEPERGETFLAGS='-q') -env.Cat('aaa.out', 'aaa.in') -env.Cat('bbb.out', 'bbb.in') -env.Cat('ccc.out', 'ccc.in') -env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) -env.SourceCode('.', env.BitKeeper()) -SConscript('sub/SConscript', "env") -""") + test.write(['work2', 'SConstruct'], """if True: + SetOption('warn', 'deprecated-source-code') + def cat(env, source, target): + target = str(target[0]) + f = open(target, "wb") + for src in source: + f.write(open(str(src), "rb").read()) + f.close() + env = Environment(BUILDERS={'Cat':Builder(action=cat)}, + BITKEEPERGET='$BITKEEPER co', + BITKEEPERGETFLAGS='-q') + env.Cat('aaa.out', 'aaa.in') + env.Cat('bbb.out', 'bbb.in') + env.Cat('ccc.out', 'ccc.in') + env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) + env.SourceCode('.', env.BitKeeper()) + SConscript('sub/SConscript', "env") + """) test.write(['work2', 'bbb.in'], "checked-out work2/bbb.in\n") test.write(['work2', 'sub', 'eee.in'], "checked-out work2/sub/eee.in\n") - test.run(chdir = 'work2', - arguments = '.', - stdout = test.wrap_stdout(read_str = """\ + read_str = """\ bk co -q sub/SConscript -""", - build_str = """\ +""" + + build_str = """\ bk co -q aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -227,7 +246,13 @@ cat(["sub/eee.out"], ["sub/eee.in"]) bk co -q sub/fff.in cat(["sub/fff.out"], ["sub/fff.in"]) cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) -""")) +""" + + stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + + test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_bk + warn_sc) test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") @@ -283,6 +308,7 @@ test.run(chdir = 'import', arguments = 'import -q -f -tplain . %s' % test.workpath('work3')) test.write(['work3', 'SConstruct'], """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -303,12 +329,11 @@ test.write(['work3', 'bbb.in'], "work3/bbb.in\n") test.subdir(['work3', 'sub']) test.write(['work3', 'sub', 'eee.in'], "work3/sub/eee.in\n") -test.run(chdir = 'work3', - arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %s get sub/SConscript -""" % bk, - build_str = """\ +""" % bk + +build_str = """\ %s get aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -321,14 +346,22 @@ cat(["sub/eee.out"], ["sub/eee.in"]) %s get sub/fff.in cat(["sub/fff.out"], ["sub/fff.in"]) cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) -""" % (bk, bk, bk, bk)), - stderr = """\ +""" % (bk, bk, bk, bk) + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +stderr = """\ sub/SConscript 1.1: 5 lines aaa.in 1.1: 1 lines ccc.in 1.1: 1 lines sub/ddd.in 1.1: 1 lines sub/fff.in 1.1: 1 lines -""") +""" + +test.run(chdir = 'work3', + arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = TestSCons.re_escape(stderr)) test.must_match(['work3', 'all'], "import/aaa.in\nwork3/bbb.in\nimport/ccc.in\n") diff --git a/test/Deprecated/SourceCode/CVS/CVS.py b/test/Deprecated/SourceCode/CVS/CVS.py index eb2553d..b5b51bc 100644 --- a/test/Deprecated/SourceCode/CVS/CVS.py +++ b/test/Deprecated/SourceCode/CVS/CVS.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,11 +31,21 @@ import os import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['CVS']).CVS('') +""") + +msg_cvs = """The CVS() factory is deprecated and there is no replacement.""" +warn_cvs = test.deprecated_fatal('deprecated-build-dir', msg_cvs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) cvs = test.where_is('cvs') if not cvs: - test.skip_test("Could not find 'cvs'; skipping test(s).\n") + test.skip_test("Could not find 'cvs'; skipping remaining tests.\n") test.subdir('CVS', 'import', ['import', 'sub'], 'work1', 'work2') @@ -88,6 +97,7 @@ test.run(chdir = 'import', # Test the most straightforward CVS checkouts, using the module name. test.write(['work1', 'SConstruct'], """ +SetOption('warn', 'deprecated-source-code') import os def cat(env, source, target): target = str(target[0]) @@ -113,12 +123,11 @@ test.write(['work1', 'foo', 'bbb.in'], "work1/foo/bbb.in\n") test.subdir(['work1', 'foo', 'sub',]) test.write(['work1', 'foo', 'sub', 'eee.in'], "work1/foo/sub/eee.in\n") -test.run(chdir = 'work1', - arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ cvs -Q -d %(cvsroot)s co foo/sub/SConscript -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ cvs -Q -d %(cvsroot)s co foo/aaa.in cat(["aaa.out"], ["%(foo_aaa_in)s"]) cat(["bbb.out"], ["%(foo_bbb_in)s"]) @@ -131,7 +140,14 @@ cat(["%(foo_sub_eee_out)s"], ["%(foo_sub_eee_in)s"]) cvs -Q -d %(cvsroot)s co foo/sub/fff.in cat(["%(foo_sub_fff_out)s"], ["%(foo_sub_fff_in)s"]) cat(["%(foo_sub_all)s"], ["%(foo_sub_ddd_out)s", "%(foo_sub_eee_out)s", "%(foo_sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(chdir = 'work1', + arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_cvs + warn_sc) # Checking things back out of CVS apparently messes with the line # endings, so read the result files in non-binary mode. @@ -152,6 +168,7 @@ test.must_be_writable(test.workpath('work1', 'foo', 'sub', 'fff.in')) # Test CVS checkouts when the module name is specified. test.write(['work2', 'SConstruct'], """ +SetOption('warn', 'deprecated-source-code') import os def cat(env, source, target): target = str(target[0]) @@ -176,13 +193,12 @@ test.write(['work2', 'bbb.in'], "work2/bbb.in\n") test.subdir(['work2', 'sub']) test.write(['work2', 'sub', 'eee.in'], "work2/sub/eee.in\n") -test.run(chdir = 'work2', - arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ cvs -q -d %(cvsroot)s co -d sub foo/sub/SConscript U sub/SConscript -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ cvs -q -d %(cvsroot)s co -d . foo/aaa.in U ./aaa.in cat(["aaa.out"], ["aaa.in"]) @@ -199,7 +215,14 @@ cvs -q -d %(cvsroot)s co -d sub foo/sub/fff.in U sub/fff.in cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(chdir = 'work2', + arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_cvs + warn_sc) # Checking things back out of CVS apparently messes with the line # endings, so read the result files in non-binary mode. @@ -223,6 +246,7 @@ test.must_be_writable(test.workpath('work2', 'sub', 'fff.in')) test.subdir(['work3']) test.write(['work3', 'SConstruct'], """\ +SetOption('warn', 'deprecated-source-code') import os def cat(env, source, target): target = str(target[0]) @@ -240,15 +264,12 @@ env.Cat('bbb.out', 'bbb.in') env.Cat('ccc.out', 'ccc.in') env.Cat('all', ['aaa.out', 'bbb.out', 'ccc.out']) cvs = env.CVS('$CVSROOT', 'foo') -#env.SourceCode('.', cvs) env.SourceCode('aaa.in', cvs) env.SourceCode('bbb.in', cvs) env.SourceCode('ccc.in', cvs) """ % cvsroot) -test.run(chdir = 'work3', - arguments = '.', - stdout = test.wrap_stdout(build_str = """\ +build_str = """\ cvs -q -d %(cvsroot)s co -d . foo/aaa.in U ./aaa.in cat(["aaa.out"], ["aaa.in"]) @@ -259,7 +280,14 @@ cvs -q -d %(cvsroot)s co -d . foo/ccc.in U ./ccc.in cat(["ccc.out"], ["ccc.in"]) cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(build_str = build_str) + +test.run(chdir = 'work3', + arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_cvs + 3*warn_sc) test.must_match(['work3', 'aaa.out'], "import/aaa.in\n", @@ -278,6 +306,7 @@ test.must_match(['work3', 'all'], #test.subdir(['work4']) # #test.write(['work4', 'SConstruct'], """\ +#SetOption('warn', 'deprecated-source-code') #import os #env = Environment(ENV = { 'PATH' : os.environ['PATH'] }) ## We used to use the SourceForge server, but SourceForge has restrictions diff --git a/test/Deprecated/SourceCode/CVS/CVSCOM.py b/test/Deprecated/SourceCode/CVS/CVSCOM.py index 546e777..b9d9c76 100644 --- a/test/Deprecated/SourceCode/CVS/CVSCOM.py +++ b/test/Deprecated/SourceCode/CVS/CVSCOM.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['CVS']).CVS('') +""") + +msg_cvs = """The CVS() factory is deprecated and there is no replacement.""" +warn_cvs = test.deprecated_fatal('deprecated-build-dir', msg_cvs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('CVS', ['CVS', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -89,11 +99,11 @@ test.write(['CVS', 'sub', 'ddd.in'], "CVS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['CVS', 'sub', 'fff.in'], "CVS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %(_python_)s my-cvs-co-.py %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ %(_python_)s my-cvs-co-.py aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -106,7 +116,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-cvs-co-.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_cvs + warn_sc) test.must_match('all', "CVS/aaa.in\nchecked-out bbb.in\nCVS/ccc.in\n") @@ -115,8 +131,6 @@ test.must_match(['sub', 'all'], "CVS/sub/ddd.in\nchecked-out sub/eee.in\nCVS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/CVS/CVSCOMSTR.py b/test/Deprecated/SourceCode/CVS/CVSCOMSTR.py index d45bca6..9a6cf64 100644 --- a/test/Deprecated/SourceCode/CVS/CVSCOMSTR.py +++ b/test/Deprecated/SourceCode/CVS/CVSCOMSTR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['CVS']).CVS('') +""") + +msg_cvs = """The CVS() factory is deprecated and there is no replacement.""" +warn_cvs = test.deprecated_fatal('deprecated-build-dir', msg_cvs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('CVS', ['CVS', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -90,11 +100,11 @@ test.write(['CVS', 'sub', 'ddd.in'], "CVS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['CVS', 'sub', 'fff.in'], "CVS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ Checking out %(sub_SConscript)s from our fake CVS -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ Checking out aaa.in from our fake CVS cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -107,7 +117,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake CVS cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_cvs + warn_sc) test.must_match('all', "CVS/aaa.in\nchecked-out bbb.in\nCVS/ccc.in\n") @@ -116,8 +132,6 @@ test.must_match(['sub', 'all'], "CVS/sub/ddd.in\nchecked-out sub/eee.in\nCVS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/Perforce/P4COM.py b/test/Deprecated/SourceCode/Perforce/P4COM.py index 5fd5fd2..92ae547 100644 --- a/test/Deprecated/SourceCode/Perforce/P4COM.py +++ b/test/Deprecated/SourceCode/Perforce/P4COM.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['Perforce']).Perforce() +""") + +msg_p4 = """The Perforce() factory is deprecated and there is no replacement.""" +warn_p4 = test.deprecated_fatal('deprecated-build-dir', msg_p4) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('Perforce', ['Perforce', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -89,11 +99,11 @@ test.write(['Perforce', 'sub', 'ddd.in'], "Perforce/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['Perforce', 'sub', 'fff.in'], "Perforce/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %(_python_)s my-p4.py %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ %(_python_)s my-p4.py aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -106,7 +116,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-p4.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_p4 + warn_sc) test.must_match('all', "Perforce/aaa.in\nchecked-out bbb.in\nPerforce/ccc.in\n") @@ -115,8 +131,6 @@ test.must_match(['sub', 'all'], "Perforce/sub/ddd.in\nchecked-out sub/eee.in\nPerforce/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/Perforce/P4COMSTR.py b/test/Deprecated/SourceCode/Perforce/P4COMSTR.py index accf6d5..d022824 100644 --- a/test/Deprecated/SourceCode/Perforce/P4COMSTR.py +++ b/test/Deprecated/SourceCode/Perforce/P4COMSTR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -35,6 +34,17 @@ import TestSCons _python_ = TestSCons._python_ test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['Perforce']).Perforce() +""") + +msg_p4 = """The Perforce() factory is deprecated and there is no replacement.""" +warn_p4 = test.deprecated_fatal('deprecated-build-dir', msg_p4) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('Perforce', ['Perforce', 'sub'], 'sub') @@ -56,6 +66,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -90,11 +101,11 @@ test.write(['Perforce', 'sub', 'ddd.in'], "Perforce/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['Perforce', 'sub', 'fff.in'], "Perforce/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ Checking out %(sub_SConscript)s from our fake Perforce -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ Checking out aaa.in from our fake Perforce cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -107,7 +118,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake Perforce cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_p4 + warn_sc) test.must_match('all', "Perforce/aaa.in\nchecked-out bbb.in\nPerforce/ccc.in\n") @@ -116,8 +133,6 @@ test.must_match(['sub', 'all'], "Perforce/sub/ddd.in\nchecked-out sub/eee.in\nPerforce/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/Perforce/Perforce.py b/test/Deprecated/SourceCode/Perforce/Perforce.py index 32154db..3be5a77 100644 --- a/test/Deprecated/SourceCode/Perforce/Perforce.py +++ b/test/Deprecated/SourceCode/Perforce/Perforce.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -35,6 +34,20 @@ import os import TestSCons +test = TestSCons.TestSCons() + +test.write('SConscript', """ +Environment(tools = ['Perforce']).Perforce() +""") + +msg_p4 = """The Perforce() factory is deprecated and there is no replacement.""" +warn_p4 = test.deprecated_fatal('deprecated-build-dir', msg_p4) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) + +test.skip_test("Need Perforce to debug these tests.\n") + class TestPerforce(TestSCons.TestSCons): def __init__(self, *args, **kw): TestSCons.TestSCons.__init__(self, *args, **kw) @@ -237,6 +250,7 @@ test.p4('-c testclient1 opened') test.p4('-c testclient1 submit -i', stdin=changespec) SConstruct_contents = test.substitute(""" +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -263,7 +277,7 @@ test.write(['work', 'foo', 'bbb.in'], "work/foo/bbb.in\n") test.subdir(['work', 'foo', 'sub']) test.write(['work', 'foo', 'sub', 'eee.in'], "work/foo/sub/eee.in\n") -test.run(chdir = 'work', arguments = '.') +test.run(chdir = 'work', arguments = '.', stderr = warn_p4 + warn_sc) test.fail_test(test.read(['work', 'all']) != "import/aaa.in\nwork/foo/bbb.in\nimport/ccc.in\n") test.fail_test(test.read(['work', 'foo', 'sub', 'all']) != "import/sub/ddd.in\nwork/foo/sub/eee.in\nimport/sub/fff.in\n") diff --git a/test/Deprecated/SourceCode/RCS/RCS_COCOM.py b/test/Deprecated/SourceCode/RCS/RCS_COCOM.py index a1c18e5..20f0da6 100644 --- a/test/Deprecated/SourceCode/RCS/RCS_COCOM.py +++ b/test/Deprecated/SourceCode/RCS/RCS_COCOM.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -28,13 +27,23 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test setting the $RCS_COCOM variable. """ -import os.path +import os import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +warn_rcs = test.deprecated_fatal('deprecated-build-dir', msg_rcs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('RCS', ['RCS', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -89,11 +99,11 @@ test.write(['RCS', 'sub', 'ddd.in'], "RCS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['RCS', 'sub', 'fff.in'], "RCS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %(_python_)s my-rcs-co.py %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ %(_python_)s my-rcs-co.py aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -106,7 +116,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-rcs-co.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_rcs + warn_sc) test.must_match('all', "RCS/aaa.in\nchecked-out bbb.in\nRCS/ccc.in\n") @@ -115,8 +131,6 @@ test.must_match(['sub', 'all'], "RCS/sub/ddd.in\nchecked-out sub/eee.in\nRCS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py b/test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py index ee3ba15..3626376 100644 --- a/test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py +++ b/test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +warn_rcs = test.deprecated_fatal('deprecated-build-dir', msg_rcs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('RCS', ['RCS', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -90,11 +100,11 @@ test.write(['RCS', 'sub', 'ddd.in'], "RCS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['RCS', 'sub', 'fff.in'], "RCS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ Checking out %(sub_SConscript)s from our fake RCS -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ Checking out aaa.in from our fake RCS cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -107,7 +117,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake RCS cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_rcs + warn_sc) test.must_match('all', "RCS/aaa.in\nchecked-out bbb.in\nRCS/ccc.in\n") @@ -116,8 +132,6 @@ test.must_match(['sub', 'all'], "RCS/sub/ddd.in\nchecked-out sub/eee.in\nRCS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/changed.py b/test/Deprecated/SourceCode/RCS/changed.py index d451be0..14c80bd 100644 --- a/test/Deprecated/SourceCode/RCS/changed.py +++ b/test/Deprecated/SourceCode/RCS/changed.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -30,7 +29,17 @@ Test explicit checkouts from local RCS files. import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +warn_rcs = test.deprecated_fatal('deprecated-build-dir', msg_rcs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) rcs = test.where_is('rcs') if not rcs: @@ -45,7 +54,6 @@ if not co: test.skip_test("Could not find `co' command, skipping test(s).\n") - main_cpp_contents = """\ #include #include @@ -62,8 +70,8 @@ test.write('main.c', main_cpp_contents % 1) test.run(program = ci, arguments = '-f -tmain.c main.c', stderr = None) - test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') import os for key in ['LOGNAME', 'USERNAME', 'USER']: logname = os.environ.get(key) @@ -76,22 +84,20 @@ env2 = env.Clone() env2.Program('main.exe', 'main.c') """) -test.run() +test.run(stderr = warn_rcs + warn_sc) test.run(program = test.workpath('main.exe'), stdout = "main.c 1\n") - - test.run(program = co, arguments = '-l main.c', stderr = None) + test.write('main.c', main_cpp_contents % 2) -test.not_up_to_date(arguments = 'main.exe') +test.not_up_to_date(arguments = 'main.exe', stderr = warn_rcs + warn_sc) test.run(program = test.workpath('main.exe'), stdout = "main.c 2\n") - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/diskcheck.py b/test/Deprecated/SourceCode/RCS/diskcheck.py index 4e7dd24..7183975 100644 --- a/test/Deprecated/SourceCode/RCS/diskcheck.py +++ b/test/Deprecated/SourceCode/RCS/diskcheck.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,6 +33,13 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_rcs) + rcs = test.where_is('rcs') if not rcs: test.skip_test("Could not find 'rcs'; skipping test(s).\n") @@ -43,7 +49,6 @@ if not ci: test.skip_test("Could not find 'ci'; skipping test(s).\n") - sub_RCS = os.path.join('sub', 'RCS') sub_SConscript = os.path.join('sub', 'SConscript') sub_all = os.path.join('sub', 'all') @@ -87,6 +92,7 @@ test.no_result(os.path.exists(test.workpath('sub', 'bbb.in'))) test.no_result(os.path.exists(test.workpath('sub', 'ccc.in'))) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') import os for key in ['LOGNAME', 'USERNAME', 'USER']: logname = os.environ.get(key) @@ -115,7 +121,7 @@ test.write('bbb.in', "checked-out bbb.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") sub_SConscript = os.path.join('sub', 'SConscript') -SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 22)[:-1] +SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 23)[:-1] expect = """\ @@ -128,11 +134,11 @@ test.run(status=2, stderr=expect) test.run(arguments = '--diskcheck=match,sccs', status=2, stderr=expect) -test.run(arguments = '--diskcheck=rcs', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ co -l %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ co -l aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -145,8 +151,11 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) co -l %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals()), - stderr = """\ +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +stderr = """\ %(sub_RCS)s/SConscript,v --> %(sub_SConscript)s revision 1.1 (locked) done @@ -162,7 +171,9 @@ done %(sub_RCS)s/fff.in,v --> %(sub_fff_in)s revision 1.1 (locked) done -""" % locals()) +""" % locals() + +test.run(arguments = '--diskcheck=rcs', stdout = stdout, stderr = stderr) # Checking things back out of RCS apparently messes with the line # endings, so read the result files in non-binary mode. @@ -182,8 +193,6 @@ test.must_be_writable(test.workpath('sub', 'ddd.in')) test.must_be_writable(test.workpath('sub', 'fff.in')) - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/explicit.py b/test/Deprecated/SourceCode/RCS/explicit.py index 75eb189..53c336a 100644 --- a/test/Deprecated/SourceCode/RCS/explicit.py +++ b/test/Deprecated/SourceCode/RCS/explicit.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,7 +31,17 @@ import os import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +warn_rcs = test.deprecated_fatal('deprecated-build-dir', msg_rcs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) rcs = test.where_is('rcs') if not rcs: @@ -43,7 +52,6 @@ if not ci: test.skip_test("Could not find `ci' command, skipping test(s).\n") - test.subdir('sub') sub_RCS = os.path.join('sub', 'RCS') @@ -87,6 +95,7 @@ test.no_result(os.path.exists(test.workpath('sub', 'eee.in'))) test.no_result(os.path.exists(test.workpath('sub', 'fff.in'))) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') import os for key in ['LOGNAME', 'USERNAME', 'USER']: logname = os.environ.get(key) @@ -115,11 +124,11 @@ test.write('bbb.in', "checked-out bbb.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ co -q %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ co -q aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -132,7 +141,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) co -q %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_rcs + warn_sc) # Checking things back out of RCS apparently messes with the line # endings, so read the result files in non-binary mode. @@ -152,8 +167,6 @@ test.must_not_be_writable(test.workpath('sub', 'ddd.in')) test.must_not_be_writable(test.workpath('sub', 'fff.in')) - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/implicit.py b/test/Deprecated/SourceCode/RCS/implicit.py index 6677c55..ed1f1a2 100644 --- a/test/Deprecated/SourceCode/RCS/implicit.py +++ b/test/Deprecated/SourceCode/RCS/implicit.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,6 +31,13 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_rcs) + rcs = test.where_is('rcs') if not rcs: test.skip_test("Could not find 'rcs'; skipping test(s).\n") @@ -45,7 +51,6 @@ if not co: test.skip_test("Could not find 'co'; skipping test(s).\n") - test.subdir('RCS') test.write('foo.c', """\ @@ -70,6 +75,7 @@ test.run(program = ci, stderr = None) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') DefaultEnvironment(RCS_CO = r'%s') env = Environment() env.Program('foo.c') @@ -85,8 +91,6 @@ done """) - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/RCS/transparent.py b/test/Deprecated/SourceCode/RCS/transparent.py index 2ebde9a..67d0512 100644 --- a/test/Deprecated/SourceCode/RCS/transparent.py +++ b/test/Deprecated/SourceCode/RCS/transparent.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,6 +33,13 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['RCS']).RCS() +""") + +msg_rcs = """The RCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_rcs) + rcs = test.where_is('rcs') if not rcs: test.skip_test("Could not find 'rcs'; skipping test(s).\n") @@ -43,7 +49,6 @@ if not ci: test.skip_test("Could not find 'ci'; skipping test(s).\n") - sub_RCS = os.path.join('sub', 'RCS') sub_SConscript = os.path.join('sub', 'SConscript') sub_all = os.path.join('sub', 'all') @@ -87,6 +92,7 @@ test.no_result(os.path.exists(test.workpath('sub', 'bbb.in'))) test.no_result(os.path.exists(test.workpath('sub', 'ccc.in'))) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') import os for key in ['LOGNAME', 'USERNAME', 'USER']: logname = os.environ.get(key) @@ -113,11 +119,11 @@ test.write('bbb.in', "checked-out bbb.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ co -l %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ co -l aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -130,8 +136,11 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) co -l %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals()), - stderr = """\ +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +stderr = """\ %(sub_RCS)s/SConscript,v --> %(sub_SConscript)s revision 1.1 (locked) done @@ -147,7 +156,9 @@ done %(sub_RCS)s/fff.in,v --> %(sub_fff_in)s revision 1.1 (locked) done -""" % locals()) +""" % locals() + +test.run(arguments = '.', stdout = stdout, stderr = stderr) # Checking things back out of RCS apparently messes with the line # endings, so read the result files in non-binary mode. @@ -167,8 +178,6 @@ test.must_be_writable(test.workpath('sub', 'ddd.in')) test.must_be_writable(test.workpath('sub', 'fff.in')) - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/SCCSCOM.py b/test/Deprecated/SourceCode/SCCS/SCCSCOM.py index 9d1b649..a08241f 100644 --- a/test/Deprecated/SourceCode/SCCS/SCCSCOM.py +++ b/test/Deprecated/SourceCode/SCCS/SCCSCOM.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +warn_sccs = test.deprecated_fatal('deprecated-build-dir', msg_sccs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('SCCS', ['SCCS', 'sub'], 'sub') @@ -56,6 +65,7 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -89,11 +99,11 @@ test.write(['SCCS', 'sub', 'ddd.in'], "SCCS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['SCCS', 'sub', 'fff.in'], "SCCS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ %(_python_)s my-sccs-get.py %(sub_SConscript)s -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ %(_python_)s my-sccs-get.py aaa.in cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -106,7 +116,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) %(_python_)s my-sccs-get.py %(sub_fff_in)s cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_sccs + warn_sc) test.must_match('all', "SCCS/aaa.in\nchecked-out bbb.in\nSCCS/ccc.in\n") @@ -115,8 +131,6 @@ test.must_match(['sub', 'all'], "SCCS/sub/ddd.in\nchecked-out sub/eee.in\nSCCS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py b/test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py index d0da2e4..5204ee3 100644 --- a/test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py +++ b/test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -34,7 +33,17 @@ import TestSCons _python_ = TestSCons._python_ -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +warn_sccs = test.deprecated_fatal('deprecated-build-dir', msg_sccs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) test.subdir('SCCS', ['SCCS', 'sub'], 'sub') @@ -56,13 +65,14 @@ for f in sys.argv[1:]: """) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") for src in source: f.write(open(str(src), "rb").read()) f.close() -env = Environment(TOOLS = ['default', 'SCCS'], +env = Environment(tools = ['default', 'SCCS'], BUILDERS={'Cat':Builder(action=cat)}, SCCSCOM='%(_python_)s my-sccs-get.py $TARGET', SCCSCOMSTR='Checking out $TARGET from our fake SCCS') @@ -90,11 +100,11 @@ test.write(['SCCS', 'sub', 'ddd.in'], "SCCS/sub/ddd.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") test.write(['SCCS', 'sub', 'fff.in'], "SCCS/sub/fff.in\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ Checking out %(sub_SConscript)s from our fake SCCS -""" % locals(), - build_str = """\ +""" % locals() + +build_str = """\ Checking out aaa.in from our fake SCCS cat(["aaa.out"], ["aaa.in"]) cat(["bbb.out"], ["bbb.in"]) @@ -107,7 +117,13 @@ cat(["%(sub_eee_out)s"], ["%(sub_eee_in)s"]) Checking out %(sub_fff_in)s from our fake SCCS cat(["%(sub_fff_out)s"], ["%(sub_fff_in)s"]) cat(["%(sub_all)s"], ["%(sub_ddd_out)s", "%(sub_eee_out)s", "%(sub_fff_out)s"]) -""" % locals())) +""" % locals() + +stdout = test.wrap_stdout(read_str = read_str, build_str = build_str) + +test.run(arguments = '.', + stdout = TestSCons.re_escape(stdout), + stderr = warn_sccs + warn_sc) test.must_match('all', "SCCS/aaa.in\nchecked-out bbb.in\nSCCS/ccc.in\n") @@ -116,8 +132,6 @@ test.must_match(['sub', 'all'], "SCCS/sub/ddd.in\nchecked-out sub/eee.in\nSCCS/sub/fff.in\n") - -# test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/diskcheck.py b/test/Deprecated/SourceCode/SCCS/diskcheck.py index a8660bc..774a92c 100644 --- a/test/Deprecated/SourceCode/SCCS/diskcheck.py +++ b/test/Deprecated/SourceCode/SCCS/diskcheck.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -28,18 +27,29 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test transparent checkouts from SCCS files in an SCCS subdirectory. """ -import os.path +import os import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +warn_sccs = test.deprecated_fatal('deprecated-build-dir', msg_sccs) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) + +test.skip_test("Need SCCS to debug these tests.\n") + sccs = test.where_is('sccs') if not sccs: test.skip_test("Could not find 'sccs'; skipping test(s).\n") - test.subdir('SCCS', 'sub', ['sub', 'SCCS']) for f in ['aaa.in', 'bbb.in', 'ccc.in']: @@ -70,6 +80,7 @@ for f in ['ddd.in', 'eee.in', 'fff.in']: test.unlink(['sub', ','+f]) test.write(['SConstruct'], """ +SetOption('warn', 'deprecated-source-code') DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}' def cat(env, source, target): target = str(target[0]) @@ -92,7 +103,7 @@ test.write(['bbb.in'], "checked-out bbb.in\n") test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n") sub_SConscript = os.path.join('sub', 'SConscript') -SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 16)[:-1] +SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 17)[:-1] expect = """\ @@ -136,7 +147,6 @@ test.must_not_be_writable(test.workpath('sub', 'ddd.in')) test.must_not_be_writable(test.workpath('sub', 'fff.in')) - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/explicit.py b/test/Deprecated/SourceCode/SCCS/explicit.py index 252e901..3288425 100644 --- a/test/Deprecated/SourceCode/SCCS/explicit.py +++ b/test/Deprecated/SourceCode/SCCS/explicit.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,12 +31,18 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_sccs) + sccs = test.where_is('sccs') if not sccs: test.skip_test("Could not find 'sccs'; skipping test(s).\n") - test.subdir('SCCS', 'sub', ['sub', 'SCCS']) for f in ['aaa.in', 'bbb.in', 'ccc.in']: @@ -67,6 +72,7 @@ for f in ['ddd.in', 'eee.in', 'fff.in']: test.unlink(['sub', ','+f]) test.write('SConstruct', """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -121,7 +127,6 @@ test.must_be_writable(test.workpath('sub', 'ddd.in')) test.must_be_writable(test.workpath('sub', 'fff.in')) - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/implicit.py b/test/Deprecated/SourceCode/SCCS/implicit.py index 3f86841..b3fbf7a 100644 --- a/test/Deprecated/SourceCode/SCCS/implicit.py +++ b/test/Deprecated/SourceCode/SCCS/implicit.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,12 +31,18 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_sccs) + sccs = test.where_is('sccs') if not sccs: test.skip_test("Could not find 'sccs'; skipping test(s).\n") - test.subdir('SCCS') test.write('foo.c', """\ @@ -76,7 +81,6 @@ sccs get foo.h test.must_contain_all_lines(test.stdout(), lines) - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SCCS/transparent.py b/test/Deprecated/SourceCode/SCCS/transparent.py index a8105a2..bc482d0 100644 --- a/test/Deprecated/SourceCode/SCCS/transparent.py +++ b/test/Deprecated/SourceCode/SCCS/transparent.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,12 +31,18 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['SCCS']).SCCS() +""") + +msg_sccs = """The SCCS() factory is deprecated and there is no replacement.""" +test.deprecated_fatal('deprecated-build-dir', msg_sccs) + sccs = test.where_is('sccs') if not sccs: test.skip_test("Could not find 'sccs'; skipping test(s).\n") - test.subdir('SCCS', 'sub', ['sub', 'SCCS']) for f in ['aaa.in', 'bbb.in', 'ccc.in']: @@ -121,7 +126,6 @@ test.must_not_be_writable(test.workpath('sub', 'ddd.in')) test.must_not_be_writable(test.workpath('sub', 'fff.in')) - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SourceCode/SourceCode.py b/test/Deprecated/SourceCode/SourceCode.py index 91af7da..d440581 100644 --- a/test/Deprecated/SourceCode/SourceCode.py +++ b/test/Deprecated/SourceCode/SourceCode.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -32,11 +31,20 @@ import os import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConscript', """ +SourceCode('.', None) +""") + +msg = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warning = test.deprecated_warning('deprecated-source-code', msg) test.subdir('sub', 'sub2') test.write('SConstruct', """\ +SetOption('warn', 'deprecated-source-code') import os def cat(env, source, target): @@ -74,11 +82,11 @@ test.write(['sub2', 'sc-ddd.in'], "sub2/sc-ddd.in\n") test.write(['sub', 'sc-SConscript'], "'sub/sc-SConscript'\n") -test.run(arguments = '.', - stdout = test.wrap_stdout(read_str = """\ +read_str = """\ sc_cat(["%s"], []) -""" % (os.path.join('sub', 'SConscript')), - build_str = """\ +""" % (os.path.join('sub', 'SConscript')) + +build_str = """\ sc_cat(["%s"], []) cat(["aaa.out"], ["%s"]) sc_cat(["%s"], []) @@ -95,7 +103,12 @@ cat(["ddd.out"], ["%s"]) os.path.join('sub', 'ccc.in'), os.path.join('sub', 'ccc.in'), os.path.join('sub2', 'ddd.in'), - os.path.join('sub2', 'ddd.in')))) + os.path.join('sub2', 'ddd.in')) + +stdout = TestSCons.re_escape(test.wrap_stdout(read_str = read_str, + build_str = build_str)) + +test.run(arguments = '.', stdout = stdout, stderr = 2*warning) test.must_match(['sub', 'SConscript'], "'sub/sc-SConscript'\n") test.must_match('all', "sub/sc-aaa.in\nsub/sc-bbb.in\nsub/sc-ccc.in\n") diff --git a/test/Deprecated/SourceCode/Subversion.py b/test/Deprecated/SourceCode/Subversion.py index 01a12f6..a97c86f 100644 --- a/test/Deprecated/SourceCode/Subversion.py +++ b/test/Deprecated/SourceCode/Subversion.py @@ -32,6 +32,16 @@ import TestSCons test = TestSCons.TestSCons() +test.write('SConscript', """ +Environment(tools = ['Subversion']).Subversion('') +""") + +msg_svn = """The Subversion() factory is deprecated and there is no replacement.""" +warn_svn = test.deprecated_fatal('deprecated-build-dir', msg_svn) +msg_sc = """SourceCode() has been deprecated and there is no replacement. +\tIf you need this function, please contact dev@scons.tigris.org.""" +warn_sc = test.deprecated_wrap(msg_sc) + svn = test.where_is('svn') if not svn: test.skip_test("Could not find 'svn'; skipping test(s).\n") @@ -73,6 +83,7 @@ test.run(chdir = 'import', # Test the most straightforward Subversion checkouts, using the module name. test.write(['work1', 'SConstruct'], """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") @@ -120,6 +131,7 @@ test.fail_test(test.read(['work1', 'foo', 'sub', 'all']) != "import/sub/ddd.in\n # Test Subversion checkouts when the module name is specified. test.write(['work2', 'SConstruct'], """ +SetOption('warn', 'deprecated-source-code') def cat(env, source, target): target = str(target[0]) f = open(target, "wb") diff --git a/test/Deprecated/TaskmasterNeedsExecute.py b/test/Deprecated/TaskmasterNeedsExecute.py index eb3de40..9f7ade1 100644 --- a/test/Deprecated/TaskmasterNeedsExecute.py +++ b/test/Deprecated/TaskmasterNeedsExecute.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) -test.write('SConstruct', """ +test.write('SConscript', """ import SCons.Taskmaster tm = SCons.Taskmaster.Taskmaster() task = SCons.Taskmaster.Task(tm, [], True, None) diff --git a/test/implicit/changed-node.py b/test/implicit/changed-node.py index 6321b82..4f879c0 100644 --- a/test/implicit/changed-node.py +++ b/test/implicit/changed-node.py @@ -34,7 +34,6 @@ import TestSCons test = TestSCons.TestSCons() - test.subdir('d', ['d', '1'], ['d', '2'], @@ -43,7 +42,6 @@ test.subdir('d', test.write('SConstruct', """\ SetOption('implicit_cache', 1) SetOption('max_drift', 1) -SourceCode('.', None) def lister(target, source, env): import os @@ -78,11 +76,9 @@ test.write(['d', '3', 'z'], "d/3/z\n") test.run('--debug=stacktrace') - test.write('SConstruct', """\ SetOption('implicit_cache', 1) SetOption('max_drift', 1) -SourceCode('.', None) def lister(target, source, env): import os.path @@ -108,8 +104,6 @@ test.run('--debug=stacktrace') test.pass_test() - - #from os import system, rmdir, remove, mkdir, listdir #from os.path import exists, isdir #import sys -- cgit v0.12