diff options
author | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2009-01-07 11:17:39 -0500 |
---|---|---|
committer | Yaakov M. Nemoy <loupgaroublond@gmail.com> | 2009-01-07 11:17:39 -0500 |
commit | a7bcebe96bd00388fea1c2cf01e0691534f61744 (patch) | |
tree | 570d9309f5e3913d0bbcb2d671284b119e848750 /base | |
parent | 79577f7d35ba8cff9ba7a1f97d8bae8bab1b001f (diff) | |
download | fedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.tar.gz fedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.tar.xz fedora-devshell-a7bcebe96bd00388fea1c2cf01e0691534f61744.zip |
Fixed some bugs in the builder
Diffstat (limited to 'base')
-rw-r--r-- | base/profiles.py | 6 | ||||
-rw-r--r-- | base/util.py | 14 |
2 files changed, 18 insertions, 2 deletions
diff --git a/base/profiles.py b/base/profiles.py index 83bfe25..667dcf6 100644 --- a/base/profiles.py +++ b/base/profiles.py @@ -19,7 +19,9 @@ from os.path import join from subprocess import Popen, PIPE +from base import log from vars import FEDORA_DIR +from util import flatten TARGET = 0 DIST = 1 @@ -30,10 +32,10 @@ def distdef(dist): return dist.replace('.', '') def define(key, value): - return '--define "%s %s"' % (key, value) + return ['-D', '%s %s' % (key, value)] def join_defines(*defines): - return " ".join(defines) + return flatten(defines) def dist_defines(dist, distvar, distval): dist = define('dist', dist) 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'] |