bitbake/lib/bb/data_smart.py,event.py:
authorHolger Hans Peter Freyther <zecke@selfish.org>
Tue, 7 Mar 2006 20:19:56 +0000 (20:19 +0000)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Tue, 7 Mar 2006 20:19:56 +0000 (20:19 +0000)
    Use bb.utils.better_compile instead of
    the simple compile for better error
    reporting

lib/bb/data_smart.py
lib/bb/event.py

index 7417905..bb11a20 100644 (file)
@@ -29,7 +29,7 @@ Based on functions from the base bb module, Copyright 2003 Holger Schurig
 """
 
 import copy, os, re, sys, time, types
 """
 
 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
 
 try:
     import cPickle as pickle
@@ -287,8 +287,8 @@ class DataSmartPackage(DataSmart):
         self.unpickle_prep()
         funcstr = self.getVar('__functions__', 0)
         if funcstr:
         self.unpickle_prep()
         funcstr = self.getVar('__functions__', 0)
         if funcstr:
-            comp = compile(funcstr, "<pickled>", "exec")
-            exec comp in  __builtins__
+            comp = utils.better_compile(funcstr, "<pickled>")
+            utils.better_exec(comp, __builtins__, funcstr, self.bbfile)
 
     def linkDataSet(self):
         if not self.parent == None:
 
     def linkDataSet(self):
         if not self.parent == None:
index 5828081..673f307 100644 (file)
@@ -25,6 +25,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA.
 
 import os, re
 import bb.data
 
 import os, re
 import bb.data
+import bb.utils
 
 class Event:
     """Base class for events"""
 
 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"
 
 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):
     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
        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)
 #   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
     """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):
     handlers.remove(comp)
 
 def getName(e):