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
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):
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__":