From: stevenknight Date: Fri, 30 Jul 2004 17:10:08 +0000 (+0000) Subject: Ignore null tools. (Gary Oberbrunner) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5c3ac4a80a1aa51b4c95ae47334cc9fda0f9c3f0;p=scons.git Ignore null tools. (Gary Oberbrunner) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1015 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 080232ab..0e79eb4d 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -115,6 +115,8 @@ def our_deepcopy(x): def apply_tools(env, tools, toolpath): if tools: + # Filter out null tools from the list. + tools = filter(None, tools) for tool in tools: if SCons.Util.is_String(tool): env.Tool(tool, toolpath) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 8ac43cb9..c65fb031 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -866,6 +866,23 @@ class EnvironmentTestCase(unittest.TestCase): finally: SCons.Defaults.ConstructionEnvironment = save + def test_null_tools(self): + """Test specifying a tool of None is OK.""" + def t1(env): + env['TOOL1'] = 111 + def t2(env): + env['TOOL2'] = 222 + env = Environment(tools = [t1, None, t2], XYZ = 'aaa') + assert env['TOOL1'] == 111, env['TOOL1'] + assert env['TOOL2'] == 222, env + assert env['XYZ'] == 'aaa', env + env = Environment(tools = [None], XYZ = 'xyz') + assert env['XYZ'] == 'xyz', env + env = Environment(tools = [t1, '', t2], XYZ = 'ddd') + assert env['TOOL1'] == 111, env['TOOL1'] + assert env['TOOL2'] == 222, env + assert env['XYZ'] == 'ddd', env + def test_concat(self): "Test _concat()" e1 = Environment(PRE='pre', SUF='suf', STR='a b', LIST=['a', 'b'])