Fix a new variable expansion bug.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 4 Feb 2004 07:43:14 +0000 (07:43 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 4 Feb 2004 07:43:14 +0000 (07:43 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@889 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Util.py
src/engine/SCons/UtilTests.py

index 6d95a4e27ef51b8f58f0f1504f6af877694d4b65..594274a536364fbfc13fa05dc54def1479869afd 100644 (file)
@@ -718,7 +718,9 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, di
                      env=self.env,
                      for_signature=(self.mode != SUBST_CMD))
                 self.substitute(s, lvars, within_list)
-            elif not s is None:
+            elif s is None:
+                self.this_word()
+            else:
                 self.append(s)
 
         def substitute(self, args, lvars, within_list):
@@ -758,7 +760,10 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, di
 
         def add_to_current_word(self, x):
             if not self.in_strip or self.mode != SUBST_SIG:
-                self[-1][-1] = self[-1][-1] + x
+                try:
+                    self[-1][-1] = self[-1][-1] + x
+                except IndexError:
+                    self.add_new_word(x)
         def add_new_word(self, x):
             if not self.in_strip or self.mode != SUBST_SIG:
                 try:
index fb4ec09fdc5f89f564a369f461da80b40979df35..646894966cf242e8f9028de06609f7ec65a32c85 100644 (file)
@@ -296,6 +296,9 @@ class UtilTestCase(unittest.TestCase):
 
             # Test function calls within ${}.
             '$FUNCCALL',            'a xc b',
+
+            # Bug reported by Christoph Wiedemann.
+            '$xxx/bin',             '/bin',
         ]
 
         kwargs = {'target' : target, 'source' : source}
@@ -609,6 +612,9 @@ class UtilTestCase(unittest.TestCase):
             'foo\n\nbar',           [['foo'], ['bar']],
             'foo \n \n bar',        [['foo'], ['bar']],
             'foo \nmiddle\n bar',   [['foo'], ['middle'], ['bar']],
+
+            # Bug reported by Christoph Wiedemann.
+            '$xxx/bin',             [['/bin']],
         ]
 
         kwargs = {'target' : target, 'source' : source}