summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_py/BBHandler.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/BBHandler.py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index c82090fec0..34f4d25996 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -23,7 +23,7 @@
23 23
24import re, bb, os, sys, time 24import re, bb, os, sys, time
25import bb.fetch, bb.build, bb.utils 25import bb.fetch, bb.build, bb.utils
26from bb import debug, data, fetch, fatal, methodpool 26from bb import data, fetch, methodpool
27 27
28from ConfHandler import include, localpath, obtain, init 28from ConfHandler import include, localpath, obtain, init
29from bb.parse import ParseError 29from bb.parse import ParseError
@@ -44,6 +44,13 @@ __bbpath_found__ = 0
44__classname__ = "" 44__classname__ = ""
45classes = [ None, ] 45classes = [ None, ]
46 46
47# We need to indicate EOF to the feeder. This code is so messy that
48# factoring it out to a close_parse_file method is out of question.
49# We will use the IN_PYTHON_EOF as an indicator to just close the method
50#
51# The two parts using it are tightly integrated anyway
52IN_PYTHON_EOF = -9999999999999
53
47__parsed_methods__ = methodpool.get_parsed_dict() 54__parsed_methods__ = methodpool.get_parsed_dict()
48 55
49def supports(fn, d): 56def supports(fn, d):
@@ -60,9 +67,9 @@ def inherit(files, d):
60 file = os.path.join('classes', '%s.bbclass' % file) 67 file = os.path.join('classes', '%s.bbclass' % file)
61 68
62 if not file in __inherit_cache.split(): 69 if not file in __inherit_cache.split():
63 debug(2, "BB %s:%d: inheriting %s" % (fn, lineno, file)) 70 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file))
64 __inherit_cache += " %s" % file 71 __inherit_cache += " %s" % file
65 include(fn, file, d) 72 include(fn, file, d, "inherit")
66 data.setVar('__inherit_cache', __inherit_cache, d) 73 data.setVar('__inherit_cache', __inherit_cache, d)
67 74
68 75
@@ -75,9 +82,9 @@ def handle(fn, d, include = 0):
75 __residue__ = [] 82 __residue__ = []
76 83
77 if include == 0: 84 if include == 0:
78 debug(2, "BB " + fn + ": handle(data)") 85 bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data)")
79 else: 86 else:
80 debug(2, "BB " + fn + ": handle(data, include)") 87 bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data, include)")
81 88
82 (root, ext) = os.path.splitext(os.path.basename(fn)) 89 (root, ext) = os.path.splitext(os.path.basename(fn))
83 base_name = "%s%s" % (root,ext) 90 base_name = "%s%s" % (root,ext)
@@ -132,7 +139,7 @@ def handle(fn, d, include = 0):
132 feeder(lineno, s, fn, base_name, d) 139 feeder(lineno, s, fn, base_name, d)
133 if __inpython__: 140 if __inpython__:
134 # add a blank line to close out any python definition 141 # add a blank line to close out any python definition
135 feeder(lineno + 1, "", fn, base_name, d) 142 feeder(IN_PYTHON_EOF, "", fn, base_name, d)
136 if ext == ".bbclass": 143 if ext == ".bbclass":
137 classes.remove(__classname__) 144 classes.remove(__classname__)
138 else: 145 else:
@@ -152,7 +159,7 @@ def handle(fn, d, include = 0):
152 if t: 159 if t:
153 data.setVar('T', t, d) 160 data.setVar('T', t, d)
154 except Exception, e: 161 except Exception, e:
155 bb.debug(1, "executing anonymous function: %s" % e) 162 bb.msg.debug(1, bb.msg.domain.Parsing, "executing anonymous function: %s" % e)
156 raise 163 raise
157 data.delVar("__anonqueue", d) 164 data.delVar("__anonqueue", d)
158 data.delVar("__anonfunc", d) 165 data.delVar("__anonfunc", d)
@@ -220,7 +227,7 @@ def feeder(lineno, s, fn, root, d):
220 227
221 if __inpython__: 228 if __inpython__:
222 m = __python_func_regexp__.match(s) 229 m = __python_func_regexp__.match(s)
223 if m: 230 if m and lineno != IN_PYTHON_EOF:
224 __body__.append(s) 231 __body__.append(s)
225 return 232 return
226 else: 233 else:
@@ -240,6 +247,9 @@ def feeder(lineno, s, fn, root, d):
240 __body__ = [] 247 __body__ = []
241 __inpython__ = False 248 __inpython__ = False
242 249
250 if lineno == IN_PYTHON_EOF:
251 return
252
243# fall through 253# fall through
244 254
245 if s == '' or s[0] == '#': return # skip comments and empty lines 255 if s == '' or s[0] == '#': return # skip comments and empty lines
@@ -374,7 +384,7 @@ def vars_from_file(mypkg, d):
374def set_additional_vars(file, d, include): 384def set_additional_vars(file, d, include):
375 """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}""" 385 """Deduce rest of variables, e.g. ${A} out of ${SRC_URI}"""
376 386
377 debug(2,"BB %s: set_additional_vars" % file) 387 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s: set_additional_vars" % file)
378 388
379 src_uri = data.getVar('SRC_URI', d) 389 src_uri = data.getVar('SRC_URI', d)
380 if not src_uri: 390 if not src_uri: