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>
This commit is contained in:
Chris Larson 2010-06-16 06:53:24 -07:00 committed by Richard Purdie
parent 6be4fa575a
commit 56f083ad13
1 changed files with 7 additions and 10 deletions

View File

@ -24,9 +24,11 @@
from __future__ import print_function from __future__ import print_function
import sys, os, glob, os.path, re, time import sys, os, glob, os.path, re, time
import sre_constants
from cStringIO import StringIO
from contextlib import closing
import bb import bb
from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
import sre_constants
class MultipleMatches(Exception): class MultipleMatches(Exception):
""" """
@ -267,20 +269,15 @@ class BBCooker:
bb.msg.error(bb.msg.domain.Parsing, "%s" % e) bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
raise raise
class dummywrite:
def __init__(self):
self.writebuf = ""
def write(self, output):
self.writebuf = self.writebuf + output
# emit variables and shell functions # emit variables and shell functions
try: try:
data.update_data(envdata) data.update_data(envdata)
wb = dummywrite() with closing(StringIO()) as env:
data.emit_env(wb, envdata, True) data.emit_env(env, envdata, True)
bb.msg.plain(wb.writebuf) bb.msg.plain(env.getvalue())
except Exception, e: except Exception, e:
bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
# emit the metadata which isnt valid shell # emit the metadata which isnt valid shell
data.expandKeys(envdata) data.expandKeys(envdata)
for e in envdata.keys(): for e in envdata.keys():