summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/PathList.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/PathList.py')
-rw-r--r--src/engine/SCons/PathList.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py
index 81b8135..943e9ad 100644
--- a/src/engine/SCons/PathList.py
+++ b/src/engine/SCons/PathList.py
@@ -36,6 +36,7 @@ import os
import string
import SCons.Memoize
+import SCons.Node
import SCons.Util
#
@@ -58,10 +59,13 @@ def node_conv(obj):
try:
get = obj.get
except AttributeError:
- pass
+ if isinstance(obj, SCons.Node.Node):
+ result = obj
+ else:
+ result = str(obj)
else:
- obj = get()
- return obj
+ result = get()
+ return result
class _PathList:
"""
@@ -95,9 +99,7 @@ class _PathList:
"""
if SCons.Util.is_String(pathlist):
pathlist = string.split(pathlist, os.pathsep)
- elif SCons.Util.is_List(pathlist) or SCons.Util.is_Tuple(pathlist):
- pathlist = SCons.Util.flatten(pathlist)
- else:
+ elif not SCons.Util.is_Sequence(pathlist):
pathlist = [pathlist]
pl = []
@@ -129,6 +131,11 @@ class _PathList:
if type == TYPE_STRING_SUBST:
value = env.subst(value, target=target, source=source,
conv=node_conv)
+ if SCons.Util.is_Sequence(value):
+ # It came back as a string or tuple, which in this
+ # case usually means some variable expanded to an
+ # actually Dir node. Concatenate the values.
+ value = string.join(map(str, value), '')
elif type == TYPE_OBJECT:
value = node_conv(value)
result.append(value)
@@ -175,18 +182,19 @@ class PathListCache:
"""
Returns the key for memoization of PathLists.
- Note that we want this to be quick, so we don't canonicalize
- all forms of the same list. For example, 'x:y' and ['x', 'y']
- logically represent the same list, but we're not going to bother
- massaging strings into canonical lists here.
-
- The reason
-
+ Note that we want this to be pretty quick, so we don't completely
+ canonicalize all forms of the same list. For example,
+ 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically
+ represent the same list if you're executing from $ROOT, but
+ we're not going to bother splitting strings into path elements,
+ or massaging strings into Nodes, to identify that equivalence.
+ We just want to eliminate obvious redundancy from the normal
+ case of re-using exactly the same cloned value for a path.
"""
- if SCons.Util.is_List(pathlist):
- pathlist = tuple(pathlist)
+ if SCons.Util.is_Sequence(pathlist):
+ pathlist = tuple(SCons.Util.flatten(pathlist))
return pathlist
-
+
memoizer_counters.append(SCons.Memoize.CountDict('PathList', _PathList_key))
def PathList(self, pathlist):