From: stevenknight Date: Thu, 6 Jun 2002 14:46:22 +0000 (+0000) Subject: Fix SConsignEntry.set_implicit() to handle null strings, too. (Jeff Petkau) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=18cd3af71b9f25faa3fe71e34929bd3b5acb57dd;p=scons.git Fix SConsignEntry.set_implicit() to handle null strings, too. (Jeff Petkau) git-svn-id: http://scons.tigris.org/svn/scons/trunk@385 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/engine/SCons/Sig/SigTests.py b/src/engine/SCons/Sig/SigTests.py index 7931947e..365a0d6f 100644 --- a/src/engine/SCons/Sig/SigTests.py +++ b/src/engine/SCons/Sig/SigTests.py @@ -502,6 +502,27 @@ class SConsignEntryTestCase(unittest.TestCase): assert e.get_implicit() == [] assert e.render(m) == "987 654 321 " # note trailing space + e.set_implicit(None) + assert e.get_implicit() == None, e.get_implicit() + + e.set_implicit('') + assert e.get_implicit() == [], e.get_implicit() + + e.set_implicit('foo') + assert e.get_implicit() == ['foo'], e.get_implicit() + + e.set_implicit('foo bar') + assert e.get_implicit() == ['foo bar'], e.get_implicit() + + e.set_implicit(['foo']) + assert e.get_implicit() == ['foo'], e.get_implicit() + + e.set_implicit(['foo bar']) + assert e.get_implicit() == ['foo bar'], e.get_implicit() + + e.set_implicit(['foo', 'bar']) + assert e.get_implicit() == ['foo', 'bar'], e.get_implicit() + class SConsignFileTestCase(unittest.TestCase): def runTest(self): diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index a13557af..c97f81e7 100644 --- a/src/engine/SCons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -91,9 +91,11 @@ class SConsignEntry: return string.split(self.implicit, '\0') def set_implicit(self, implicit): - if not implicit: + if implicit is None: self.implicit = None else: + if SCons.Util.is_String(implicit): + implicit = [implicit] self.implicit = string.join(map(str, implicit), '\0')