diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-02-26 11:07:47 +0000 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2006-02-26 11:07:47 +0000 |
commit | 4f807c93f8f72eb73b8600d1f73a3e26014a3167 (patch) | |
tree | 7e1d0b5a52c45081238da4c067e9c462a20a7198 /lib/bb/build.py | |
parent | 7dc97df197bde5dde7fffad737f493b0cb94c576 (diff) | |
download | bitbake-4f807c93f8f72eb73b8600d1f73a3e26014a3167.tar.gz |
bitbake/parser,build,utils:
We compile strings into code. In case of erros the traceback
is not useful at all. It doesn't print the function name,
accurate line number etc.
Introduce a better_compile method that excepts the Error
and prints the surrounding lines of code.
We make use of it on the parsing level and execution level
of python methods.
Diffstat (limited to 'lib/bb/build.py')
-rw-r--r-- | lib/bb/build.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py index 599b45d9d..5a72be73b 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License along with Based on functions from the base bb module, Copyright 2003 Holger Schurig """ -from bb import debug, data, fetch, fatal, error, note, event, mkdirhier +from bb import debug, data, fetch, fatal, error, note, event, mkdirhier, utils import bb, os # data holds flags and function name for a given task @@ -122,8 +122,9 @@ def exec_func_python(func, d): """Execute a python BB 'function'""" import re, os - tmp = "def " + func + "():\n%s" % data.getVar(func, d) - comp = compile(tmp + '\n' + func + '()', bb.data.getVar('FILE', d, 1) + ':' + func, "exec") + tmp = "def " + func + "():\n%s" % data.getVar(func, d) + tmp += '\n' + func + '()' + comp = utils.better_compile(tmp, func, bb.data.getVar('FILE', d, 1) ) prevdir = os.getcwd() g = {} # globals g['bb'] = bb |