diff options
author | Steven Knight <knight@baldmt.com> | 2002-03-08 18:22:23 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-03-08 18:22:23 (GMT) |
commit | 952df96acecd62355d351976be1384f4e7d4bc17 (patch) | |
tree | 51d74795fee1d0bc29c896eba7a6213360c93586 /src/engine | |
parent | bd1384bd791e94dd5191f50d92850e857a987d08 (diff) | |
download | SCons-952df96acecd62355d351976be1384f4e7d4bc17.zip SCons-952df96acecd62355d351976be1384f4e7d4bc17.tar.gz SCons-952df96acecd62355d351976be1384f4e7d4bc17.tar.bz2 |
Fix an exception caused by a null-string CPPPATH.
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Util.py | 25 | ||||
-rw-r--r-- | src/engine/SCons/UtilTests.py | 6 |
2 files changed, 22 insertions, 9 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 038468f..2202abd 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -306,7 +306,12 @@ class VarInterpolator: if not dict.has_key(self.src): dict[self.dest] = '' return - src = self.prepareSrc(dict) + + src = filter(lambda x: not x is None, self.prepareSrc(dict)) + + if not src: + dict[self.dest] = '' + return try: prefix = str(dict[self.prefix]) @@ -345,16 +350,18 @@ class DirVarInterp(VarInterpolator): self.fs = None self.Dir = None self.dictInstCache = {} - + def prepareSrc(self, dict): src = VarInterpolator.prepareSrc(self, dict) - - def prepare(x, self=self): - if not isinstance(x, SCons.Node.Node): - return self.fs.Dir(str(x), directory=self.dir) - else: - return x - + + def prepare(x, self=self): + if isinstance(x, SCons.Node.Node): + return x + elif str(x): + return self.fs.Dir(str(x), directory=self.dir) + else: + return None + return map(prepare, src) def instance(self, dir, fs): diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py index 0e9f7b5..bcb93d0 100644 --- a/src/engine/SCons/UtilTests.py +++ b/src/engine/SCons/UtilTests.py @@ -242,6 +242,12 @@ class UtilTestCase(unittest.TestCase): assert dict['_INCFLAGS'][7] == '$)', \ dict['_INCFLAGS'][7] + dict = {'CPPPATH' : '', + 'LIBPATH' : '' } + autogenerate(dict, dir = SCons.Node.FS.default_fs.Dir('/yy')) + assert len(dict['_INCFLAGS']) == 0, dict['_INCFLAGS'] + assert len(dict['_LIBDIRFLAGS']) == 0, dict['_LIBDIRFLAGS'] + def test_render_tree(self): class Node: def __init__(self, name, children=[]): |