summaryrefslogtreecommitdiffstats
path: root/base/util.py
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-07 11:17:39 -0500
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-07 11:17:39 -0500
commita7bcebe96bd00388fea1c2cf01e0691534f61744 (patch)
tree570d9309f5e3913d0bbcb2d671284b119e848750 /base/util.py
parent79577f7d35ba8cff9ba7a1f97d8bae8bab1b001f (diff)
downloadfedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.tar.gz
fedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.tar.xz
fedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.zip
Fixed some bugs in the builder
Diffstat (limited to 'base/util.py')
-rw-r--r--base/util.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/util.py b/base/util.py
index 5b68c3b..0d4723c 100644
--- a/base/util.py
+++ b/base/util.py
@@ -82,5 +82,19 @@ def one(l, f):
if f(x):
return x
+def isiter(i):
+ return hasattr(i, '__iter__')
+
+def flatten(l):
+ acc = []
+ def _flatten(acc, i):
+ if isiter(i):
+ for x in i:
+ _flatten(acc, x)
+ else:
+ acc.append(i)
+ _flatten(acc, l)
+ return acc
+
__all__ = ['pwd', 'copy', 'with_sudo', 'with_su', 'symlink', 'move',
'log_file', 'one']