summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Util.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-08-05 20:00:20 (GMT)
committerSteven Knight <knight@baldmt.com>2004-08-05 20:00:20 (GMT)
commit42629fe85a87b728d01c67e65bdbfde310744c63 (patch)
treef96bca18fdb063488c45f340ecf9a8d02902071f /src/engine/SCons/Util.py
parentd7289a48cb622e56d940fc21c67ee6947a4d5ae1 (diff)
downloadSCons-42629fe85a87b728d01c67e65bdbfde310744c63.zip
SCons-42629fe85a87b728d01c67e65bdbfde310744c63.tar.gz
SCons-42629fe85a87b728d01c67e65bdbfde310744c63.tar.bz2
Return lists of Nodes from all builders, not single Nodes when there's only one.
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r--src/engine/SCons/Util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 261d73c..25cea2f 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -953,6 +953,19 @@ else:
def is_String(e):
return type(e) is types.StringType or isinstance(e, UserString)
+def is_Scalar(e):
+ return is_String(e) or not is_List(e)
+
+def flatten(sequence, scalarp=is_Scalar, result=None):
+ if result is None:
+ result = []
+ for item in sequence:
+ if scalarp(item):
+ result.append(item)
+ else:
+ flatten(item, scalarp, result)
+ return result
+
class Proxy:
"""A simple generic Proxy class, forwarding all calls to
subject. So, for the benefit of the python newbie, what does