summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2009-11-03 22:33:59 +0000
committerRichard Purdie <rpurdie@rpsys.net>2009-11-03 22:33:59 +0000
commit47dceffdfc899d2f47afed57e519aecba25210ce (patch)
tree7b0de6d9c1ea9dc72da09e6caf3044928840eb0a
parenta865dd426316eaec7d65793b35624749d2a6d408 (diff)
downloadbitbake-47dceffdfc899d2f47afed57e519aecba25210ce.tar.gz
build.py: Add bb and os to __builtins__ backporting from trunk since we'd like to be able to depend on this behaviour in OE soon
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
-rw-r--r--lib/bb/build.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 7644bf0ee..8f23c6fb2 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -28,6 +28,13 @@
from bb import data, fetch, event, mkdirhier, utils
import bb, os
+# When we execute a python function we'd like certain things
+# in all namespaces, hence we add them to __builtins__
+# If we do not do this and use the exec globals, they will
+# not be available to subfunctions.
+__builtins__['bb'] = bb
+__builtins__['os'] = os
+
# events
class FuncFailed(Exception):
"""Executed function failed"""
@@ -130,8 +137,6 @@ def exec_func_python(func, d):
comp = utils.better_compile(tmp, func, bbfile)
prevdir = os.getcwd()
g = {} # globals
- g['bb'] = bb
- g['os'] = os
g['d'] = d
utils.better_exec(comp, g, tmp, bbfile)
if os.path.exists(prevdir):