If the value of a is None, interpolate '', not 'None'.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 18 Oct 2001 03:01:47 +0000 (03:01 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 18 Oct 2001 03:01:47 +0000 (03:01 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@104 fdb21ef1-2011-0410-befe-b5e4ea1792b1

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

index 00a833010ae6b1379cb9f38b93e8d611732fbf5b..64930b0a790c721e66f7c8fc1d0483b01dc89362 100644 (file)
@@ -177,7 +177,11 @@ def scons_subst(string, locals, globals):
         if key[:1] == '{' and key[-1:] == '}':
             key = key[1:-1]
        try:
-           s = str(eval(key, locals, globals))
+            e = eval(key, locals, globals)
+            if e is None:
+                s = ''
+            else:
+                s = str(e)
        except NameError:
            s = ''
        return s
index 7df0c83b1dab3aa58da22a3403bd776ce0b8f25c..f8829da95d87988d31bff220af5d539bd4e4beae 100644 (file)
@@ -84,6 +84,7 @@ class UtilTestCase(unittest.TestCase):
         loc['sources'] = PathList(map(os.path.normpath, [ "./foo/blah.cpp",
                                                           "/bar/ack.cpp",
                                                           "../foo/ack.c" ]))
+        loc['xxx'] = None
 
         if os.sep == '/':
             def cvt(str):
@@ -123,6 +124,9 @@ class UtilTestCase(unittest.TestCase):
         newcom = scons_subst("test ${target.dir}", loc, {})
         assert newcom == cvt("test foo")
 
+        newcom = scons_subst("test $xxx", loc, {})
+        assert newcom == cvt("test "), newcom
+
 
 
 if __name__ == "__main__":