From: Holger Hans Peter Freyther Date: Tue, 7 Mar 2006 20:19:56 +0000 (+0000) Subject: bitbake/lib/bb/data_smart.py,event.py: X-Git-Tag: 1.4.2~77 X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_bitbake;a=commitdiff_plain;h=47c54dc6793f3ba77dfacc8a24dbb91da362cd64 bitbake/lib/bb/data_smart.py,event.py: Use bb.utils.better_compile instead of the simple compile for better error reporting --- diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py index 7417905..bb11a20 100644 --- a/lib/bb/data_smart.py +++ b/lib/bb/data_smart.py @@ -29,7 +29,7 @@ Based on functions from the base bb module, Copyright 2003 Holger Schurig """ import copy, os, re, sys, time, types -from bb import note, debug, fatal +from bb import note, debug, fatal, utils try: import cPickle as pickle @@ -287,8 +287,8 @@ class DataSmartPackage(DataSmart): self.unpickle_prep() funcstr = self.getVar('__functions__', 0) if funcstr: - comp = compile(funcstr, "", "exec") - exec comp in __builtins__ + comp = utils.better_compile(funcstr, "") + utils.better_exec(comp, __builtins__, funcstr, self.bbfile) def linkDataSet(self): if not self.parent == None: diff --git a/lib/bb/event.py b/lib/bb/event.py index 5828081..673f307 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -25,6 +25,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA. import os, re import bb.data +import bb.utils class Event: """Base class for events""" @@ -51,7 +52,7 @@ def tmpHandler(event): def defaultTmpHandler(): tmp = "def tmpHandler(e):\n\t\"\"\"heh\"\"\"\n\treturn NotHandled" - comp = compile(tmp, "tmpHandler(e)", "exec") + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event.defaultTmpHandler") return comp def fire(event): @@ -85,7 +86,7 @@ def _registerCode(handlerStr): the code will be within a function, so should have had appropriate tabbing put in place.""" tmp = "def tmpHandler(e):\n%s" % handlerStr - comp = compile(tmp, "tmpHandler(e)", "exec") + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode") # prevent duplicate registration if not comp in handlers: handlers.append(comp) @@ -103,7 +104,7 @@ def _removeCode(handlerStr): """Remove a 'code' Event handler Deprecated interface; call remove instead.""" tmp = "def tmpHandler(e):\n%s" % handlerStr - comp = compile(tmp, "tmpHandler(e)", "exec") + comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._removeCode") handlers.remove(comp) def getName(e):