diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-06-16 06:53:24 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:36 +0100 |
commit | 56f083ad1354a2b225e602b823cbd2f72335858e (patch) | |
tree | 4f919875337548a355de078f3b91e275dfb322c3 /bitbake/lib | |
parent | 6be4fa575a36c6c1cd3cb933fafd51dd3bd90c71 (diff) | |
download | poky-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.py | 17 |
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 | ||
25 | from __future__ import print_function | 25 | from __future__ import print_function |
26 | import sys, os, glob, os.path, re, time | 26 | import sys, os, glob, os.path, re, time |
27 | import sre_constants | ||
28 | from cStringIO import StringIO | ||
29 | from contextlib import closing | ||
27 | import bb | 30 | import bb |
28 | from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue | 31 | from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue |
29 | import sre_constants | ||
30 | 32 | ||
31 | class MultipleMatches(Exception): | 33 | class 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(): |