else:
return self.entries['..'].root()
+ def children(self):
+ return map(lambda x, s=self: s.entries[x],
+ filter(lambda k: k != '.' and k != '..',
+ self.entries.keys()))
+
# XXX TODO?
# rfile
except:
raise
+ # Test Dir.children()
+ dir = fs.Dir('ddd')
+ fs.File('ddd/f1')
+ fs.File('ddd/f2')
+ fs.File('ddd/f3')
+ fs.Dir('ddd/d1')
+ fs.Dir('ddd/d1/f4')
+ fs.Dir('ddd/d1/f5')
+ kids = map(lambda x: x.path, dir.children())
+ kids.sort()
+ assert kids == ['ddd/d1/', 'ddd/f1', 'ddd/f2', 'ddd/f3']
+
# Test for sub-classing of node building.
global built_it
node.add_source(['two', 'three'])
assert node.sources == ['one', 'two', 'three']
+ def test_children(self):
+ """Test fetching the "children" of a Node.
+ """
+ node = SCons.Node.Node()
+ node.add_source(['one', 'two', 'three'])
+ node.add_dependency(['four', 'five', 'six'])
+ kids = node.children()
+ kids.sort()
+ print kids
+ assert kids == ['five', 'four', 'one', 'six', 'three', 'two']
+
if __name__ == "__main__":
if type(source) is not type([]):
raise TypeError("source must be a list")
self.sources.extend(source)
+
+ def children(self):
+ return self.sources + self.depends