summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-10-18 03:01:47 (GMT)
committerSteven Knight <knight@baldmt.com>2001-10-18 03:01:47 (GMT)
commit908b74a3a3ecba5eccc6fd1f844505050d9dad2f (patch)
tree2fd22bcf9c45ebe46fa1243a5521b1eebfe0b671 /src/engine
parent7e9fb5fbaff292e66d396b08c0da6dc65e94487d (diff)
downloadSCons-908b74a3a3ecba5eccc6fd1f844505050d9dad2f.zip
SCons-908b74a3a3ecba5eccc6fd1f844505050d9dad2f.tar.gz
SCons-908b74a3a3ecba5eccc6fd1f844505050d9dad2f.tar.bz2
If the value of a is None, interpolate '', not 'None'.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Util.py6
-rw-r--r--src/engine/SCons/UtilTests.py4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 00a8330..64930b0 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -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
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 7df0c83..f8829da 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -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__":