summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2006-03-07 20:19:56 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2006-03-07 20:19:56 +0000
commit47c54dc6793f3ba77dfacc8a24dbb91da362cd64 (patch)
treea2063e801a58462b7a969d811f85514bdab46558
parent6a9052244e058ed5b3eef56bb2f65d1aca85c242 (diff)
downloadbitbake-47c54dc6793f3ba77dfacc8a24dbb91da362cd64.tar.gz
bitbake/lib/bb/data_smart.py,event.py:
Use bb.utils.better_compile instead of the simple compile for better error reporting
-rw-r--r--lib/bb/data_smart.py6
-rw-r--r--lib/bb/event.py7
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 741790502..bb11a2027 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, "<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:
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 58280816d..673f307ba 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):