summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-10-21 18:21:55 (GMT)
committerSteven Knight <knight@baldmt.com>2004-10-21 18:21:55 (GMT)
commit29541ca30d8145e5f60e9099ab3e1441a7cf18b5 (patch)
tree57b1361a782ae6024e8105eae28156aa1e944271 /src/engine/SCons
parent4438a7d92b3f72bc79186f9a5e90330ee73e1772 (diff)
downloadSCons-29541ca30d8145e5f60e9099ab3e1441a7cf18b5.zip
SCons-29541ca30d8145e5f60e9099ab3e1441a7cf18b5.tar.gz
SCons-29541ca30d8145e5f60e9099ab3e1441a7cf18b5.tar.bz2
When subst() returns a non-string object, return the object and not a list on 1.5.2.
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Util.py7
-rw-r--r--src/engine/SCons/UtilTests.py6
2 files changed, 7 insertions, 6 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 9f91158..4e81935 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -668,8 +668,8 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, dict=No
result = _dollar_exps.sub(sub_match, args)
except TypeError:
# If the internal conversion routine doesn't return
- # strings (it could be overridden to return Nodes,
- # for example), then the re module will throw this
+ # strings (it could be overridden to return Nodes, for
+ # example), then the 1.5.2 re module will throw this
# exception. Back off to a slower, general-purpose
# algorithm that works for all data types.
args = _separate_args.findall(args)
@@ -679,7 +679,8 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, dict=No
try:
result = string.join(result, '')
except TypeError:
- pass
+ if len(result) == 1:
+ result = result[0]
return result
else:
return self.expand(args, lvars)
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 61142d5..cec89e1 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -457,11 +457,11 @@ class UtilTestCase(unittest.TestCase):
n1 = MyNode('n1')
env = DummyEnv({'NODE' : n1})
node = scons_subst("$NODE", env, mode=SUBST_RAW, conv=s)
- assert node == [n1], node
+ assert node is n1, node
node = scons_subst("$NODE", env, mode=SUBST_CMD, conv=s)
- assert node == [n1], node
+ assert node is n1, node
node = scons_subst("$NODE", env, mode=SUBST_SIG, conv=s)
- assert node == [n1], node
+ assert node is n1, node
# Test returning a function.
#env = DummyEnv({'FUNCTION' : foo})