summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-01-02 23:49:18 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-01-02 23:49:18 +0000
commit250b02115454d4754b734209daa45d894f76039e (patch)
treec108ce8c79b6a33cbc7d6adaeb99deb689166e61 /bitbake/lib
parentbb802877629316f80069aea8731c258ee203e5a7 (diff)
downloadpoky-250b02115454d4754b734209daa45d894f76039e.tar.gz
bitbake/BBHandler.py: Move handler finalisation code into a separate function
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py93
1 files changed, 35 insertions, 58 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 583a71c0ba..3a309aed60 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -76,6 +76,40 @@ def inherit(files, d):
76 include(fn, file, d, "inherit") 76 include(fn, file, d, "inherit")
77 __inherit_cache = data.getVar('__inherit_cache', d) or [] 77 __inherit_cache = data.getVar('__inherit_cache', d) or []
78 78
79
80def finalise(fn, d):
81 data.expandKeys(d)
82 data.update_data(d)
83 anonqueue = data.getVar("__anonqueue", d, 1) or []
84 body = [x['content'] for x in anonqueue]
85 flag = { 'python' : 1, 'func' : 1 }
86 data.setVar("__anonfunc", "\n".join(body), d)
87 data.setVarFlags("__anonfunc", flag, d)
88 from bb import build
89 try:
90 t = data.getVar('T', d)
91 data.setVar('T', '${TMPDIR}/', d)
92 build.exec_func("__anonfunc", d)
93 data.delVar('T', d)
94 if t:
95 data.setVar('T', t, d)
96 except Exception, e:
97 bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e)
98 raise
99 data.delVar("__anonqueue", d)
100 data.delVar("__anonfunc", d)
101 data.update_data(d)
102
103 all_handlers = {}
104 for var in data.getVar('__BBHANDLERS', d) or []:
105 # try to add the handler
106 handler = data.getVar(var,d)
107 bb.event.register(var, handler)
108
109 tasklist = data.getVar('__BBTASKS', d) or []
110 bb.build.add_tasks(tasklist, d)
111
112
79def handle(fn, d, include = 0): 113def handle(fn, d, include = 0):
80 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ 114 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
81 __body__ = [] 115 __body__ = []
@@ -147,38 +181,7 @@ def handle(fn, d, include = 0):
147 classes.remove(__classname__) 181 classes.remove(__classname__)
148 else: 182 else:
149 if include == 0: 183 if include == 0:
150 data.expandKeys(d) 184 finalise(fn, d)
151 data.update_data(d)
152 anonqueue = data.getVar("__anonqueue", d, 1) or []
153 body = [x['content'] for x in anonqueue]
154 flag = { 'python' : 1, 'func' : 1 }
155 data.setVar("__anonfunc", "\n".join(body), d)
156 data.setVarFlags("__anonfunc", flag, d)
157 from bb import build
158 try:
159 t = data.getVar('T', d)
160 data.setVar('T', '${TMPDIR}/', d)
161 build.exec_func("__anonfunc", d)
162 data.delVar('T', d)
163 if t:
164 data.setVar('T', t, d)
165 except Exception, e:
166 bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e)
167 raise
168 data.delVar("__anonqueue", d)
169 data.delVar("__anonfunc", d)
170 set_additional_vars(fn, d, include)
171 data.update_data(d)
172
173 all_handlers = {}
174 for var in data.getVar('__BBHANDLERS', d) or []:
175 # try to add the handler
176 handler = data.getVar(var,d)
177 bb.event.register(var, handler)
178
179 tasklist = data.getVar('__BBTASKS', d) or []
180 bb.build.add_tasks(tasklist, d)
181
182 bbpath.pop(0) 185 bbpath.pop(0)
183 if oldfile: 186 if oldfile:
184 bb.data.setVar("FILE", oldfile, d) 187 bb.data.setVar("FILE", oldfile, d)
@@ -384,32 +387,6 @@ def vars_from_file(mypkg, d):
384 parts.extend(tmplist) 387 parts.extend(tmplist)
385 return parts 388 return parts
386 389
387def set_additional_vars(file, d, include):
388 """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
389
390 return
391 # Nothing seems to use this variable
392 #bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s: set_additional_vars" % file)
393
394 #src_uri = data.getVar('SRC_URI', d, 1)
395 #if not src_uri:
396 # return
397
398 #a = (data.getVar('A', d, 1) or '').split()
399
400 #from bb import fetch
401 #try:
402 # ud = fetch.init(src_uri.split(), d)
403 # a += fetch.localpaths(d, ud)
404 #except fetch.NoMethodError:
405 # pass
406 #except bb.MalformedUrl,e:
407 # raise ParseError("Unable to generate local paths for SRC_URI due to malformed uri: %s" % e)
408 #del fetch
409
410 #data.setVar('A', " ".join(a), d)
411
412
413# Add us to the handlers list 390# Add us to the handlers list
414from bb.parse import handlers 391from bb.parse import handlers
415handlers.append({'supports': supports, 'handle': handle, 'init': init}) 392handlers.append({'supports': supports, 'handle': handle, 'init': init})