diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-06-16 06:53:24 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-06-16 10:27:41 -0700 |
commit | f5b7e16adf86950d91a88a343031e71beb0f08a6 (patch) | |
tree | 6bbd82ccc472c081067090107f56acc14fc29eac /lib | |
parent | e3cc9bc7b6ef1a2eca78235790a051329bceb9a4 (diff) | |
download | bitbake-f5b7e16adf86950d91a88a343031e71beb0f08a6.tar.gz |
Switch from our own 'dummywrite' class to StringIO
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bb/cooker.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 3657cd1d2..785e64115 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -24,9 +24,11 @@ from __future__ import print_function import sys, os, glob, os.path, re, time +import sre_constants +from cStringIO import StringIO +from contextlib import closing import bb from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue -import sre_constants class MultipleMatches(Exception): """ @@ -278,20 +280,15 @@ class BBCooker: bb.msg.error(bb.msg.domain.Parsing, "%s" % e) raise - class dummywrite: - def __init__(self): - self.writebuf = "" - def write(self, output): - self.writebuf = self.writebuf + output - # emit variables and shell functions try: data.update_data(envdata) - wb = dummywrite() - data.emit_env(wb, envdata, True) - bb.msg.plain(wb.writebuf) + with closing(StringIO()) as env: + data.emit_env(env, envdata, True) + bb.msg.plain(env.getvalue()) except Exception, e: bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) + # emit the metadata which isnt valid shell data.expandKeys(envdata) for e in envdata.keys(): |