From 545d2a0a389e9eacdb1d92fbf5f26f2d981029ad Mon Sep 17 00:00:00 2001 From: Greg Noel Date: Wed, 26 May 2010 16:17:09 +0000 Subject: Start the deprecation cycle for the BuildDir() method and the build_dir keyword parameter. Several existing tests were still using BuildDir() or build_dir; they were converted to use VariantDir() and variant_dir. New tests were added to validate that the --warn=deprecated-build-dir option and the SetOption method did the right thing. This led to the discovery that a commonly-used test pattern provided by the infrastructure gobbled up too much, causing tests to succeed when they should have failed. Fixing the pattern led to other tests needing to be fixed. In the process, it was discovered that the SCONSFLAG environment variable was not getting correctly reset to its original value. Fixing this also caused additional tests to misbehave, requiring them to be updated. And test/Sig.py, which tests the deprecated SCons.Sig module, was moved to the test/Deprecated directory. All in all, quite a lot of action for what was supposed to be a simple change. --- Announcement.txt | 187 --------------------- QMTest/TestCmd.py | 9 +- QMTest/TestCommon.py | 53 +++--- QMTest/TestSCons.py | 139 ++++++++------- src/CHANGES.txt | 8 +- src/RELEASE.txt | 15 +- src/engine/SCons/Environment.py | 5 + src/engine/SCons/Script/Main.py | 17 +- src/engine/SCons/Script/SConscript.py | 5 +- src/engine/SCons/Warnings.py | 45 +++-- test/CPPPATH/subdir-as-include.py | 2 +- test/Configure/VariantDir2.py | 2 +- test/Deprecated/BuildDir.py | 56 ++++-- test/Deprecated/Options/BoolOption.py | 3 +- test/Deprecated/SConscript-build_dir.py | 24 ++- test/Deprecated/Sig.py | 68 ++++++++ test/Deprecated/SourceSignatures/basic.py | 2 +- test/Deprecated/SourceSignatures/env.py | 2 +- test/Deprecated/SourceSignatures/implicit-cache.py | 2 +- test/Deprecated/SourceSignatures/no-csigs.py | 2 +- test/Deprecated/SourceSignatures/overrides.py | 2 +- test/Deprecated/SourceSignatures/switch-rebuild.py | 2 +- test/Deprecated/TargetSignatures/build-content.py | 2 +- test/Deprecated/TargetSignatures/content.py | 2 +- test/Deprecated/TargetSignatures/overrides.py | 2 +- test/Mkdir.py | 2 +- test/Sig.py | 68 -------- test/Value.py | 10 +- test/option/warn-dependency.py | 11 +- test/option/warn-duplicate-environment.py | 16 +- test/option/warn-misleading-keywords.py | 15 +- test/option/warn-missing-sconscript.py | 15 +- 32 files changed, 332 insertions(+), 461 deletions(-) delete mode 100644 Announcement.txt create mode 100644 test/Deprecated/Sig.py delete mode 100644 test/Sig.py diff --git a/Announcement.txt b/Announcement.txt deleted file mode 100644 index 521dd71..0000000 --- a/Announcement.txt +++ /dev/null @@ -1,187 +0,0 @@ -__COPYRIGHT__ -__FILE__ __REVISION__ __DATE__ __DEVELOPER__ -SCons checkpoint release 1.2.0.d20090223 is now available at the SCons -download page: - - http://www.scons.org/download.php - -This checkpoint provides early access to new features and fixes -scheduled for release in SCons 1.3.0. - - -IMPORTANT: - -- This checkpoint release notably contains completely new code for - detecting installed versions of Microsoft Visual C/C++. The new code - has been tested extensively, but it is possible that it will fail to - find installed versions on configurations that we don't have available - for testing. Please report *any* problems with support for Microsoft - Visual C/C++ as soon as possible so that we can diagnose and fix - them before releasing SCons 1.3.0. - -- Python versions prior to 2.4 are supported by SCons 1.2.0, but are - officially deprecated and will generate a disableable warning message. - We plan to remove support for these older versions in SCons 2.0. - If removing this support would cause a problem for you, please contact - the dev@scons.tigris.org mailing list. - -- The following deprecated features will still be supported in 1.3.0 - but will generate mandatory, non-disableable warnings: - - -- Support for Python versions 1.5, 1.6, 2.0, 2.1, 2.2, and 2.3. - -- The overrides= keyword argument to the Builder() call. - -- The scanner= keyword argument to the Builder() call. - -- The BuildDir() function and env.BuildDir() method. - -- The env.Copy() method. - -- The SourceSignatures() function and - env.SourceSignatures() method. - -- The TargetSignatures() function and - env.TargetSignatures() method. - -- The Sig module (now an unnused stub). - -- The --debug=dtree, --debug=stree and --debug=tree options. - -- The --debug=nomemoizer option. - -- The Options object and the related BoolOption(), EnumOption(), - ListOption(), PackageOption() and PathOption() functions. - - -WHAT'S NEW IN THIS RELEASE - -For a complete description of important changes since other recent -releases, see: - - http://www.scons.org/RELEASE.txt - -For a complete list of changes in all releases, see the official -change log: - - http://www.scons.org/CHANGES.txt - -We do not recommend that downstream distributions (Debian, Fedora, -etc.) package a checkpoint release, mainly to avoid confusing the -"public" release numbering with the long checkpoint release names. - - -Here is a summary of all changes since the 1.1.0 release: - - -NEW FUNCTIONALITY - -- SCons now supports batch compilation of Visual Studio C/C++ source - files when the new $MSVC_BATCH construction variable is set. -- New reserved $CHANGED_SOURCES, $CHANGED_TARGETS, $UNCHANGED_SOURCES - and $UNCHANGED_TARGETS variables provide finer-grained control - over what source or targets to pass to a command line. -- A new batch_key= keyword argument to Action object creation supports - general batched builds. -- A new --warn=future-deprecated option provides advance warnings about - future deprecated features that still have warnings hidden by default. -- Visual Studio 8 project files can now be generated for 64-bit platforms. -- Visual Studio & Visual C++ now support TARGET_OS, TARGET_ARCH for - cross-compiling to x86, x86_64, ia64 - -CHANGED/ENHANCED EXISTING FUNCTIONALITY - -- $CCFLAGS is no longer included in the default definitions of $CXXFLAGS - for Visual C/C++ and MIPSpro C++ on SGI (to match other tools and - avoid flag duplication on C++ command lines). -- The $CCFLAGS variable is now passed to Visual C/C++ precompiled header - compilation. -- Scanning files encoded in utf-8 and utf-16 for implicit dependencies - is now supported. -- Linker tools modules now differentiate properly between the SharedLibrary - and LoadableModule Builders. -- Don't automatically try to build .pdf graphics files for .eps files in - \includegraphics{} calls in TeX/LaTeX files when building with the PDF - builder (and thus using pdflatex). -- Setting WINDOWS_INSERT_DEF=0 now disables --output-def when linking - under MinGW. -- AppendENVPath() and PrependENVPath() now interpret '#' in paths - relative to the top-level SConstruct directory. -- The message, "scons: Build interrupted." is no printed on error output, - not standard output. -- Quoted module names in SWIG source files are no handled correctly. -- Suffix-matching for scanners is now case-insensitive on Windows. -- Generated Visual Studio 8 project files now work better with - IntelliSense, by defining IncludeSearchPath and PreprocessorDefinitions. -- Unnecessary nested $( $) strings around $_LIBDIRFLAGS have been removed - from the default command lines for the Microsoft linker, the OS/2 - ilink linker and the Phar Lap linkloc linker. -- SCons now internally spells the Windows environment variables - "SystemDrive" and "SystemRoot" (instead of "SYSTEMDRIVE" and - "SYSTEMROOT.") -- Major revamp of Visual Studio/Visual C++ logic for locating and - configuring available version on the machine. - -FIXES - -- The $CHANGED_SOURCES variable now correctly includes files whose - corresponding targets don't exist. -- The $CHANGED_SOURCES variable now works correctly with the - --config=force option. -- $SOURCE and $SOURCES attributes now work even when there are no - sources specified in the Builder call. -- $SWIGOUTDIR values with spaces now work properly. -- Fix use of $SWIGOUTDIR when generating Python wrappers. -- Add $SWIGDIRECTORSUFFIX and $SWIGVERSION construction variables. -- The Borland ilink linker now uses the -e option to specify the output - file name. -- SCons now correctly identifies shared libraries and shared object files - in a Repository. -- Implicit command dependencies are detected even when the first argument - is quoted on the command line. -- #include file names that contain escaped backslashes (\\) are now - handled correctly. -- Have AddOption() remove variables from the list of - seen-but-unknown variables (which are reported later). -- An option name and aliases can now be specified as a tuple. -- Textfile builder. -- Fix the -n option when used with VariantDir(duplicate=1) - and the variant directory doesn't already exist. -- Fix scanning of Unicode files for both UTF-16 endian flavors. -- Fix a TypeError on #include of file names with Unicode characters. -- Fix an exception if a null command-line argument is passed in. -- Evaluate Requires() prerequisites before a Node's direct children - (sources and dependencies). -- Remove redundant __metaclass__ initializations in Environment.py. -- Fix SWIG testing infrastructure to work on Mac OS X. -- Substfile builder. -- When reporting a target that SCons doesn't know how to make, - specify whether it's a File, Dir, etc. -- Add -recorder flag to Latex commands and updated internals to - use the output to find files TeX creates. This allows the MiKTeX - installations to find the created files -- Notify user of Latex errors that would get buried in the - Latex output -- Remove LATEXSUFFIXES from environments that don't initialize Tex. -- Add support for the glosaaries package for glossaries and acronyms -- Fix problem that pdftex, latex, and pdflatex tools by themselves did - not create the actions for bibtex, makeindex,... by creating them - and other environment settings in one routine called by all four - tex tools. -- Fix problem with filenames of sideeffects when the user changes - the name of the output file from the latex default - - - - -DOCUMENTATION - -- The TestCommon.shobj_prefix variable is now documented. -- Document that the msvc Tool module uses $PCH, $PCHSTOP and $PDB. -- The User's Guide has had numerous typos fixed and other corrections. -- Document that filenames with '.' as the first character are - ignored by Glob() by default (matching UNIX glob semantics). -- Correct the documentation of text returned by sconf.Result(). - - -Thanks to Stanislav Baranov, David Cornapeau, Robert P.J. Day, -Lukas Erlinghagen, Allan Erskine, Hartmut Goebel, Jared Grubb, -Mateusz Gruca, Jim Hunziker, Ted Johnson, Jason Kenney, Steven Knight, -Arve Knudsen, Rob Managan, Greg Noel, Gary Oberbrunner, Zia Sobhani, -Greg Spencer, Roberto de Vecchi, Ben Webb and Matthew Wesley, -Steven Knight for their contributions to this release. - - -On behalf of the SCons team, - - --WPD diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 07cf71b..ef41916 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -426,12 +426,13 @@ def match_re_dotall(lines = None, res = None): res = "\n".join(res) s = "^" + res + "$" try: + #print 'DEBUG: lines', lines + #print 'DEBUG: dotall', s expr = re.compile(s, re.DOTALL) except re.error, e: msg = "Regular expression error in %s: %s" raise re.error(msg % (repr(s), e[0])) - if expr.match(lines): - return 1 + return expr.match(lines) try: import difflib @@ -1122,8 +1123,10 @@ class TestCmd(object): prepended unless it is enclosed in a [list]. """ cmd = self.command_args(program, interpreter, arguments) - cmd_string = ' '.join(map(self.escape, cmd)) + #print 'DEBUG: SCONSFLAGS:', os.environ.get('SCONSFLAGS') + #print 'DEBUG: command line:', ' '.join(map(self.escape, cmd)) if self.verbose: + cmd_string = ' '.join(map(self.escape, cmd)) sys.stderr.write(cmd_string + "\n") if universal_newlines is None: universal_newlines = self.universal_newlines diff --git a/QMTest/TestCommon.py b/QMTest/TestCommon.py index 6ee2bd5..1120b55 100644 --- a/QMTest/TestCommon.py +++ b/QMTest/TestCommon.py @@ -206,6 +206,22 @@ elif os.name == 'nt': def _status(self): return self.status +def _options_arguments(options, arguments): + """ + This handles the "options" keyword argument and merges it + with the arguments. + """ + if options: + if arguments is None: + arguments = options + else: + if isinstance(options, str): + options = [options] + if isinstance(arguments, str): + arguments = [arguments] + arguments = ' '.join(options + arguments) + return arguments + class TestCommon(TestCmd): # Additional methods from the Perl Test::Cmd::Common module @@ -477,13 +493,15 @@ class TestCommon(TestCmd): print self.banner('STDERR ') print actual_stderr self.fail_test() - if not expected_stdout is None and not match(actual_stdout, expected_stdout): + if expected_stdout is not None \ + and not match(actual_stdout, expected_stdout): self.diff(expected_stdout, actual_stdout, 'STDOUT ') if actual_stderr: print self.banner('STDERR ') print actual_stderr self.fail_test() - if not expected_stderr is None and not match(actual_stderr, expected_stderr): + if expected_stderr is not None \ + and not match(actual_stderr, expected_stderr): print self.banner('STDOUT ') print actual_stdout self.diff(expected_stderr, actual_stderr, 'STDERR ') @@ -491,28 +509,18 @@ class TestCommon(TestCmd): def start(self, program = None, interpreter = None, + options = None, arguments = None, universal_newlines = None, **kw): """ - Starts a program or script for the test environment. - - This handles the "options" keyword argument and exceptions. + Starts a program or script for the test environment, handling + any exceptions. """ + arguments = _options_arguments(options, arguments) try: - options = kw['options'] - del kw['options'] - except KeyError: - pass - else: - if options: - if arguments is None: - arguments = options - else: - arguments = options + " " + arguments - try: - return TestCmd.start(self, program, interpreter, arguments, universal_newlines, - **kw) + return TestCmd.start(self, program, interpreter, arguments, + universal_newlines, **kw) except KeyboardInterrupt: raise except Exception, e: @@ -557,7 +565,7 @@ class TestCommon(TestCmd): stdout = None, stderr = '', status = 0, **kw): """Runs the program under test, checking that the test succeeded. - The arguments are the same as the base TestCmd.run() method, + The parameters are the same as the base TestCmd.run() method, with the addition of: options Extra options that get appended to the beginning @@ -579,12 +587,7 @@ class TestCommon(TestCmd): not test standard output (stdout = None), and expects that error output is empty (stderr = ""). """ - if options: - if arguments is None: - arguments = options - else: - arguments = options + " " + arguments - kw['arguments'] = arguments + kw['arguments'] = _options_arguments(options, arguments) try: match = kw['match'] del kw['match'] diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 2122977..c49077b 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -133,8 +133,7 @@ else: fortran_lib = gccFortranLibs() - -file_expr = r"""File "[^"]*", line \d+, in .+ +file_expr = r"""File "[^"]*", line \d+, in [^\n]+ """ # re.escape escapes too much. @@ -144,15 +143,6 @@ def re_escape(str): return str - -try: - sys.version_info -except AttributeError: - # Pre-1.6 Python has no sys.version_info - version_string = sys.version.split()[0] - version_ints = list(map(int, version_string.split('.'))) - sys.version_info = tuple(version_ints + ['final', 0]) - def python_version_string(): return sys.version.split()[0] @@ -160,7 +150,7 @@ def python_minor_version_string(): return sys.version[:3] def unsupported_python_version(version=sys.version_info): - return version < (1, 5, 2) + return version < (2, 3, 0) def deprecated_python_version(version=sys.version_info): return version < (2, 4, 0) @@ -177,6 +167,38 @@ else: deprecated_python_expr = "" +def initialize_sconsflags(ignore_python_version): + """ + Add the --warn=no-python-version option to SCONSFLAGS for every + command so test scripts don't have to filter out Python version + deprecation warnings. + Same for --warn=no-visual-c-missing. + """ + save_sconsflags = os.environ.get('SCONSFLAGS') + if save_sconsflags: + sconsflags = [save_sconsflags] + else: + sconsflags = [] + if ignore_python_version and deprecated_python_version(): + sconsflags.append('--warn=no-python-version') + # Provide a way to suppress or provide alternate flags for + # TestSCons purposes by setting TESTSCONS_SCONSFLAGS. + # (The intended use case is to set it to null when running + # timing tests of earlier versions of SCons which don't + # support the --warn=no-visual-c-missing warning.) + visual_c = os.environ.get('TESTSCONS_SCONSFLAGS', + '--warn=no-visual-c-missing') + if visual_c: + sconsflags.append(visual_c) + os.environ['SCONSFLAGS'] = ' '.join(sconsflags) + return save_sconsflags + +def restore_sconsflags(sconsflags): + if sconsflags is None: + del os.environ['SCONSFLAGS'] + else: + os.environ['SCONSFLAGS'] = sconsflags + class TestSCons(TestCommon): """Class for testing SCons. @@ -234,19 +256,10 @@ class TestSCons(TestCommon): # TERM can cause test failures due to control chars in prompts etc. os.environ['TERM'] = 'dumb' - self.ignore_python_version=kw.get('ignore_python_version',1) - if kw.get('ignore_python_version',-1) != -1: + self.ignore_python_version = kw.get('ignore_python_version',1) + if kw.get('ignore_python_version', -1) != -1: del kw['ignore_python_version'] - if self.ignore_python_version and deprecated_python_version(): - sconsflags = os.environ.get('SCONSFLAGS') - if sconsflags: - sconsflags = [sconsflags] - else: - sconsflags = [] - sconsflags = sconsflags + ['--warn=no-python-version'] - os.environ['SCONSFLAGS'] = ' '.join(sconsflags) - TestCommon.__init__(self, **kw) import SCons.Node.FS @@ -336,38 +349,42 @@ class TestSCons(TestCommon): def run(self, *args, **kw): """ - Add the --warn=no-python-version option to SCONSFLAGS every - command so test scripts don't have to filter out Python version - deprecation warnings. - Same for --warn=no-visual-c-missing. + Set up SCONSFLAGS for every command so test scripts don't need + to worry about unexpected warnings in their output. """ - save_sconsflags = os.environ.get('SCONSFLAGS') - if save_sconsflags: - sconsflags = [save_sconsflags] - else: - sconsflags = [] - if self.ignore_python_version and deprecated_python_version(): - sconsflags = sconsflags + ['--warn=no-python-version'] - # Provide a way to suppress or provide alternate flags for - # TestSCons purposes by setting TESTSCONS_SCONSFLAGS. - # (The intended use case is to set it to null when running - # timing tests of earlier versions of SCons which don't - # support the --warn=no-visual-c-missing warning.) - sconsflags = sconsflags + [os.environ.get('TESTSCONS_SCONSFLAGS', - '--warn=no-visual-c-missing')] - os.environ['SCONSFLAGS'] = ' '.join(sconsflags) + sconsflags = initialize_sconsflags(self.ignore_python_version) try: - result = TestCommon.run(self, *args, **kw) + TestCommon.run(self, *args, **kw) finally: - sconsflags = save_sconsflags - return result - - def up_to_date(self, options = None, arguments = None, read_str = "", **kw): + restore_sconsflags(sconsflags) + +# Modifying the options should work and ought to be simpler, but this +# class is used for more than just running 'scons' itself. If there's +# an automated way of determining whether it's running 'scons' or +# something else, this code should be resurected. +# options = kw.get('options') +# if options: +# options = [options] +# else: +# options = [] +# if self.ignore_python_version and deprecated_python_version(): +# options.append('--warn=no-python-version') +# # Provide a way to suppress or provide alternate flags for +# # TestSCons purposes by setting TESTSCONS_SCONSFLAGS. +# # (The intended use case is to set it to null when running +# # timing tests of earlier versions of SCons which don't +# # support the --warn=no-visual-c-missing warning.) +# visual_c = os.environ.get('TESTSCONS_SCONSFLAGS', +# '--warn=no-visual-c-missing') +# if visual_c: +# options.append(visual_c) +# kw['options'] = ' '.join(options) +# TestCommon.run(self, *args, **kw) + + def up_to_date(self, arguments = '.', read_str = "", **kw): s = "" for arg in arguments.split(): s = s + "scons: `%s' is up to date.\n" % arg - if options: - arguments = options + " " + arguments kw['arguments'] = arguments stdout = self.wrap_stdout(read_str = read_str, build_str = s) # Append '.*' so that timing output that comes after the @@ -376,7 +393,7 @@ class TestSCons(TestCommon): kw['match'] = self.match_re_dotall self.run(**kw) - def not_up_to_date(self, options = None, arguments = None, **kw): + def not_up_to_date(self, arguments = '.', **kw): """Asserts that none of the targets listed in arguments is up to date, but does not make any assumptions on other targets. This function is most useful in conjunction with the -n option. @@ -384,8 +401,6 @@ class TestSCons(TestCommon): s = "" for arg in arguments.split(): s = s + "(?!scons: `%s' is up to date.)" % re.escape(arg) - if options: - arguments = options + " " + arguments s = '('+s+'[^\n]*\n)*' kw['arguments'] = arguments stdout = re.escape(self.wrap_stdout(build_str='ARGUMENTSGOHERE')) @@ -419,15 +434,21 @@ class TestSCons(TestCommon): # warning enabled, should get expected output stderr = '\nscons: warning: ' + re_escape(msg) + '\n' + file_expr - self.run(arguments = '--warn=%s .' % warn, stderr=stderr) + 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) + self.run(arguments = '--warn=no-%s .' % warn, + stderr=expect, + match = match_re_dotall) # 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) + self.run(arguments = '--warn=no-%s .' % warn, + stderr=expect, + match = match_re_dotall) def diff_substr(self, expect, actual, prelen=20, postlen=40): i = 0 @@ -473,7 +494,6 @@ class TestSCons(TestCommon): s = re.sub(r'/Length \d+ *\n/Filter /FlateDecode\n', r'/Length XXXX\n/Filter /FlateDecode\n', s) - try: import zlib except ImportError: @@ -971,7 +991,12 @@ print py_ver """ if 'stdin' not in kw: kw['stdin'] = True - return TestCommon.start(self, *args, **kw) + sconsflags = initialize_sconsflags(self.ignore_python_version) + try: + p = TestCommon.start(self, *args, **kw) + finally: + restore_sconsflags(sconsflags) + return p def wait_for(self, fname, timeout=10.0, popen=None): """ diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 7b5805d..628d012 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -39,9 +39,7 @@ RELEASE 2.0.0.alpha.20100508 - Sat, 08 May 2010 14:29:17 -0700 - Add a '-3' option to runtest to print 3.x incompatibility warnings. - - Convert most old-style classes into new-style classes. - - - Update deprecation warnings; most now become errors. + - Convert old-style classes into new-style classes. From Greg Noel: @@ -73,6 +71,10 @@ RELEASE 2.0.0.alpha.20100508 - Sat, 08 May 2010 14:29:17 -0700 - Comb out code paths specialized to Pythons older than 2.4. + - Update deprecation warnings; most now become mandatory. + + - Start deprecation cycle for BuildDir() and build_dir. + RELEASE 1.3.0 - Tue, 23 Mar 2010 21:44:19 -0400 diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 4a21fa7..bc12077 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,11 +1,12 @@ - A new SCons checkpoint release, 2.0.0.alpha.20100508, is now available. - The primary purpose of this release is to remove support for - Python versions prior to 2.4 and streamline the SCons code base - using more modern python idioms. - The checkpoint is available at the SCons download page: + A new SCons checkpoint release, 2.0.0.beta.yyyymmdd, is now available on + the SCons download page: http://www.scons.org/download.php + The primary purpose of this release is to remove support for Python + versions prior to 2.4 and streamline the SCons code base using more + modern python idioms. + A SCons "checkpoint release" is intended to provide early access to new features so they can be tested in the field before being released for adoption by other software distributions. @@ -40,6 +41,8 @@ - All features or usages deprecated in 1.3 should have been removed. Uses of formerly-deprecated features should get an error. + - The BuildDir() method and the build_dir option now get warnings. + CHANGED/ENHANCED EXISTING FUNCTIONALITY - Any Command() or env.Command() calls that use the following Action @@ -84,6 +87,8 @@ DEVELOPMENT - Code no longer has to be compatible with Python versions back to 1.5.2. + 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. diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 96f42da..38a712e 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1812,6 +1812,8 @@ class Base(SubstitutionEnvironment): return tlist def BuildDir(self, *args, **kw): + msg = """BuildDir() and the build_dir keyword have been deprecated;\n\tuse VariantDir() and the variant_dir keyword instead.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) if 'build_dir' in kw: kw['variant_dir'] = kw['build_dir'] del kw['build_dir'] @@ -2043,6 +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) entries = self.arg2nodes(entry, self.fs.Entry) for entry in entries: entry.set_src_builder(builder) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index d5057e1..0c39340 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -752,21 +752,8 @@ def _main(parser): # suppress) appropriate warnings about anything that might happen, # as configured by the user. - default_warnings = [ SCons.Warnings.CorruptSConsignWarning, + default_warnings = [ SCons.Warnings.WarningOnByDefault, SCons.Warnings.DeprecatedWarning, - SCons.Warnings.DuplicateEnvironmentWarning, - SCons.Warnings.FutureReservedVariableWarning, - SCons.Warnings.LinkWarning, - SCons.Warnings.MissingSConscriptWarning, - SCons.Warnings.NoMD5ModuleWarning, - SCons.Warnings.NoMetaclassSupportWarning, - SCons.Warnings.NoObjectCountWarning, - SCons.Warnings.NoParallelSupportWarning, - SCons.Warnings.MisleadingKeywordsWarning, - SCons.Warnings.ReservedVariableWarning, - SCons.Warnings.StackSizeWarning, - SCons.Warnings.VisualVersionMismatch, - SCons.Warnings.VisualCMissingWarning, ] for warning in default_warnings: @@ -944,7 +931,7 @@ def _main(parser): # $SCONSFLAGS, or in the SConscript file, then the search through # the list of deprecated warning classes will find that disabling # first and not issue the warning. - SCons.Warnings.enableWarningClass(SCons.Warnings.PythonVersionWarning) + #SCons.Warnings.enableWarningClass(SCons.Warnings.PythonVersionWarning) SCons.Warnings.process_warn_strings(options.warn) # Now that we've read the SConscript files, we can check for the diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index c3433ca..aa555da 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -378,7 +378,7 @@ class SConsEnvironment(SCons.Environment.Base): def _get_SConscript_filenames(self, ls, kw): """ - Convert the parameters passed to # SConscript() calls into a list + Convert the parameters passed to SConscript() calls into a list of files and export variables. If the parameters are invalid, throws SCons.Errors.UserError. Returns a tuple (l, e) where l is a list of SConscript filenames and e is a list of exports. @@ -523,6 +523,9 @@ class SConsEnvironment(SCons.Environment.Base): raise SCons.Errors.UserError("Import of non-existent variable '%s'"%x) def SConscript(self, *ls, **kw): + if 'build_dir' in kw: + msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" + SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) def subst_element(x, subst=self.subst): if SCons.Util.is_List(x): x = list(map(subst, x)) diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index b17d863..a260c4a 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -36,6 +36,8 @@ import SCons.Errors class Warning(SCons.Errors.UserError): pass +class WarningOnByDefault(Warning): + pass # NOTE: If you add a new warning class, add it to the man page, too! @@ -43,51 +45,51 @@ class Warning(SCons.Errors.UserError): class CacheWriteErrorWarning(Warning): pass -class CorruptSConsignWarning(Warning): +class CorruptSConsignWarning(WarningOnByDefault): pass class DependencyWarning(Warning): pass -class DuplicateEnvironmentWarning(Warning): +class DuplicateEnvironmentWarning(WarningOnByDefault): pass -class FutureReservedVariableWarning(Warning): +class FutureReservedVariableWarning(WarningOnByDefault): pass -class LinkWarning(Warning): +class LinkWarning(WarningOnByDefault): pass -class MisleadingKeywordsWarning(Warning): +class MisleadingKeywordsWarning(WarningOnByDefault): pass -class MissingSConscriptWarning(Warning): +class MissingSConscriptWarning(WarningOnByDefault): pass -class NoMD5ModuleWarning(Warning): +class NoMD5ModuleWarning(WarningOnByDefault): pass -class NoMetaclassSupportWarning(Warning): +class NoMetaclassSupportWarning(WarningOnByDefault): pass -class NoObjectCountWarning(Warning): +class NoObjectCountWarning(WarningOnByDefault): pass -class NoParallelSupportWarning(Warning): +class NoParallelSupportWarning(WarningOnByDefault): pass -class ReservedVariableWarning(Warning): +class ReservedVariableWarning(WarningOnByDefault): pass -class StackSizeWarning(Warning): +class StackSizeWarning(WarningOnByDefault): pass -class VisualCMissingWarning(Warning): +class VisualCMissingWarning(WarningOnByDefault): pass # Used when MSVC_VERSION and MSVS_VERSION do not point to the # same version (MSVS_VERSION is deprecated) -class VisualVersionMismatch(Warning): +class VisualVersionMismatch(WarningOnByDefault): pass class VisualStudioMissingWarning(Warning): @@ -109,9 +111,19 @@ class MandatoryDeprecatedWarning(DeprecatedWarning): pass +# Special case; base always stays DeprecatedWarning class PythonVersionWarning(DeprecatedWarning): pass +class DeprecatedSourceCodeWarning(FutureDeprecatedWarning): + pass + +class DeprecatedBuildDirWarning(DeprecatedWarning): + pass + +class TaskmasterNeedsExecuteWarning(DeprecatedWarning): + pass + class DeprecatedCopyWarning(MandatoryDeprecatedWarning): pass @@ -124,9 +136,6 @@ class DeprecatedSourceSignaturesWarning(MandatoryDeprecatedWarning): class DeprecatedTargetSignaturesWarning(MandatoryDeprecatedWarning): pass -class TaskmasterNeedsExecuteWarning(DeprecatedWarning): - pass - class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning): pass @@ -153,7 +162,7 @@ def suppressWarningClass(clazz): _enabled.insert(0, (clazz, 0)) def enableWarningClass(clazz): - """Enable all warnings that are of type clazz or + """Enables all warnings that are of type clazz or derived from clazz.""" _enabled.insert(0, (clazz, 1)) diff --git a/test/CPPPATH/subdir-as-include.py b/test/CPPPATH/subdir-as-include.py index 1ff70a5..06a1a58 100644 --- a/test/CPPPATH/subdir-as-include.py +++ b/test/CPPPATH/subdir-as-include.py @@ -46,7 +46,7 @@ env = Environment(CPPPATH = [Dir('inc1')]) env.Program('prog.cpp') Export('env') -SConscript('inc1/SConscript', build_dir='inc1/build', duplicate=0) +SConscript('inc1/SConscript', variant_dir='inc1/build', duplicate=0) """) test.write('prog.cpp', """\ diff --git a/test/Configure/VariantDir2.py b/test/Configure/VariantDir2.py index 51fa8ca..62b832f 100644 --- a/test/Configure/VariantDir2.py +++ b/test/Configure/VariantDir2.py @@ -35,7 +35,7 @@ import TestSCons test = TestSCons.TestSCons() test.write('SConstruct', """\ -SConscript('SConscript', build_dir='build', src='.') +SConscript('SConscript', variant_dir='build', src='.') """) test.write('SConscript', """\ diff --git a/test/Deprecated/BuildDir.py b/test/Deprecated/BuildDir.py index 4918ac0..5fe10c0 100644 --- a/test/Deprecated/BuildDir.py +++ b/test/Deprecated/BuildDir.py @@ -27,8 +27,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Verify that the deprecated BuildDir() function and method still work to create a variant directory tree (by calling VariantDir() under the covers). - -Note that using BuildDir() does not yet print a deprecation warning. """ import TestSCons @@ -37,6 +35,17 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.write('SConstruct', """ +BuildDir('build', 'src') +""") + +msg = """BuildDir() and the build_dir keyword have been deprecated; +\tuse VariantDir() and the variant_dir keyword instead.""" +test.deprecated_warning('deprecated-build-dir', msg) + +warning = '\nscons: warning: ' + TestSCons.re_escape(msg) \ + + '\n' + TestSCons.file_expr + foo11 = test.workpath('work1', 'build', 'var1', 'foo1' + _exe) foo12 = test.workpath('work1', 'build', 'var1', 'foo2' + _exe) foo21 = test.workpath('work1', 'build', 'var2', 'foo1' + _exe) @@ -51,6 +60,7 @@ foo52 = test.workpath('build', 'var5', 'foo2' + _exe) test.subdir('work1') test.write(['work1', 'SConstruct'], """ +SetOption('warn', 'deprecated-build-dir') src = Dir('src') var2 = Dir('build/var2') var3 = Dir('build/var3') @@ -60,12 +70,12 @@ var6 = Dir('../build/var6') env = Environment(BUILD = 'build', SRC = 'src') -VariantDir('build/var1', src) -VariantDir(var2, src) -VariantDir(var3, src, duplicate=0) -env.VariantDir("$BUILD/var4", "$SRC", duplicate=0) -VariantDir(var5, src, duplicate=0) -VariantDir(var6, src) +BuildDir('build/var1', src) +BuildDir(var2, src) +BuildDir(var3, src, duplicate=0) +env.BuildDir("$BUILD/var4", "$SRC", duplicate=0) +BuildDir(var5, src, duplicate=0) +BuildDir(var6, src) env = Environment(CPPPATH='#src', FORTRANPATH='#src') SConscript('build/var1/SConscript', "env") @@ -185,28 +195,33 @@ test.write(['work1', 'src', 'f4h.in'], r""" # Some releases of freeBSD seem to have library complaints about # tempnam(). Filter out these annoying messages before checking for # error output. -def blank_output(err): +def filter_tempnam(err): if not err: - return 1 - stderrlines = [l for l in err.split('\n') if l] + return '' msg = "warning: tempnam() possibly used unsafely" - stderrlines = [l for l in stderrlines if l.find(msg) == -1] - return len(stderrlines) == 0 + return '\n'.join([l for l in err.splitlines() if l.find(msg) == -1]) test.run(chdir='work1', arguments = '. ../build', stderr=None) -test.fail_test(not blank_output(test.stderr())) +stderr = filter_tempnam(test.stderr()) +test.fail_test(TestSCons.match_re_dotall(stderr, 6*warning)) test.run(program = foo11, stdout = "f1.c\n") test.run(program = foo12, stdout = "f2.c\n") test.run(program = foo41, stdout = "f1.c\n") test.run(program = foo42, stdout = "f2.c\n") -test.run(chdir='work1', arguments='. ../build', stdout=test.wrap_stdout("""\ +test.run(chdir='work1', + arguments='. ../build', + stderr = None, + stdout=test.wrap_stdout("""\ scons: `.' is up to date. scons: `%s' is up to date. """ % test.workpath('build'))) +stderr = filter_tempnam(test.stderr()) +test.fail_test(TestSCons.match_re_dotall(stderr, 6*warning)) + import os import stat def equal_stats(x,y): @@ -255,7 +270,8 @@ test.write(['work1', 'src', 'f4h.in'], r""" test.run(chdir='work1', arguments = '../build/var5', stderr=None) -test.fail_test(not blank_output(test.stderr())) +stderr = filter_tempnam(test.stderr()) +test.fail_test(TestSCons.match_re_dotall(stderr, 6*warning)) test.run(program = foo51, stdout = "f1.c 2\n") test.run(program = test.workpath('build', 'var5', 'foo3' + _exe), @@ -263,10 +279,16 @@ test.run(program = test.workpath('build', 'var5', 'foo3' + _exe), test.run(program = test.workpath('build', 'var5', 'foo4' + _exe), stdout = "f4.c 2\n") -test.run(chdir='work1', arguments='../build/var5', stdout=test.wrap_stdout("""\ +test.run(chdir='work1', + arguments='../build/var5', + stderr=None, + stdout=test.wrap_stdout("""\ scons: `%s' is up to date. """ % test.workpath('build', 'var5'))) +stderr = filter_tempnam(test.stderr()) +test.fail_test(TestSCons.match_re_dotall(stderr, 6*warning)) + test.pass_test() # Local Variables: diff --git a/test/Deprecated/Options/BoolOption.py b/test/Deprecated/Options/BoolOption.py index ac2ecdc..563939b 100644 --- a/test/Deprecated/Options/BoolOption.py +++ b/test/Deprecated/Options/BoolOption.py @@ -39,8 +39,8 @@ def check(expect): assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect) - test.write(SConstruct_path, """\ +SetOption('warn', 'deprecated-options') from SCons.Options.BoolOption import BoolOption BO = BoolOption @@ -83,7 +83,6 @@ Invalid value for boolean option: irgendwas test.run(arguments='warnings=irgendwas', stderr=expect_stderr, status=2) - test.pass_test() # Local Variables: diff --git a/test/Deprecated/SConscript-build_dir.py b/test/Deprecated/SConscript-build_dir.py index 41b5222..76ff688 100644 --- a/test/Deprecated/SConscript-build_dir.py +++ b/test/Deprecated/SConscript-build_dir.py @@ -26,13 +26,24 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that specifying a build_dir argument to SConscript still works. - -Note that the build_dir argument does not yet print a deprecation warning. """ import TestSCons -test = TestSCons.TestSCons() +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.write('SConstruct', """ +SConscript('SConscript', build_dir = 'build') +""") + +test.write('SConscript', """ +""") + +msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" +test.deprecated_warning('deprecated-build-dir', msg) + +warning = '\nscons: warning: ' + TestSCons.re_escape(msg) \ + + '\n' + TestSCons.file_expr all1 = test.workpath('test', 'build', 'var1', 'all') all2 = test.workpath('test', 'build', 'var2', 'all') @@ -47,6 +58,7 @@ all9 = test.workpath('test', 'build', 'var9', 'src', 'all') test.subdir('test') test.write(['test', 'SConstruct'], """ +SetOption('warn', 'deprecated-build-dir') src = Dir('src') alt = Dir('alt') var1 = Dir('build/var1') @@ -116,7 +128,7 @@ test.write('test/alt/aaa.in', "test/alt/aaa.in\n") test.write('test/alt/bbb.in', "test/alt/bbb.in\n") test.write('test/alt/ccc.in', "test/alt/ccc.in\n") -test.run(chdir='test', arguments = '. ../build') +test.run(chdir='test', arguments = '. ../build', stderr = 7*warning) all_src = "test/src/aaa.in\ntest/src/bbb.in\ntest/src/ccc.in\n" all_alt = "test/alt/aaa.in\ntest/alt/bbb.in\ntest/alt/ccc.in\n" @@ -236,7 +248,7 @@ main(int argc, char *argv[]) { } """) -test.run(chdir="test2") +test.run(chdir="test2", stderr = warning) _obj = TestSCons._obj @@ -267,7 +279,7 @@ test.write(['test3', 'src', 'file.in'], "file.in\n") test.write(['test3', 'src', '_glscry', 'file.in'], "file.in\n") -test.run(chdir='test3') +test.run(chdir='test3', stderr = warning) test.pass_test() diff --git a/test/Deprecated/Sig.py b/test/Deprecated/Sig.py new file mode 100644 index 0000000..1ae118b --- /dev/null +++ b/test/Deprecated/Sig.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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__" + +""" +Verify that we generate the proper warning, but don't die, when someone +tries to import the SCons.Sig module (which no longer exists) and +use the things we used to define therein. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +SConstruct = test.workpath('SConstruct') + +test.write(SConstruct, """ +import SCons.Sig +x = SCons.Sig.default_calc +x = SCons.Sig.default_module +x = SCons.Sig.MD5.current() +x = SCons.Sig.MD5.collect() +x = SCons.Sig.MD5.signature() +x = SCons.Sig.MD5.to_string() +x = SCons.Sig.MD5.from_string() +x = SCons.Sig.TimeStamp.current() +x = SCons.Sig.TimeStamp.collect() +x = SCons.Sig.TimeStamp.signature() +x = SCons.Sig.TimeStamp.to_string() +x = SCons.Sig.TimeStamp.from_string() +""") + +expect = """ +scons: warning: The SCons.Sig module no longer exists. + Remove the following "import SCons.Sig" line to eliminate this warning: +""" + test.python_file_line(SConstruct, 2) + +test.run(arguments = '.', stderr=expect) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Deprecated/SourceSignatures/basic.py b/test/Deprecated/SourceSignatures/basic.py index c762a73..52a2c5c 100644 --- a/test/Deprecated/SourceSignatures/basic.py +++ b/test/Deprecated/SourceSignatures/basic.py @@ -54,7 +54,7 @@ def write_SConstruct(test, sigtype): expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr write_SConstruct(test, 'timestamp') diff --git a/test/Deprecated/SourceSignatures/env.py b/test/Deprecated/SourceSignatures/env.py index 4851140..bb76ff4 100644 --- a/test/Deprecated/SourceSignatures/env.py +++ b/test/Deprecated/SourceSignatures/env.py @@ -60,7 +60,7 @@ def write_SConstruct(test, env_sigtype, default_sigtype): expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr write_SConstruct(test, 'MD5', 'timestamp') diff --git a/test/Deprecated/SourceSignatures/implicit-cache.py b/test/Deprecated/SourceSignatures/implicit-cache.py index ee43ae4..af6aa49 100644 --- a/test/Deprecated/SourceSignatures/implicit-cache.py +++ b/test/Deprecated/SourceSignatures/implicit-cache.py @@ -51,7 +51,7 @@ env.B(target = 'both.out', source = 'both.in') expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr both_out_both_in = re.escape(test.wrap_stdout('build(["both.out"], ["both.in"])\n')) diff --git a/test/Deprecated/SourceSignatures/no-csigs.py b/test/Deprecated/SourceSignatures/no-csigs.py index 93ad408..f815538 100644 --- a/test/Deprecated/SourceSignatures/no-csigs.py +++ b/test/Deprecated/SourceSignatures/no-csigs.py @@ -50,7 +50,7 @@ test.write('f2.in', "f2.in\n") expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr test.run(arguments = '.', stderr = expect) diff --git a/test/Deprecated/SourceSignatures/overrides.py b/test/Deprecated/SourceSignatures/overrides.py index 78e7bad..4303c0e 100644 --- a/test/Deprecated/SourceSignatures/overrides.py +++ b/test/Deprecated/SourceSignatures/overrides.py @@ -39,7 +39,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr test.write('SConstruct', """\ SetOption('warn', 'deprecated-source-signatures') diff --git a/test/Deprecated/SourceSignatures/switch-rebuild.py b/test/Deprecated/SourceSignatures/switch-rebuild.py index 70ebfbe..e8af27a 100644 --- a/test/Deprecated/SourceSignatures/switch-rebuild.py +++ b/test/Deprecated/SourceSignatures/switch-rebuild.py @@ -37,7 +37,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) expect = TestSCons.re_escape(""" scons: warning: The env.SourceSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr base_sconstruct_contents = """\ diff --git a/test/Deprecated/TargetSignatures/build-content.py b/test/Deprecated/TargetSignatures/build-content.py index 6213ef6..6a5a8c4 100644 --- a/test/Deprecated/TargetSignatures/build-content.py +++ b/test/Deprecated/TargetSignatures/build-content.py @@ -39,7 +39,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) expect = TestSCons.re_escape(""" scons: warning: The env.TargetSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr sconstruct_contents = """\ diff --git a/test/Deprecated/TargetSignatures/content.py b/test/Deprecated/TargetSignatures/content.py index 5bd1a89..2cd90ec 100644 --- a/test/Deprecated/TargetSignatures/content.py +++ b/test/Deprecated/TargetSignatures/content.py @@ -39,7 +39,7 @@ scons: warning: The env.SourceSignatures() method is deprecated; """) + TestSCons.file_expr + TestSCons.re_escape(""" scons: warning: The env.TargetSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr test.write('SConstruct', """\ diff --git a/test/Deprecated/TargetSignatures/overrides.py b/test/Deprecated/TargetSignatures/overrides.py index bc8de34..54a66d4 100644 --- a/test/Deprecated/TargetSignatures/overrides.py +++ b/test/Deprecated/TargetSignatures/overrides.py @@ -48,7 +48,7 @@ test.write('foo.in', "foo.in\n") expect = TestSCons.re_escape(""" scons: warning: The env.TargetSignatures() method is deprecated; \tconvert your build to use the env.Decider() method instead. -""") + TestSCons.file_expr + TestSCons.deprecated_python_expr +""") + TestSCons.file_expr test.run(arguments = '.', stderr = expect) diff --git a/test/Mkdir.py b/test/Mkdir.py index dbeecb7..4d309bb 100644 --- a/test/Mkdir.py +++ b/test/Mkdir.py @@ -159,7 +159,7 @@ test.write(['work3', 'SConstruct'], """\ #/SConstruct ------------------------------------------ import os env = Environment(ENV = os.environ) -BuildDir('build', 'sub1', duplicate=0) +VariantDir('build', 'sub1', duplicate=0) base = '#build/sub1' Export('env base') SConscript('sub1/SConscript', exports='env') diff --git a/test/Sig.py b/test/Sig.py deleted file mode 100644 index 1ae118b..0000000 --- a/test/Sig.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# -# __COPYRIGHT__ -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# 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__" - -""" -Verify that we generate the proper warning, but don't die, when someone -tries to import the SCons.Sig module (which no longer exists) and -use the things we used to define therein. -""" - -import TestSCons - -test = TestSCons.TestSCons() - -SConstruct = test.workpath('SConstruct') - -test.write(SConstruct, """ -import SCons.Sig -x = SCons.Sig.default_calc -x = SCons.Sig.default_module -x = SCons.Sig.MD5.current() -x = SCons.Sig.MD5.collect() -x = SCons.Sig.MD5.signature() -x = SCons.Sig.MD5.to_string() -x = SCons.Sig.MD5.from_string() -x = SCons.Sig.TimeStamp.current() -x = SCons.Sig.TimeStamp.collect() -x = SCons.Sig.TimeStamp.signature() -x = SCons.Sig.TimeStamp.to_string() -x = SCons.Sig.TimeStamp.from_string() -""") - -expect = """ -scons: warning: The SCons.Sig module no longer exists. - Remove the following "import SCons.Sig" line to eliminate this warning: -""" + test.python_file_line(SConstruct, 2) - -test.run(arguments = '.', stderr=expect) - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Value.py b/test/Value.py index 06cce40..f3ad458 100644 --- a/test/Value.py +++ b/test/Value.py @@ -97,7 +97,7 @@ for source_signature in ['MD5', 'timestamp-newer']: #" <- unconfuses emacs syntax highlighting test.must_contain_all_lines(test.stdout(), [out1, out2, out7, out8]) - print test.stdout() + #print test.stdout() test.fail_test(re.search(out3, test.stdout()) == None) test.must_match('f1.out', "/usr/local") @@ -108,7 +108,7 @@ for source_signature in ['MD5', 'timestamp-newer']: test.up_to_date(arguments='.') - test.run(arguments='prefix=/usr') + test.run(options='prefix=/usr') out4 = """create(["f1.out"], ['/usr'])""" out5 = """create(["f2.out"], [4])""" out6 = """create\\(\\["f3.out"\\], \\[<.*.Custom (instance|object) at """ @@ -121,18 +121,18 @@ for source_signature in ['MD5', 'timestamp-newer']: test.must_match('f3.out', "C=/usr") test.must_match('f4.out', '4') - test.up_to_date('prefix=/usr', '.') + test.up_to_date(options='prefix=/usr', arguments='.') test.unlink('f3.out') - test.run(arguments='prefix=/var') + test.run(options='prefix=/var') out4 = """create(["f1.out"], ['/var'])""" test.must_contain_all_lines(test.stdout(), [out4, out7, out8]) test.must_not_contain_any_line(test.stdout(), [out5]) test.fail_test(re.search(out6, test.stdout()) == None) - test.up_to_date('prefix=/var', '.') + test.up_to_date(options='prefix=/var', arguments='.') test.must_match('f1.out', "/var") test.must_match('f2.out', "4") diff --git a/test/option/warn-dependency.py b/test/option/warn-dependency.py index c056278..95d8fed 100644 --- a/test/option/warn-dependency.py +++ b/test/option/warn-dependency.py @@ -33,7 +33,6 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - test.write("SConstruct", """\ import SCons.Defaults @@ -51,23 +50,21 @@ test.write("foo.c",""" """) - expect = r""" scons: warning: No dependency generated for file: not_there\.h \(included from: foo\.c\) \-\- file not found -""" +""" + TestSCons.file_expr test.run(arguments='--warn=dependency .', - stderr=expect + TestSCons.file_expr) + stderr=expect) test.run(arguments='--warn=dependency .', - stderr=expect + TestSCons.file_expr) + stderr=expect) test.run(arguments='--warn=all --warn=no-dependency .', stderr=TestSCons.deprecated_python_expr) test.run(arguments='--warn=no-dependency --warn=all .', - stderr=TestSCons.deprecated_python_expr + expect + TestSCons.file_expr) - + stderr=TestSCons.deprecated_python_expr + expect) test.pass_test() diff --git a/test/option/warn-duplicate-environment.py b/test/option/warn-duplicate-environment.py index a1c156b..09ced2d 100644 --- a/test/option/warn-duplicate-environment.py +++ b/test/option/warn-duplicate-environment.py @@ -33,7 +33,6 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - test.write('SConstruct', """ def build(env, target, source): file = open(str(target[0]), 'wb') @@ -57,24 +56,19 @@ test.write('file1b.in', 'file1b.in\n') expect = r""" scons: warning: Two different environments were specified for target file1.out, \tbut they appear to have the same action: build\(target, source, env\) -""" +""" + TestSCons.file_expr -test.run(arguments='file1.out', - stderr=expect + TestSCons.file_expr) +test.run(arguments='file1.out', stderr=expect) test.must_match('file1.out', "file1a.in\nfile1b.in\n") -test.run(arguments='--warn=duplicate-environment file1.out', - stderr=expect + TestSCons.file_expr) +test.run(arguments='--warn=duplicate-environment file1.out', stderr=expect) test.run(arguments='--warn=no-duplicate-environment file1.out') -test.run(arguments='WARN=duplicate-environment file1.out', - stderr=expect + TestSCons.file_expr) - -test.run(arguments='WARN=no-duplicate-environment file1.out', - stderr = TestSCons.deprecated_python_expr) +test.run(arguments='WARN=duplicate-environment file1.out', stderr=expect) +test.run(arguments='WARN=no-duplicate-environment file1.out') test.pass_test() diff --git a/test/option/warn-misleading-keywords.py b/test/option/warn-misleading-keywords.py index e8b6358..67bc965 100644 --- a/test/option/warn-misleading-keywords.py +++ b/test/option/warn-misleading-keywords.py @@ -33,7 +33,6 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - test.write('SConstruct', """ def build(env, target, source): file = open(str(target[0]), 'wb') @@ -55,25 +54,21 @@ test.write('file3b.out', 'file3b.out\n') expect = r""" scons: warning: Did you mean to use `(target|source)' instead of `(targets|sources)'\? -""" +""" + TestSCons.file_expr test.run(arguments='.', - stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) + stderr=expect + expect) test.must_match(['file3a'], 'file3a.in\n') test.must_match(['file3b'], 'file3b.out\n') -test.run(arguments='--warn=misleading-keywords .', - stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) +test.run(arguments='--warn=misleading-keywords .', stderr=expect + expect) test.run(arguments='--warn=no-misleading-keywords .') -test.run(arguments='WARN=misleading-keywords .', - stderr=expect + TestSCons.file_expr + expect + TestSCons.file_expr) - -test.run(arguments='WARN=no-misleading-keywords .', - stderr = TestSCons.deprecated_python_expr) +test.run(arguments='WARN=misleading-keywords .', stderr=expect + expect) +test.run(arguments='WARN=no-misleading-keywords .') test.pass_test() diff --git a/test/option/warn-missing-sconscript.py b/test/option/warn-missing-sconscript.py index 9dc5eee..4f1f8bd 100644 --- a/test/option/warn-missing-sconscript.py +++ b/test/option/warn-missing-sconscript.py @@ -33,7 +33,6 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) - test.write("SConstruct", """\ def build(target, source, env): pass @@ -51,19 +50,17 @@ test.write("foo.c",""" #include "not_there.h" """) -test.run(arguments = '--warn=missing-sconscript .', stderr = r""" +expect = r""" scons: warning: Ignoring missing SConscript 'no_such_file' -""" + TestSCons.file_expr) +""" + TestSCons.file_expr -test.run(arguments = '--warn=no-missing-sconscript .', stderr = "") +test.run(arguments = '--warn=missing-sconscript .', stderr = expect) -test.run(arguments = 'WARN=missing-sconscript .', stderr = r""" -scons: warning: Ignoring missing SConscript 'no_such_file' -""" + TestSCons.file_expr) +test.run(arguments = '--warn=no-missing-sconscript .', stderr = "") -test.run(arguments = 'WARN=no-missing-sconscript .', - stderr = TestSCons.deprecated_python_expr) +test.run(arguments = 'WARN=missing-sconscript .', stderr = expect) +test.run(arguments = 'WARN=no-missing-sconscript .') test.pass_test() -- cgit v0.12