From f85710849bf8724bc675ebe5844b1fedbdabb668 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Fri, 30 Jul 2004 17:43:29 +0000 Subject: [PATCH] Fix null entries in CPPPATH. (Gary Oberbrunner) git-svn-id: http://scons.tigris.org/svn/scons/trunk@1016 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 3 +++ src/engine/SCons/Node/FS.py | 2 +- src/engine/SCons/Node/FSTests.py | 9 +++++++++ test/CPPPATH.py | 14 ++++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 11532e63..32d03c58 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -183,6 +183,9 @@ RELEASE 0.96 - XXX file basename. This supports version numbers as part of shared library names, for example. + - Avoid problems when there are null entries (None or '') in tool + lists or CPPPATH. + From Simon Perkins: - Fix a bug introduced in building shared libraries under MinGW. diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 31d89461..e66a50d0 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1035,7 +1035,7 @@ class FS(LocalFS): pathlist = string.split(pathlist, os.pathsep) if not SCons.Util.is_List(pathlist): pathlist = [pathlist] - for path in pathlist: + for path in filter(None, pathlist): if isinstance(path, SCons.Node.Node): ret.append(path) else: diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index c5d064d4..aba34811 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1292,6 +1292,15 @@ class RepositoryTestCase(unittest.TestCase): list = map(str, fs.Rsearchall(['d3', work_d4])) assert list == ['d3', str(work_d4)], list + list = fs.Rsearchall('') + assert list == [], list + + list = fs.Rsearchall([None]) + assert list == [], list + + list = fs.Rsearchall(['']) + assert list == [], list + fs.BuildDir('build', '.') f = fs.File(test.workpath("work", "i_do_not_exist")) diff --git a/test/CPPPATH.py b/test/CPPPATH.py index cb6969ec..05a61e81 100644 --- a/test/CPPPATH.py +++ b/test/CPPPATH.py @@ -194,14 +194,20 @@ test.run(program = test.workpath(variant_prog), test.up_to_date(arguments = args) -# Check that a null-string CPPPATH doesn't blow up. +# Check that neither a null-string CPPPATH nor a +# a CPPPATH containing null values blows up. test.write('SConstruct', """ env = Environment(CPPPATH = '') -env.Library('foo', source = 'empty.c') +env.Library('one', source = 'empty1.c') +env = Environment(CPPPATH = [None]) +env.Library('two', source = 'empty2.c') +env = Environment(CPPPATH = ['']) +env.Library('three', source = 'empty3.c') """) -test.write('empty.c', """ -""") +test.write('empty1.c', "\n") +test.write('empty2.c', "\n") +test.write('empty3.c', "\n") test.run(arguments = '.', stderr=TestSCons.noisy_ar, -- 2.26.2