summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-18 15:14:19 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-23 11:57:53 +0100
commit69b69193411849de71cf7c81735c3239e28a2940 (patch)
tree054081264a49c9aa3002bc358ab0c4d7b7239015 /bitbake/lib/bb/parse
parent86d30d756a60d181a95cf07041920a367a0cd0ba (diff)
downloadpoky-69b69193411849de71cf7c81735c3239e28a2940.tar.gz
bitbake: bitbake: Add explict getVar param for (non) expansion
Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` (Bitbake rev: 659ef95c9b8aced3c4ded81c48bcc0fbde4d429f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r--bitbake/lib/bb/parse/__init__.py4
-rw-r--r--bitbake/lib/bb/parse/ast.py22
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py8
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py4
4 files changed, 19 insertions, 19 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 25effc2200..4a78e183ab 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -81,7 +81,7 @@ def update_cache(f):
81def mark_dependency(d, f): 81def mark_dependency(d, f):
82 if f.startswith('./'): 82 if f.startswith('./'):
83 f = "%s/%s" % (os.getcwd(), f[2:]) 83 f = "%s/%s" % (os.getcwd(), f[2:])
84 deps = (d.getVar('__depends') or []) 84 deps = (d.getVar('__depends', False) or [])
85 s = (f, cached_mtime_noerror(f)) 85 s = (f, cached_mtime_noerror(f))
86 if s not in deps: 86 if s not in deps:
87 deps.append(s) 87 deps.append(s)
@@ -89,7 +89,7 @@ def mark_dependency(d, f):
89 89
90def check_dependency(d, f): 90def check_dependency(d, f):
91 s = (f, cached_mtime_noerror(f)) 91 s = (f, cached_mtime_noerror(f))
92 deps = (d.getVar('__depends') or []) 92 deps = (d.getVar('__depends', False) or [])
93 return s in deps 93 return s in deps
94 94
95def supports(fn, data): 95def supports(fn, data):
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index c53ab17d68..1130b1474c 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -85,7 +85,7 @@ class DataNode(AstNode):
85 if 'flag' in self.groupd and self.groupd['flag'] != None: 85 if 'flag' in self.groupd and self.groupd['flag'] != None:
86 return data.getVarFlag(key, self.groupd['flag'], noweakdefault=True) 86 return data.getVarFlag(key, self.groupd['flag'], noweakdefault=True)
87 else: 87 else:
88 return data.getVar(key, noweakdefault=True) 88 return data.getVar(key, False, noweakdefault=True)
89 89
90 def eval(self, data): 90 def eval(self, data):
91 groupd = self.groupd 91 groupd = self.groupd
@@ -152,7 +152,7 @@ class MethodNode(AstNode):
152 funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(MethodNode.tr_tbl))) 152 funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(MethodNode.tr_tbl)))
153 text = "def %s(d):\n" % (funcname) + text 153 text = "def %s(d):\n" % (funcname) + text
154 bb.methodpool.insert_method(funcname, text, self.filename) 154 bb.methodpool.insert_method(funcname, text, self.filename)
155 anonfuncs = data.getVar('__BBANONFUNCS') or [] 155 anonfuncs = data.getVar('__BBANONFUNCS', False) or []
156 anonfuncs.append(funcname) 156 anonfuncs.append(funcname)
157 data.setVar('__BBANONFUNCS', anonfuncs) 157 data.setVar('__BBANONFUNCS', anonfuncs)
158 data.setVar(funcname, text) 158 data.setVar(funcname, text)
@@ -184,7 +184,7 @@ class MethodFlagsNode(AstNode):
184 self.m = m 184 self.m = m
185 185
186 def eval(self, data): 186 def eval(self, data):
187 if data.getVar(self.key): 187 if data.getVar(self.key, False):
188 # clean up old version of this piece of metadata, as its 188 # clean up old version of this piece of metadata, as its
189 # flags could cause problems 189 # flags could cause problems
190 data.setVarFlag(self.key, 'python', None) 190 data.setVarFlag(self.key, 'python', None)
@@ -209,10 +209,10 @@ class ExportFuncsNode(AstNode):
209 for func in self.n: 209 for func in self.n:
210 calledfunc = self.classname + "_" + func 210 calledfunc = self.classname + "_" + func
211 211
212 if data.getVar(func) and not data.getVarFlag(func, 'export_func'): 212 if data.getVar(func, False) and not data.getVarFlag(func, 'export_func'):
213 continue 213 continue
214 214
215 if data.getVar(func): 215 if data.getVar(func, False):
216 data.setVarFlag(func, 'python', None) 216 data.setVarFlag(func, 'python', None)
217 data.setVarFlag(func, 'func', None) 217 data.setVarFlag(func, 'func', None)
218 218
@@ -255,7 +255,7 @@ class BBHandlerNode(AstNode):
255 self.hs = fns.split() 255 self.hs = fns.split()
256 256
257 def eval(self, data): 257 def eval(self, data):
258 bbhands = data.getVar('__BBHANDLERS') or [] 258 bbhands = data.getVar('__BBHANDLERS', False) or []
259 for h in self.hs: 259 for h in self.hs:
260 bbhands.append(h) 260 bbhands.append(h)
261 data.setVarFlag(h, "handler", 1) 261 data.setVarFlag(h, "handler", 1)
@@ -315,22 +315,22 @@ def handleInherit(statements, filename, lineno, m):
315 315
316def finalize(fn, d, variant = None): 316def finalize(fn, d, variant = None):
317 all_handlers = {} 317 all_handlers = {}
318 for var in d.getVar('__BBHANDLERS') or []: 318 for var in d.getVar('__BBHANDLERS', False) or []:
319 # try to add the handler 319 # try to add the handler
320 bb.event.register(var, d.getVar(var), (d.getVarFlag(var, "eventmask", True) or "").split()) 320 bb.event.register(var, d.getVar(var, False), (d.getVarFlag(var, "eventmask", True) or "").split())
321 321
322 bb.event.fire(bb.event.RecipePreFinalise(fn), d) 322 bb.event.fire(bb.event.RecipePreFinalise(fn), d)
323 323
324 bb.data.expandKeys(d) 324 bb.data.expandKeys(d)
325 bb.data.update_data(d) 325 bb.data.update_data(d)
326 code = [] 326 code = []
327 for funcname in d.getVar("__BBANONFUNCS") or []: 327 for funcname in d.getVar("__BBANONFUNCS", False) or []:
328 code.append("%s(d)" % funcname) 328 code.append("%s(d)" % funcname)
329 bb.utils.better_exec("\n".join(code), {"d": d}) 329 bb.utils.better_exec("\n".join(code), {"d": d})
330 bb.data.update_data(d) 330 bb.data.update_data(d)
331 331
332 tasklist = d.getVar('__BBTASKS') or [] 332 tasklist = d.getVar('__BBTASKS', False) or []
333 deltasklist = d.getVar('__BBDELTASKS') or [] 333 deltasklist = d.getVar('__BBDELTASKS', False) or []
334 bb.build.add_tasks(tasklist, deltasklist, d) 334 bb.build.add_tasks(tasklist, deltasklist, d)
335 335
336 bb.parse.siggen.finalise(fn, d, variant) 336 bb.parse.siggen.finalise(fn, d, variant)
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 03109dfbb2..ec097baf73 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -69,7 +69,7 @@ def supports(fn, d):
69 return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] 69 return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"]
70 70
71def inherit(files, fn, lineno, d): 71def inherit(files, fn, lineno, d):
72 __inherit_cache = d.getVar('__inherit_cache') or [] 72 __inherit_cache = d.getVar('__inherit_cache', False) or []
73 files = d.expand(files).split() 73 files = d.expand(files).split()
74 for file in files: 74 for file in files:
75 if not os.path.isabs(file) and not file.endswith(".bbclass"): 75 if not os.path.isabs(file) and not file.endswith(".bbclass"):
@@ -89,7 +89,7 @@ def inherit(files, fn, lineno, d):
89 __inherit_cache.append( file ) 89 __inherit_cache.append( file )
90 d.setVar('__inherit_cache', __inherit_cache) 90 d.setVar('__inherit_cache', __inherit_cache)
91 include(fn, file, lineno, d, "inherit") 91 include(fn, file, lineno, d, "inherit")
92 __inherit_cache = d.getVar('__inherit_cache') or [] 92 __inherit_cache = d.getVar('__inherit_cache', False) or []
93 93
94def get_statements(filename, absolute_filename, base_name): 94def get_statements(filename, absolute_filename, base_name):
95 global cached_statements 95 global cached_statements
@@ -129,13 +129,13 @@ def handle(fn, d, include):
129 129
130 if ext == ".bbclass": 130 if ext == ".bbclass":
131 __classname__ = root 131 __classname__ = root
132 __inherit_cache = d.getVar('__inherit_cache') or [] 132 __inherit_cache = d.getVar('__inherit_cache', False) or []
133 if not fn in __inherit_cache: 133 if not fn in __inherit_cache:
134 __inherit_cache.append(fn) 134 __inherit_cache.append(fn)
135 d.setVar('__inherit_cache', __inherit_cache) 135 d.setVar('__inherit_cache', __inherit_cache)
136 136
137 if include != 0: 137 if include != 0:
138 oldfile = d.getVar('FILE') 138 oldfile = d.getVar('FILE', False)
139 else: 139 else:
140 oldfile = None 140 oldfile = None
141 141
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 8d7a0d562a..250a557cb4 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -58,7 +58,7 @@ __require_regexp__ = re.compile( r"require\s+(.+)" )
58__export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/]+)$" ) 58__export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/]+)$" )
59 59
60def init(data): 60def init(data):
61 topdir = data.getVar('TOPDIR') 61 topdir = data.getVar('TOPDIR', False)
62 if not topdir: 62 if not topdir:
63 data.setVar('TOPDIR', os.getcwd()) 63 data.setVar('TOPDIR', os.getcwd())
64 64
@@ -112,7 +112,7 @@ def handle(fn, data, include):
112 if include == 0: 112 if include == 0:
113 oldfile = None 113 oldfile = None
114 else: 114 else:
115 oldfile = data.getVar('FILE') 115 oldfile = data.getVar('FILE', False)
116 116
117 abs_fn = resolve_file(fn, data) 117 abs_fn = resolve_file(fn, data)
118 f = open(abs_fn, 'r') 118 f = open(abs_fn, 'r')