diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-05-26 16:17:09 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-05-26 16:17:09 (GMT) |
commit | 545d2a0a389e9eacdb1d92fbf5f26f2d981029ad (patch) | |
tree | 23f5cda5c621bd7bb657ef9fd1d07e4578d4a934 /src | |
parent | 5c2e07585593ee4994b8e7d79b3d181a56cd7f13 (diff) | |
download | SCons-545d2a0a389e9eacdb1d92fbf5f26f2d981029ad.zip SCons-545d2a0a389e9eacdb1d92fbf5f26f2d981029ad.tar.gz SCons-545d2a0a389e9eacdb1d92fbf5f26f2d981029ad.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 8 | ||||
-rw-r--r-- | src/RELEASE.txt | 15 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 17 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Warnings.py | 45 |
6 files changed, 53 insertions, 42 deletions
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)) |