diff options
author | Mats Wichmann <mats@linux.com> | 2019-12-14 16:49:02 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2019-12-14 16:55:29 (GMT) |
commit | 7c69e892566d189d83760ebd0e56b44fa11165ce (patch) | |
tree | d25875417fc96a88ae3756027bd4a29d5efaeaca | |
parent | 874884c748f2f480b0ef44444627662b2c203764 (diff) | |
download | SCons-7c69e892566d189d83760ebd0e56b44fa11165ce.zip SCons-7c69e892566d189d83760ebd0e56b44fa11165ce.tar.gz SCons-7c69e892566d189d83760ebd0e56b44fa11165ce.tar.bz2 |
Remove deprecated env.Copy()
Method removed. Test moved to test/Removed/Copy-Method/Old, and new
test added to ensure it takes an AttributeError.
Deprecation warning no longer useful for this one, so removed.
Signed-off-by: Mats Wichmann <mats@linux.com>
-rw-r--r-- | doc/man/scons.xml | 18 | ||||
-rwxr-xr-x | src/CHANGES.txt | 2 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 12 | ||||
-rw-r--r-- | src/engine/SCons/Warnings.py | 3 | ||||
-rw-r--r-- | test/Clone-compatibility.py | 2 | ||||
-rw-r--r-- | test/Removed/Copy-Method/Copy-Method.py | 49 | ||||
-rw-r--r-- | test/Removed/Copy-Method/Old/Copy-Method.py (renamed from test/Deprecated/Copy-Method.py) | 0 | ||||
-rw-r--r-- | test/Removed/Copy-Method/Old/sconstest.skip | 0 | ||||
-rw-r--r-- | test/Removed/Copy-Method/README.md | 6 | ||||
-rw-r--r-- | test/Removed/Copy-Method/SConstruct.method | 2 |
11 files changed, 63 insertions, 39 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml index a7327ea..899669e 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -1795,20 +1795,6 @@ Warnings for some specific deprecated features may be enabled or disabled individually; see below.</para> - <blockquote> - <variablelist> - <varlistentry> - <term>--warn=deprecated-copy, --warn=no-deprecated-copy</term> - <listitem> -<para>Enables or disables warnings about use of the deprecated -<emphasis role="bold">env.Copy()</emphasis> -method.</para> - - </listitem> - </varlistentry> - </variablelist> - </blockquote> - </listitem> </varlistentry> <varlistentry> @@ -7038,7 +7024,7 @@ value each time we call the SConscript function.</para> <programlisting> SConstruct: - env = Environment(LIBPATH = ['#libA', '#libB']) + env = Environment(LIBPATH=['#libA', '#libB']) Export('env') SConscript('libA/SConscript') SConscript('libB/SConscript') @@ -7057,7 +7043,7 @@ libB/SConscript: Main/SConscript: Import('env') - e = env.Copy(LIBS = ['a', 'b']) + e = env.Clone(LIBS=['a', 'b']) e.Program('foo', Split('m1.c m2.c m3.c')) </programlisting> diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c837157..862e083 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -63,6 +63,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER helps test suite runs. - Remove deprecated SourceSignatures, TargetSignatures - Remove deprecated Builder keywords: overrides and scanner + - Remove deprecated env.Copy + - A number of documentation improvements. RELEASE 3.1.1 - Mon, 07 Aug 2019 20:09:12 -0500 diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 916ebc4..4535be9 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1428,14 +1428,6 @@ class Base(SubstitutionEnvironment): if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.EnvironmentClone') return clone - def Copy(self, *args, **kw): - global _warn_copy_deprecated - if _warn_copy_deprecated: - msg = "The env.Copy() method is deprecated; use the env.Clone() method instead." - SCons.Warnings.warn(SCons.Warnings.DeprecatedCopyWarning, msg) - _warn_copy_deprecated = False - return self.Clone(*args, **kw) - def _changed_build(self, dependency, target, prev_ni, repo_node=None): if dependency.changed_state(target, prev_ni, repo_node): return 1 diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 0957361..b2f2bd5 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1876,18 +1876,6 @@ def generate(env): assert ('BUILDERS' in env) is False env2 = env.Clone() - def test_Copy(self): - """Test copying using the old env.Copy() method""" - env1 = self.TestEnvironment(XXX = 'x', YYY = 'y') - env2 = env1.Copy() - env1copy = env1.Copy() - assert env1copy == env1copy - assert env2 == env2 - env2.Replace(YYY = 'yyy') - assert env2 == env2 - assert env1 != env2 - assert env1 == env1copy - def test_Detect(self): """Test Detect()ing tools""" test = TestCmd.TestCmd(workdir = '') diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index 718b3d5..cd24b7c 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -126,9 +126,6 @@ class DeprecatedBuildDirWarning(DeprecatedWarning): class TaskmasterNeedsExecuteWarning(DeprecatedWarning): pass -class DeprecatedCopyWarning(MandatoryDeprecatedWarning): - pass - class DeprecatedOptionsWarning(MandatoryDeprecatedWarning): pass diff --git a/test/Clone-compatibility.py b/test/Clone-compatibility.py index a2f6362..38cbeb3 100644 --- a/test/Clone-compatibility.py +++ b/test/Clone-compatibility.py @@ -39,6 +39,8 @@ test.write('SConstruct', """ # code as the correct pattern for maintaining the backwards compatibility # of SConstruct files to earlier release of SCons. Going forward, make # sure it still works (or at least doesn't blow up). +# Copy was removed for 3.1.2 but Clone will certainly be there - +# this test probably isn't needed any longer. import SCons.Environment try: SCons.Environment.Environment.Clone diff --git a/test/Removed/Copy-Method/Copy-Method.py b/test/Removed/Copy-Method/Copy-Method.py new file mode 100644 index 0000000..e55ebc6 --- /dev/null +++ b/test/Removed/Copy-Method/Copy-Method.py @@ -0,0 +1,49 @@ +#!/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 env.Copy() fails as expected since its removal +""" + +import TestSCons + +test = TestSCons.TestSCons(match = TestSCons.match_re_dotall) + +test.file_fixture('SConstruct.method', 'SConstruct') +expect = """\ +AttributeError: 'SConsEnvironment' object has no attribute 'Copy': + File "{}", line 2: + env.Copy() +""".format(test.workpath('SConstruct')) +test.run(arguments='-Q -s', status=2, stdout=None, 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/Copy-Method.py b/test/Removed/Copy-Method/Old/Copy-Method.py index 2714f64..2714f64 100644 --- a/test/Deprecated/Copy-Method.py +++ b/test/Removed/Copy-Method/Old/Copy-Method.py diff --git a/test/Removed/Copy-Method/Old/sconstest.skip b/test/Removed/Copy-Method/Old/sconstest.skip new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Removed/Copy-Method/Old/sconstest.skip diff --git a/test/Removed/Copy-Method/README.md b/test/Removed/Copy-Method/README.md new file mode 100644 index 0000000..609c6e4 --- /dev/null +++ b/test/Removed/Copy-Method/README.md @@ -0,0 +1,6 @@ +Copy-Method.py is the "new" test for env.Copy, making sure we +get an AttributeError. + +The Old directory is the former tests from the deprecated state, +preserved here for reference; the presence of an scontest.skip file +means they are never executed. diff --git a/test/Removed/Copy-Method/SConstruct.method b/test/Removed/Copy-Method/SConstruct.method new file mode 100644 index 0000000..99737e1 --- /dev/null +++ b/test/Removed/Copy-Method/SConstruct.method @@ -0,0 +1,2 @@ +env = Environment() +env.Copy() |