diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-04-20 13:51:35 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:34 +0100 |
commit | 9d3f301423090cb27a495e808323a804d1740a90 (patch) | |
tree | d72122184046fa547404fe8905924defda7c55a2 /bitbake/lib/bb/data.py | |
parent | 6f5206184439941418584b65dd86cec6b859d39f (diff) | |
download | poky-9d3f301423090cb27a495e808323a804d1740a90.tar.gz |
emit_env: clean up, iterate once
(Bitbake rev: db718ec6f67c7c0d0efb4ba0b5b24384f707dcf5)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/data.py')
-rw-r--r-- | bitbake/lib/bb/data.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index ba496c9d93..3ff1ac8119 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -43,6 +43,7 @@ if sys.argv[0][-5:] == "pydoc": | |||
43 | else: | 43 | else: |
44 | path = os.path.dirname(os.path.dirname(sys.argv[0])) | 44 | path = os.path.dirname(os.path.dirname(sys.argv[0])) |
45 | sys.path.insert(0, path) | 45 | sys.path.insert(0, path) |
46 | from itertools import groupby | ||
46 | 47 | ||
47 | from bb import data_smart | 48 | from bb import data_smart |
48 | import bb | 49 | import bb |
@@ -226,17 +227,12 @@ def emit_var(var, o=sys.__stdout__, d = init(), all=False): | |||
226 | def emit_env(o=sys.__stdout__, d = init(), all=False): | 227 | def emit_env(o=sys.__stdout__, d = init(), all=False): |
227 | """Emits all items in the data store in a format such that it can be sourced by a shell.""" | 228 | """Emits all items in the data store in a format such that it can be sourced by a shell.""" |
228 | 229 | ||
229 | env = keys(d) | 230 | isfunc = lambda key: bool(d.getVarFlag(key, "func")) |
230 | 231 | keys = sorted(d.keys(), key=isfunc) | |
231 | for e in env: | 232 | grouped = groupby(keys, isfunc) |
232 | if getVarFlag(e, "func", d): | 233 | for isfunc, keys in grouped: |
233 | continue | 234 | for key in keys: |
234 | emit_var(e, o, d, all) and o.write('\n') | 235 | emit_var(key, o, d, all and not isfunc) and o.write('\n') |
235 | |||
236 | for e in env: | ||
237 | if not getVarFlag(e, "func", d): | ||
238 | continue | ||
239 | emit_var(e, o, d) and o.write('\n') | ||
240 | 236 | ||
241 | def update_data(d): | 237 | def update_data(d): |
242 | """Performs final steps upon the datastore, including application of overrides""" | 238 | """Performs final steps upon the datastore, including application of overrides""" |