aboutsummaryrefslogtreecommitdiffstats
path: root/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-19 22:43:48 +0100
commit659ef95c9b8aced3c4ded81c48bcc0fbde4d429f (patch)
treec63666710636bf12d25ef5a491f5d1abbcca4f96 /lib/bb/parse
parent5ecd6a671c088f270d5f49093f8da83278fc0aa9 (diff)
downloadbitbake-659ef95c9b8aced3c4ded81c48bcc0fbde4d429f.tar.gz
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 *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse')
-rw-r--r--lib/bb/parse/__init__.py4
-rw-r--r--lib/bb/parse/ast.py22
-rw-r--r--lib/bb/parse/parse_py/BBHandler.py8
-rw-r--r--lib/bb/parse/parse_py/ConfHandler.py4
4 files changed, 19 insertions, 19 deletions
diff --git a/lib/bb/parse/__init__.py b/lib/bb/parse/__init__.py
index 25effc220..4a78e183a 100644
--- a/lib/bb/parse/__init__.py
+++ b/lib/bb/parse/__init__.py
@@ -81,7 +81,7 @@ def update_cache(f):
def mark_dependency(d, f):
if f.startswith('./'):
f = "%s/%s" % (os.getcwd(), f[2:])
- deps = (d.getVar('__depends') or [])
+ deps = (d.getVar('__depends', False) or [])
s = (f, cached_mtime_noerror(f))
if s not in deps:
deps.append(s)
@@ -89,7 +89,7 @@ def mark_dependency(d, f):
def check_dependency(d, f):
s = (f, cached_mtime_noerror(f))
- deps = (d.getVar('__depends') or [])
+ deps = (d.getVar('__depends', False) or [])
return s in deps
def supports(fn, data):
diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py
index c53ab17d6..1130b1474 100644
--- a/lib/bb/parse/ast.py
+++ b/lib/bb/parse/ast.py
@@ -85,7 +85,7 @@ class DataNode(AstNode):
if 'flag' in self.groupd and self.groupd['flag'] != None:
return data.getVarFlag(key, self.groupd['flag'], noweakdefault=True)
else:
- return data.getVar(key, noweakdefault=True)
+ return data.getVar(key, False, noweakdefault=True)
def eval(self, data):
groupd = self.groupd
@@ -152,7 +152,7 @@ class MethodNode(AstNode):
funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(MethodNode.tr_tbl)))
text = "def %s(d):\n" % (funcname) + text
bb.methodpool.insert_method(funcname, text, self.filename)
- anonfuncs = data.getVar('__BBANONFUNCS') or []
+ anonfuncs = data.getVar('__BBANONFUNCS', False) or []
anonfuncs.append(funcname)
data.setVar('__BBANONFUNCS', anonfuncs)
data.setVar(funcname, text)
@@ -184,7 +184,7 @@ class MethodFlagsNode(AstNode):
self.m = m
def eval(self, data):
- if data.getVar(self.key):
+ if data.getVar(self.key, False):
# clean up old version of this piece of metadata, as its
# flags could cause problems
data.setVarFlag(self.key, 'python', None)
@@ -209,10 +209,10 @@ class ExportFuncsNode(AstNode):
for func in self.n:
calledfunc = self.classname + "_" + func
- if data.getVar(func) and not data.getVarFlag(func, 'export_func'):
+ if data.getVar(func, False) and not data.getVarFlag(func, 'export_func'):
continue
- if data.getVar(func):
+ if data.getVar(func, False):
data.setVarFlag(func, 'python', None)
data.setVarFlag(func, 'func', None)
@@ -255,7 +255,7 @@ class BBHandlerNode(AstNode):
self.hs = fns.split()
def eval(self, data):
- bbhands = data.getVar('__BBHANDLERS') or []
+ bbhands = data.getVar('__BBHANDLERS', False) or []
for h in self.hs:
bbhands.append(h)
data.setVarFlag(h, "handler", 1)
@@ -315,22 +315,22 @@ def handleInherit(statements, filename, lineno, m):
def finalize(fn, d, variant = None):
all_handlers = {}
- for var in d.getVar('__BBHANDLERS') or []:
+ for var in d.getVar('__BBHANDLERS', False) or []:
# try to add the handler
- bb.event.register(var, d.getVar(var), (d.getVarFlag(var, "eventmask", True) or "").split())
+ bb.event.register(var, d.getVar(var, False), (d.getVarFlag(var, "eventmask", True) or "").split())
bb.event.fire(bb.event.RecipePreFinalise(fn), d)
bb.data.expandKeys(d)
bb.data.update_data(d)
code = []
- for funcname in d.getVar("__BBANONFUNCS") or []:
+ for funcname in d.getVar("__BBANONFUNCS", False) or []:
code.append("%s(d)" % funcname)
bb.utils.better_exec("\n".join(code), {"d": d})
bb.data.update_data(d)
- tasklist = d.getVar('__BBTASKS') or []
- deltasklist = d.getVar('__BBDELTASKS') or []
+ tasklist = d.getVar('__BBTASKS', False) or []
+ deltasklist = d.getVar('__BBDELTASKS', False) or []
bb.build.add_tasks(tasklist, deltasklist, d)
bb.parse.siggen.finalise(fn, d, variant)
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index 03109dfbb..ec097baf7 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -69,7 +69,7 @@ def supports(fn, d):
return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"]
def inherit(files, fn, lineno, d):
- __inherit_cache = d.getVar('__inherit_cache') or []
+ __inherit_cache = d.getVar('__inherit_cache', False) or []
files = d.expand(files).split()
for file in files:
if not os.path.isabs(file) and not file.endswith(".bbclass"):
@@ -89,7 +89,7 @@ def inherit(files, fn, lineno, d):
__inherit_cache.append( file )
d.setVar('__inherit_cache', __inherit_cache)
include(fn, file, lineno, d, "inherit")
- __inherit_cache = d.getVar('__inherit_cache') or []
+ __inherit_cache = d.getVar('__inherit_cache', False) or []
def get_statements(filename, absolute_filename, base_name):
global cached_statements
@@ -129,13 +129,13 @@ def handle(fn, d, include):
if ext == ".bbclass":
__classname__ = root
- __inherit_cache = d.getVar('__inherit_cache') or []
+ __inherit_cache = d.getVar('__inherit_cache', False) or []
if not fn in __inherit_cache:
__inherit_cache.append(fn)
d.setVar('__inherit_cache', __inherit_cache)
if include != 0:
- oldfile = d.getVar('FILE')
+ oldfile = d.getVar('FILE', False)
else:
oldfile = None
diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py
index 8d7a0d562..250a557cb 100644
--- a/lib/bb/parse/parse_py/ConfHandler.py
+++ b/lib/bb/parse/parse_py/ConfHandler.py
@@ -58,7 +58,7 @@ __require_regexp__ = re.compile( r"require\s+(.+)" )
__export_regexp__ = re.compile( r"export\s+([a-zA-Z0-9\-_+.${}/]+)$" )
def init(data):
- topdir = data.getVar('TOPDIR')
+ topdir = data.getVar('TOPDIR', False)
if not topdir:
data.setVar('TOPDIR', os.getcwd())
@@ -112,7 +112,7 @@ def handle(fn, data, include):
if include == 0:
oldfile = None
else:
- oldfile = data.getVar('FILE')
+ oldfile = data.getVar('FILE', False)
abs_fn = resolve_file(fn, data)
f = open(abs_fn, 'r')