summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-12-16 19:49:12 (GMT)
committerGitHub <noreply@github.com>2019-12-16 19:49:12 (GMT)
commitfdc0c6204088bbe150ccff906517c94bdae6837f (patch)
tree538a9f44e9fce2643a27e0d91828b79d91b3e5b8
parente8415886126979bec0a76095ec724a51605b7a87 (diff)
parent85b6c3efd79561dd9c9af71217ee8dff8b05c37a (diff)
downloadSCons-fdc0c6204088bbe150ccff906517c94bdae6837f.zip
SCons-fdc0c6204088bbe150ccff906517c94bdae6837f.tar.gz
SCons-fdc0c6204088bbe150ccff906517c94bdae6837f.tar.bz2
Merge pull request #3497 from mwichmann/depr-builddir
Remove deprecated BuildDir, build_dir
-rw-r--r--doc/user/separate.xml6
-rwxr-xr-xsrc/CHANGES.txt1
-rw-r--r--src/engine/SCons/Environment.py8
-rw-r--r--src/engine/SCons/Environment.xml22
-rw-r--r--src/engine/SCons/Script/SConscript.py24
-rw-r--r--src/engine/SCons/Script/__init__.py1
-rw-r--r--src/engine/SCons/Warnings.py9
-rw-r--r--test/Removed/BuildDir/BuildDir.py61
-rw-r--r--test/Removed/BuildDir/Old/BuildDir.py (renamed from test/Deprecated/BuildDir.py)0
-rw-r--r--test/Removed/BuildDir/Old/SConscript-build_dir.py (renamed from test/Deprecated/SConscript-build_dir.py)0
-rw-r--r--test/Removed/BuildDir/Old/sconstest.skip0
-rw-r--r--test/Removed/BuildDir/README.md6
-rw-r--r--test/Removed/BuildDir/SConscript-build_dir.py57
-rw-r--r--test/Removed/BuildDir/SConstruct.global1
-rw-r--r--test/Removed/BuildDir/SConstruct.kwarg1
-rw-r--r--test/Removed/BuildDir/SConstruct.method3
16 files changed, 140 insertions, 60 deletions
diff --git a/doc/user/separate.xml b/doc/user/separate.xml
index c276545..748a124 100644
--- a/doc/user/separate.xml
+++ b/doc/user/separate.xml
@@ -149,10 +149,8 @@ program using the F<build/foo.c> path name.
<para>
One historical note: the &VariantDir; function
- used to be called &BuildDir;.
- That name is still supported
- but has been deprecated
- because the &SCons; functionality
+ used to be called &BuildDir;, a name which was
+ removed because the &SCons; functionality
differs from the model of a "build directory"
implemented by other build systems like the GNU Autotools.
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index dade5e0..28a4b43 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -66,6 +66,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Remove deprecated SourceSignatures, TargetSignatures
- Remove deprecated Builder keywords: overrides and scanner
- Remove deprecated env.Copy
+ - Remove deprecated BuildDir plus SConscript keyword build_dir
- A number of documentation improvements.
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 4535be9..27179c3 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -1929,14 +1929,6 @@ class Base(SubstitutionEnvironment):
t.set_always_build()
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']
- return self.VariantDir(*args, **kw)
-
def Builder(self, **kw):
nkw = self.subst_kw(kw)
return SCons.Builder.Builder(**nkw)
diff --git a/src/engine/SCons/Environment.xml b/src/engine/SCons/Environment.xml
index 73c347e..6f263a4 100644
--- a/src/engine/SCons/Environment.xml
+++ b/src/engine/SCons/Environment.xml
@@ -613,28 +613,6 @@ env.AppendUnique(CCFLAGS = '-g', FOO = ['foo.yyy'])
</summary>
</scons_function>
-<scons_function name="BuildDir">
-<arguments>
-(build_dir, src_dir, [duplicate])
-</arguments>
-<summary>
-<para>
-Deprecated synonyms for
-&f-VariantDir;
-and
-<function>env.VariantDir</function>().
-The
-<varname>build_dir</varname>
-argument becomes the
-<varname>variant_dir</varname>
-argument of
-&f-VariantDir;
-or
-<function>env.VariantDir</function>().
-</para>
-</summary>
-</scons_function>
-
<scons_function name="Builder">
<arguments>
(action, [arguments])
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index eabaddb..0298a69 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -42,7 +42,7 @@ import SCons.Platform
import SCons.SConf
import SCons.Script.Main
import SCons.Tool
-import SCons.Util
+from SCons.Util import is_List, is_String, is_Dict, flatten
from . import Main
@@ -98,7 +98,7 @@ def compute_exports(exports):
retval = {}
try:
for export in exports:
- if SCons.Util.is_Dict(export):
+ if is_Dict(export):
retval.update(export)
else:
try:
@@ -133,7 +133,7 @@ call_stack = []
def Return(*vars, **kw):
retval = []
try:
- fvars = SCons.Util.flatten(vars)
+ fvars = flatten(vars)
for var in fvars:
for v in var.split():
retval.append(call_stack[-1].globals[v])
@@ -420,7 +420,7 @@ class SConsEnvironment(SCons.Environment.Base):
except KeyError:
raise SCons.Errors.UserError("Invalid SConscript usage - no parameters")
- if not SCons.Util.is_List(dirs):
+ if not is_List(dirs):
dirs = [ dirs ]
dirs = list(map(str, dirs))
@@ -441,13 +441,13 @@ class SConsEnvironment(SCons.Environment.Base):
raise SCons.Errors.UserError("Invalid SConscript() usage - too many arguments")
- if not SCons.Util.is_List(files):
+ if not is_List(files):
files = [ files ]
if kw.get('exports'):
exports.extend(self.Split(kw['exports']))
- variant_dir = kw.get('variant_dir') or kw.get('build_dir')
+ variant_dir = kw.get('variant_dir')
if variant_dir:
if len(files) != 1:
raise SCons.Errors.UserError("Invalid SConscript() usage - can only specify one SConscript with a variant_dir")
@@ -577,9 +577,6 @@ class SConsEnvironment(SCons.Environment.Base):
UserError: a script is not found and such exceptions are enabled.
"""
- 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))
@@ -589,15 +586,10 @@ class SConsEnvironment(SCons.Environment.Base):
ls = list(map(subst_element, ls))
subst_kw = {}
for key, val in kw.items():
- if SCons.Util.is_String(val):
+ if is_String(val):
val = self.subst(val)
elif SCons.Util.is_List(val):
- result = []
- for v in val:
- if SCons.Util.is_String(v):
- v = self.subst(v)
- result.append(v)
- val = result
+ val = [self.subst(v) if is_String(v) else v for v in val]
subst_kw[key] = val
files, exports = self._get_SConscript_filenames(ls, subst_kw)
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 24af73e..9947943 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -314,7 +314,6 @@ GlobalDefaultEnvironmentFunctions = [
'AddPreAction',
'Alias',
'AlwaysBuild',
- 'BuildDir',
'CacheDir',
'Clean',
#The Command() method is handled separately, below.
diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py
index cd24b7c..fcec963 100644
--- a/src/engine/SCons/Warnings.py
+++ b/src/engine/SCons/Warnings.py
@@ -120,9 +120,6 @@ class PythonVersionWarning(DeprecatedWarning):
class DeprecatedSourceCodeWarning(FutureDeprecatedWarning):
pass
-class DeprecatedBuildDirWarning(DeprecatedWarning):
- pass
-
class TaskmasterNeedsExecuteWarning(DeprecatedWarning):
pass
@@ -132,12 +129,6 @@ class DeprecatedOptionsWarning(MandatoryDeprecatedWarning):
class DeprecatedDebugOptionsWarning(MandatoryDeprecatedWarning):
pass
-class DeprecatedSigModuleWarning(MandatoryDeprecatedWarning):
- pass
-
-class DeprecatedBuilderKeywordsWarning(MandatoryDeprecatedWarning):
- pass
-
class DeprecatedMissingSConscriptWarning(DeprecatedWarning):
pass
diff --git a/test/Removed/BuildDir/BuildDir.py b/test/Removed/BuildDir/BuildDir.py
new file mode 100644
index 0000000..43c8b8b
--- /dev/null
+++ b/test/Removed/BuildDir/BuildDir.py
@@ -0,0 +1,61 @@
+#!/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 the BuildDir function and method no longer work.
+"""
+
+import TestSCons
+
+_exe = TestSCons._exe
+
+test = TestSCons.TestSCons(match=TestSCons.match_exact)
+
+test.subdir('src')
+
+test.file_fixture('SConstruct.global', 'SConstruct')
+expect = """\
+NameError: name 'BuildDir' is not defined:
+ File "{}", line 1:
+ BuildDir('build', 'src')
+""".format(test.workpath('SConstruct'))
+test.run(arguments='-Q -s', status=2, stderr=expect)
+
+test.file_fixture('SConstruct.method', 'SConstruct')
+expect = """\
+AttributeError: 'SConsEnvironment' object has no attribute 'BuildDir':
+ File "{}", line 3:
+ env.BuildDir('build', 'src')
+""".format(test.workpath('SConstruct'))
+test.run(arguments='-Q -s', status=2, 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/BuildDir.py b/test/Removed/BuildDir/Old/BuildDir.py
index 1a1ba02..1a1ba02 100644
--- a/test/Deprecated/BuildDir.py
+++ b/test/Removed/BuildDir/Old/BuildDir.py
diff --git a/test/Deprecated/SConscript-build_dir.py b/test/Removed/BuildDir/Old/SConscript-build_dir.py
index 0d1ba6a..0d1ba6a 100644
--- a/test/Deprecated/SConscript-build_dir.py
+++ b/test/Removed/BuildDir/Old/SConscript-build_dir.py
diff --git a/test/Removed/BuildDir/Old/sconstest.skip b/test/Removed/BuildDir/Old/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/Removed/BuildDir/Old/sconstest.skip
diff --git a/test/Removed/BuildDir/README.md b/test/Removed/BuildDir/README.md
new file mode 100644
index 0000000..c4fd879
--- /dev/null
+++ b/test/Removed/BuildDir/README.md
@@ -0,0 +1,6 @@
+BuildDir/Old contains old tests which used the now removed BuildDir
+function, env.BuildDir method, and build_dir argument to SConscript,
+preserved here for reference; the presence of an scontest.skip file
+means they are never executed.
+
+The "new" tests verify failure using these symbols.
diff --git a/test/Removed/BuildDir/SConscript-build_dir.py b/test/Removed/BuildDir/SConscript-build_dir.py
new file mode 100644
index 0000000..5a8d1ca
--- /dev/null
+++ b/test/Removed/BuildDir/SConscript-build_dir.py
@@ -0,0 +1,57 @@
+#!/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 specifying a build_dir argument to SConscript no longer works.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons(match = TestSCons.match_exact)
+
+#TODO: fix #3500 and restore test, or drop entirly
+test.skip_test('SConscript() does not error on unknown kwargs, see Issue #3500, skipping test\n')
+
+test.file_fixture('SConstruct.kwarg', 'SConstruct')
+test.subdir('src')
+test.write(['src', 'SConscript'], """
+""")
+
+# this doesn't work yet
+expect = """\
+TypeError: SConscript() got an unexpected keyword argument 'build_dir':
+ File "{}", line 1:
+ SConscript('src/SConscript', build_dir='build')
+""".format(test.workpath('SConstruct'))
+test.run(arguments='-Q -s', status=2, 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/Removed/BuildDir/SConstruct.global b/test/Removed/BuildDir/SConstruct.global
new file mode 100644
index 0000000..086fbae
--- /dev/null
+++ b/test/Removed/BuildDir/SConstruct.global
@@ -0,0 +1 @@
+BuildDir('build', 'src')
diff --git a/test/Removed/BuildDir/SConstruct.kwarg b/test/Removed/BuildDir/SConstruct.kwarg
new file mode 100644
index 0000000..a5c46fb
--- /dev/null
+++ b/test/Removed/BuildDir/SConstruct.kwarg
@@ -0,0 +1 @@
+SConscript('src/SConscript', build_dir='build')
diff --git a/test/Removed/BuildDir/SConstruct.method b/test/Removed/BuildDir/SConstruct.method
new file mode 100644
index 0000000..afea459
--- /dev/null
+++ b/test/Removed/BuildDir/SConstruct.method
@@ -0,0 +1,3 @@
+env = Environment(BUILD='build', SRC='src')
+
+env.BuildDir('build', 'src')