summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Defaults.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-03-05 08:51:01 (GMT)
committerSteven Knight <knight@baldmt.com>2004-03-05 08:51:01 (GMT)
commitbb42c27bfa1a4208fc3cdc7b583b8093305fc4c0 (patch)
tree40bbe3ce2769d5fc3c9b201a13a59f5c6ebf12e7 /src/engine/SCons/Defaults.py
parentc6a5a383c8771988bc829ef90111afc4db03cc5f (diff)
downloadSCons-bb42c27bfa1a4208fc3cdc7b583b8093305fc4c0.zip
SCons-bb42c27bfa1a4208fc3cdc7b583b8093305fc4c0.tar.gz
SCons-bb42c27bfa1a4208fc3cdc7b583b8093305fc4c0.tar.bz2
Refactor path-substitution logic into an Environment method.
Diffstat (limited to 'src/engine/SCons/Defaults.py')
-rw-r--r--src/engine/SCons/Defaults.py38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index bf6d59f..78103ef 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -147,38 +147,30 @@ def _concat(prefix, list, suffix, env, f=lambda x: x):
if not list:
return list
- if not SCons.Util.is_List(list):
- list = [list]
-
- def subst(x, env = env):
- if SCons.Util.is_String(x):
- return env.subst(x)
- else:
- return x
-
- list = map(subst, list)
-
- list = f(list)
+ list = f(env.subst_path(list))
ret = []
# ensure that prefix and suffix are strings
- prefix = str(prefix)
- suffix = str(suffix)
+ prefix = str(env.subst(prefix, SCons.Util.SUBST_RAW))
+ suffix = str(env.subst(suffix, SCons.Util.SUBST_RAW))
for x in list:
x = str(x)
- if prefix and prefix[-1] == ' ':
- ret.append(prefix[:-1])
- ret.append(x)
- else:
- ret.append(prefix+x)
+ if prefix:
+ if prefix[-1] == ' ':
+ ret.append(prefix[:-1])
+ elif x[:len(prefix)] != prefix:
+ x = prefix + x
- if suffix and suffix[0] == ' ':
- ret.append(suffix[1:])
- else:
- ret[-1] = ret[-1]+suffix
+ ret.append(x)
+
+ if suffix:
+ if suffix[0] == ' ':
+ ret.append(suffix[1:])
+ elif x[-len(suffix):] != suffix:
+ ret[-1] = ret[-1]+suffix
return ret