summaryrefslogtreecommitdiffstats
path: root/lib/bb/parse/parse_py
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2006-11-18 17:01:36 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2006-11-18 17:01:36 +0000
commitf6941af19394817f7ac7bcf58291e9dc0138df53 (patch)
tree8197b3e86996fb8aab7fc85e53458a92f9be8c6b /lib/bb/parse/parse_py
parentc5422f79e211247c07db3d52ad373e8c40d287f5 (diff)
downloadbitbake-f6941af19394817f7ac7bcf58291e9dc0138df53.tar.gz
bitbake/ old parser: Compile all anonfuncs at once!
This gives a small speed-up and forces anonfuncs to follow the same spacing/et/noet settings
Diffstat (limited to 'lib/bb/parse/parse_py')
-rw-r--r--lib/bb/parse/parse_py/BBHandler.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 17833de48..cd7462364 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -147,20 +147,21 @@ def handle(fn, d, include = 0):
data.expandKeys(d)
data.update_data(d)
anonqueue = data.getVar("__anonqueue", d, 1) or []
- for anon in anonqueue:
- data.setVar("__anonfunc", anon["content"], d)
- data.setVarFlags("__anonfunc", anon["flags"], d)
- from bb import build
- try:
- t = data.getVar('T', d)
- data.setVar('T', '${TMPDIR}/', d)
- build.exec_func("__anonfunc", d)
- data.delVar('T', d)
- if t:
- data.setVar('T', t, d)
- except Exception, e:
- bb.msg.debug(1, bb.msg.domain.Parsing, "executing anonymous function: %s" % e)
- raise
+ body = [x['content'] for x in anonqueue]
+ flag = { 'python' : 1, 'func' : 1 }
+ data.setVar("__anonfunc", "\n".join(body), d)
+ data.setVarFlags("__anonfunc", flag, d)
+ from bb import build
+ try:
+ t = data.getVar('T', d)
+ data.setVar('T', '${TMPDIR}/', d)
+ build.exec_func("__anonfunc", d)
+ data.delVar('T', d)
+ if t:
+ data.setVar('T', t, d)
+ except Exception, e:
+ bb.msg.debug(1, bb.msg.domain.Parsing, "executing anonymous function: %s" % e)
+ raise
data.delVar("__anonqueue", d)
data.delVar("__anonfunc", d)
set_additional_vars(fn, d, include)