diff options
author | Phil Blundell <philb@gnu.org> | 2004-07-22 14:35:49 +0000 |
---|---|---|
committer | Phil Blundell <philb@gnu.org> | 2004-07-22 14:35:49 +0000 |
commit | e17c43afa5ae589afea2ce467f8cf2edd82f8ca3 (patch) | |
tree | 4c8e182e55d4f31744e3d4d029c5761a810e8237 /bin | |
parent | 3cb8d3c07205368095bb1391fb903c0108aea0f1 (diff) | |
download | bitbake-e17c43afa5ae589afea2ce467f8cf2edd82f8ca3.tar.gz |
improve diagnostics when bad things happen during expansion
Diffstat (limited to 'bin')
-rw-r--r-- | bin/oe/data.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/bin/oe/data.py b/bin/oe/data.py index 9853ec161..ccfaa9a3f 100644 --- a/bin/oe/data.py +++ b/bin/oe/data.py @@ -212,14 +212,10 @@ def expand(s, d = _data, varname = None): return match.group() def python_sub(match): - code = match.group()[3:-1] import oe + code = match.group()[3:-1] locals()['d'] = d - try: - s = eval(code) - except: - oe.note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], code)) - raise + s = eval(code) if type(s) == types.IntType: s = str(s) return s @@ -228,9 +224,17 @@ def expand(s, d = _data, varname = None): while s.find('$') != -1: olds = s - s = __expand_var_regexp__.sub(var_sub, s) - s = __expand_python_regexp__.sub(python_sub, s) - if s == olds: break + try: + s = __expand_var_regexp__.sub(var_sub, s) + s = __expand_python_regexp__.sub(python_sub, s) + if s == olds: break + if type(s) is not types.StringType: # sanity check + import oe + oe.error('expansion of %s returned non-string %s' % (olds, s)) + except: + import oe + oe.note("%s:%s while evaluating:\n%s" % (sys.exc_info()[0], sys.exc_info()[1], s)) + raise return s def expandKeys(alterdata = _data, readdata = None): |