summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-16 06:53:24 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:36 +0100
commit56f083ad1354a2b225e602b823cbd2f72335858e (patch)
tree4f919875337548a355de078f3b91e275dfb322c3 /bitbake/lib
parent6be4fa575a36c6c1cd3cb933fafd51dd3bd90c71 (diff)
downloadpoky-56f083ad1354a2b225e602b823cbd2f72335858e.tar.gz
Switch from our own 'dummywrite' class to StringIO
(Bitbake rev: f5b7e16adf86950d91a88a343031e71beb0f08a6) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/cooker.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 8f79c4f72c..fd59f05232 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -24,9 +24,11 @@
24 24
25from __future__ import print_function 25from __future__ import print_function
26import sys, os, glob, os.path, re, time 26import sys, os, glob, os.path, re, time
27import sre_constants
28from cStringIO import StringIO
29from contextlib import closing
27import bb 30import bb
28from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue 31from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
29import sre_constants
30 32
31class MultipleMatches(Exception): 33class MultipleMatches(Exception):
32 """ 34 """
@@ -267,20 +269,15 @@ class BBCooker:
267 bb.msg.error(bb.msg.domain.Parsing, "%s" % e) 269 bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
268 raise 270 raise
269 271
270 class dummywrite:
271 def __init__(self):
272 self.writebuf = ""
273 def write(self, output):
274 self.writebuf = self.writebuf + output
275
276 # emit variables and shell functions 272 # emit variables and shell functions
277 try: 273 try:
278 data.update_data(envdata) 274 data.update_data(envdata)
279 wb = dummywrite() 275 with closing(StringIO()) as env:
280 data.emit_env(wb, envdata, True) 276 data.emit_env(env, envdata, True)
281 bb.msg.plain(wb.writebuf) 277 bb.msg.plain(env.getvalue())
282 except Exception, e: 278 except Exception, e:
283 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) 279 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
280
284 # emit the metadata which isnt valid shell 281 # emit the metadata which isnt valid shell
285 data.expandKeys(envdata) 282 data.expandKeys(envdata)
286 for e in envdata.keys(): 283 for e in envdata.keys():