diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-03-31 08:52:41 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:31 +0100 |
| commit | 3995546222c18e5c3ca2d43a843b051e7107ce1c (patch) | |
| tree | 6d18a009c9fad9949542eb659bd9cb955e65a441 | |
| parent | 94b60d1247be4ce42eaefafe13e73169bd978bd7 (diff) | |
| download | poky-3995546222c18e5c3ca2d43a843b051e7107ce1c.tar.gz | |
Add & utilize a simple_exec utility function
(Bitbake rev: 5ead16f14f996bcbb2fb14277b8ce5a9317b8160)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
| -rw-r--r-- | bitbake/lib/bb/event.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/bb/utils.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 8559858f04..f49f71cf71 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
| @@ -58,7 +58,7 @@ def fire_class_handlers(event, d): | |||
| 58 | event.data = d | 58 | event.data = d |
| 59 | if type(h).__name__ == "code": | 59 | if type(h).__name__ == "code": |
| 60 | locals = {"e": event} | 60 | locals = {"e": event} |
| 61 | exec h in bb.utils._context, locals | 61 | bb.utils.simple_exec(h, locals) |
| 62 | bb.utils.better_eval("tmpHandler(e)", locals) | 62 | bb.utils.better_eval("tmpHandler(e)", locals) |
| 63 | else: | 63 | else: |
| 64 | h(event) | 64 | h(event) |
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 50e9402a2b..2e3937ec12 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
| @@ -222,6 +222,9 @@ def better_exec(code, context, text, realfile): | |||
| 222 | 222 | ||
| 223 | raise | 223 | raise |
| 224 | 224 | ||
| 225 | def simple_exec(code, context): | ||
| 226 | exec code in _context, context | ||
| 227 | |||
| 225 | def better_eval(source, locals): | 228 | def better_eval(source, locals): |
| 226 | return eval(source, _context, locals) | 229 | return eval(source, _context, locals) |
| 227 | 230 | ||
