diff options
author | Steven Knight <knight@baldmt.com> | 2004-11-12 01:36:40 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-11-12 01:36:40 (GMT) |
commit | 6490c78eb19131781f133369313dc1a47470e4f0 (patch) | |
tree | b9af8957741845e092043c9b4c264da3a4d1547b /src/engine/SCons/Node/__init__.py | |
parent | d7bc6d2744d598e36b787dd2b2817c5bbe0516bd (diff) | |
download | SCons-6490c78eb19131781f133369313dc1a47470e4f0.zip SCons-6490c78eb19131781f133369313dc1a47470e4f0.tar.gz SCons-6490c78eb19131781f133369313dc1a47470e4f0.tar.bz2 |
On Python 2.x, return lists of Nodes from builders as a NodeList object with a defined __str__ method().
Diffstat (limited to 'src/engine/SCons/Node/__init__.py')
-rw-r--r-- | src/engine/SCons/Node/__init__.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index ef0a096..36b0aed 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -48,6 +48,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import copy import string +import UserList from SCons.Debug import logInstanceCreation import SCons.SConsign @@ -958,6 +959,20 @@ class Node: lines = ["%s:\n" % preamble] + lines return string.join(lines, ' '*11) +l = [1] +ul = UserList.UserList([2]) +try: + l.extend(ul) +except TypeError: + def NodeList(l): + return l +else: + class NodeList(UserList.UserList): + def __str__(self): + return str(map(str, self.data)) +del l +del ul + def get_children(node, parent): return node.children() def ignore_cycle(node, stack): pass def do_nothing(node, parent): pass |