1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

Consolidate the exec/eval bits, switch anonfunc to better_exec, etc

The methodpool, ${@} expansions, anonymous python functions, event handlers
now all run with the same global context, ensuring a consistent environment
for them.  Added a bb.utils.better_eval function which does an eval() with the
same globals as better_exec.

(Bitbake rev: 424d7e267b009cc19b8503eadab782736d9597d0)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Chris Larson
2010-03-30 20:06:07 -07:00
committed by Richard Purdie
parent eb16773704
commit 94b60d1247
6 changed files with 36 additions and 53 deletions
+1 -7
View File
@@ -50,12 +50,6 @@ class DataSmart:
self._seen_overrides = seen
self.expand_cache = {}
self.expand_globals = {
"os": os,
"bb": bb,
"time": time,
"d": self
}
def expand(self,s, varname):
def var_sub(match):
@@ -72,7 +66,7 @@ class DataSmart:
def python_sub(match):
code = match.group()[3:-1]
codeobj = compile(code.strip(), varname or "<expansion>", "eval")
s = eval(codeobj, self.expand_globals, {})
s = utils.better_eval(codeobj, {"d": self})
if type(s) == types.IntType: s = str(s)
return s