diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-18 15:14:19 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-06-23 11:57:53 +0100 |
commit | 69b69193411849de71cf7c81735c3239e28a2940 (patch) | |
tree | 054081264a49c9aa3002bc358ab0c4d7b7239015 /bitbake/lib/bb | |
parent | 86d30d756a60d181a95cf07041920a367a0cd0ba (diff) | |
download | poky-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')
-rw-r--r-- | bitbake/lib/bb/build.py | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 28 | ||||
-rw-r--r-- | bitbake/lib/bb/cookerdata.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/data.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/clearcase.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/perforce.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 22 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 8 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 18 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 6 |
13 files changed, 57 insertions, 57 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 0f6aa1a14c..14dc5e0619 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -159,7 +159,7 @@ class LogTee(object): | |||
159 | def exec_func(func, d, dirs = None): | 159 | def exec_func(func, d, dirs = None): |
160 | """Execute a BB 'function'""" | 160 | """Execute a BB 'function'""" |
161 | 161 | ||
162 | body = d.getVar(func) | 162 | body = d.getVar(func, False) |
163 | if not body: | 163 | if not body: |
164 | if body is None: | 164 | if body is None: |
165 | logger.warn("Function %s doesn't exist", func) | 165 | logger.warn("Function %s doesn't exist", func) |
@@ -646,7 +646,7 @@ def stampfile(taskname, d, file_name = None): | |||
646 | return stamp_internal(taskname, d, file_name) | 646 | return stamp_internal(taskname, d, file_name) |
647 | 647 | ||
648 | def add_tasks(tasklist, deltasklist, d): | 648 | def add_tasks(tasklist, deltasklist, d): |
649 | task_deps = d.getVar('_task_deps') | 649 | task_deps = d.getVar('_task_deps', False) |
650 | if not task_deps: | 650 | if not task_deps: |
651 | task_deps = {} | 651 | task_deps = {} |
652 | if not 'tasks' in task_deps: | 652 | if not 'tasks' in task_deps: |
@@ -696,7 +696,7 @@ def addtask(task, before, after, d): | |||
696 | task = "do_" + task | 696 | task = "do_" + task |
697 | 697 | ||
698 | d.setVarFlag(task, "task", 1) | 698 | d.setVarFlag(task, "task", 1) |
699 | bbtasks = d.getVar('__BBTASKS') or [] | 699 | bbtasks = d.getVar('__BBTASKS', False) or [] |
700 | if not task in bbtasks: | 700 | if not task in bbtasks: |
701 | bbtasks.append(task) | 701 | bbtasks.append(task) |
702 | d.setVar('__BBTASKS', bbtasks) | 702 | d.setVar('__BBTASKS', bbtasks) |
@@ -719,7 +719,7 @@ def deltask(task, d): | |||
719 | if task[:3] != "do_": | 719 | if task[:3] != "do_": |
720 | task = "do_" + task | 720 | task = "do_" + task |
721 | 721 | ||
722 | bbtasks = d.getVar('__BBDELTASKS') or [] | 722 | bbtasks = d.getVar('__BBDELTASKS', False) or [] |
723 | if not task in bbtasks: | 723 | if not task in bbtasks: |
724 | bbtasks.append(task) | 724 | bbtasks.append(task) |
725 | d.setVar('__BBDELTASKS', bbtasks) | 725 | d.setVar('__BBDELTASKS', bbtasks) |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index d2b5ceb3bd..cf65ab2c96 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -386,7 +386,7 @@ class BBCooker: | |||
386 | 386 | ||
387 | replaced = False | 387 | replaced = False |
388 | #do not save if nothing changed | 388 | #do not save if nothing changed |
389 | if str(val) == self.data.getVar(var): | 389 | if str(val) == self.data.getVar(var, False): |
390 | return | 390 | return |
391 | 391 | ||
392 | conf_files = self.data.varhistory.get_variable_files(var) | 392 | conf_files = self.data.varhistory.get_variable_files(var) |
@@ -398,7 +398,7 @@ class BBCooker: | |||
398 | listval += "%s " % value | 398 | listval += "%s " % value |
399 | val = listval | 399 | val = listval |
400 | 400 | ||
401 | topdir = self.data.getVar("TOPDIR") | 401 | topdir = self.data.getVar("TOPDIR", False) |
402 | 402 | ||
403 | #comment or replace operations made on var | 403 | #comment or replace operations made on var |
404 | for conf_file in conf_files: | 404 | for conf_file in conf_files: |
@@ -453,7 +453,7 @@ class BBCooker: | |||
453 | 453 | ||
454 | def removeConfigurationVar(self, var): | 454 | def removeConfigurationVar(self, var): |
455 | conf_files = self.data.varhistory.get_variable_files(var) | 455 | conf_files = self.data.varhistory.get_variable_files(var) |
456 | topdir = self.data.getVar("TOPDIR") | 456 | topdir = self.data.getVar("TOPDIR", False) |
457 | 457 | ||
458 | for conf_file in conf_files: | 458 | for conf_file in conf_files: |
459 | if topdir in conf_file: | 459 | if topdir in conf_file: |
@@ -493,7 +493,7 @@ class BBCooker: | |||
493 | 493 | ||
494 | def parseConfiguration(self): | 494 | def parseConfiguration(self): |
495 | # Set log file verbosity | 495 | # Set log file verbosity |
496 | verboselogs = bb.utils.to_boolean(self.data.getVar("BB_VERBOSE_LOGS", "0")) | 496 | verboselogs = bb.utils.to_boolean(self.data.getVar("BB_VERBOSE_LOGS", False)) |
497 | if verboselogs: | 497 | if verboselogs: |
498 | bb.msg.loggerVerboseLogs = True | 498 | bb.msg.loggerVerboseLogs = True |
499 | 499 | ||
@@ -613,7 +613,7 @@ class BBCooker: | |||
613 | data.expandKeys(envdata) | 613 | data.expandKeys(envdata) |
614 | for e in envdata.keys(): | 614 | for e in envdata.keys(): |
615 | if data.getVarFlag( e, 'python', envdata ): | 615 | if data.getVarFlag( e, 'python', envdata ): |
616 | logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1)) | 616 | logger.plain("\npython %s () {\n%s}\n", e, envdata.getVar(e, True)) |
617 | 617 | ||
618 | 618 | ||
619 | def buildTaskData(self, pkgs_to_build, task, abort): | 619 | def buildTaskData(self, pkgs_to_build, task, abort): |
@@ -908,8 +908,8 @@ class BBCooker: | |||
908 | for appends in appends_without_recipes | 908 | for appends in appends_without_recipes |
909 | for append in appends) | 909 | for append in appends) |
910 | msg = 'No recipes available for:\n%s' % '\n'.join(appendlines) | 910 | msg = 'No recipes available for:\n%s' % '\n'.join(appendlines) |
911 | warn_only = data.getVar("BB_DANGLINGAPPENDS_WARNONLY", \ | 911 | warn_only = self.data.getVar("BB_DANGLINGAPPENDS_WARNONLY", \ |
912 | self.data, False) or "no" | 912 | False) or "no" |
913 | if warn_only.lower() in ("1", "yes", "true"): | 913 | if warn_only.lower() in ("1", "yes", "true"): |
914 | bb.warn(msg) | 914 | bb.warn(msg) |
915 | else: | 915 | else: |
@@ -956,8 +956,8 @@ class BBCooker: | |||
956 | # Generate a list of parsed configuration files by searching the files | 956 | # Generate a list of parsed configuration files by searching the files |
957 | # listed in the __depends and __base_depends variables with a .conf suffix. | 957 | # listed in the __depends and __base_depends variables with a .conf suffix. |
958 | conffiles = [] | 958 | conffiles = [] |
959 | dep_files = self.data.getVar('__base_depends') or [] | 959 | dep_files = self.data.getVar('__base_depends', False) or [] |
960 | dep_files = dep_files + (self.data.getVar('__depends') or []) | 960 | dep_files = dep_files + (self.data.getVar('__depends', False) or []) |
961 | 961 | ||
962 | for f in dep_files: | 962 | for f in dep_files: |
963 | if f[0].endswith(".conf"): | 963 | if f[0].endswith(".conf"): |
@@ -1174,7 +1174,7 @@ class BBCooker: | |||
1174 | """ | 1174 | """ |
1175 | Setup any variables needed before starting a build | 1175 | Setup any variables needed before starting a build |
1176 | """ | 1176 | """ |
1177 | if not self.data.getVar("BUILDNAME"): | 1177 | if not self.data.getVar("BUILDNAME", False): |
1178 | self.data.setVar("BUILDNAME", time.strftime('%Y%m%d%H%M')) | 1178 | self.data.setVar("BUILDNAME", time.strftime('%Y%m%d%H%M')) |
1179 | self.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', time.gmtime())) | 1179 | self.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', time.gmtime())) |
1180 | 1180 | ||
@@ -1275,7 +1275,7 @@ class BBCooker: | |||
1275 | taskdata = bb.taskdata.TaskData(self.configuration.abort) | 1275 | taskdata = bb.taskdata.TaskData(self.configuration.abort) |
1276 | taskdata.add_provider(self.data, self.recipecache, item) | 1276 | taskdata.add_provider(self.data, self.recipecache, item) |
1277 | 1277 | ||
1278 | buildname = self.data.getVar("BUILDNAME") | 1278 | buildname = self.data.getVar("BUILDNAME", False) |
1279 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.expanded_data) | 1279 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.expanded_data) |
1280 | 1280 | ||
1281 | # Execute the runqueue | 1281 | # Execute the runqueue |
@@ -1348,7 +1348,7 @@ class BBCooker: | |||
1348 | 1348 | ||
1349 | taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort) | 1349 | taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort) |
1350 | 1350 | ||
1351 | buildname = self.data.getVar("BUILDNAME") | 1351 | buildname = self.data.getVar("BUILDNAME", False) |
1352 | bb.event.fire(bb.event.BuildStarted(buildname, fulltargetlist), self.data) | 1352 | bb.event.fire(bb.event.BuildStarted(buildname, fulltargetlist), self.data) |
1353 | 1353 | ||
1354 | rq = bb.runqueue.RunQueue(self, self.data, self.recipecache, taskdata, runlist) | 1354 | rq = bb.runqueue.RunQueue(self, self.data, self.recipecache, taskdata, runlist) |
@@ -1402,7 +1402,7 @@ class BBCooker: | |||
1402 | if base_image is None: | 1402 | if base_image is None: |
1403 | imagefile.write("inherit core-image\n") | 1403 | imagefile.write("inherit core-image\n") |
1404 | else: | 1404 | else: |
1405 | topdir = self.data.getVar("TOPDIR") | 1405 | topdir = self.data.getVar("TOPDIR", False) |
1406 | if topdir in base_image: | 1406 | if topdir in base_image: |
1407 | base_image = require_line.split()[1] | 1407 | base_image = require_line.split()[1] |
1408 | imagefile.write("require " + base_image + "\n") | 1408 | imagefile.write("require " + base_image + "\n") |
@@ -1462,7 +1462,7 @@ class BBCooker: | |||
1462 | (filelist, masked) = self.collection.collect_bbfiles(self.data, self.expanded_data) | 1462 | (filelist, masked) = self.collection.collect_bbfiles(self.data, self.expanded_data) |
1463 | 1463 | ||
1464 | self.data.renameVar("__depends", "__base_depends") | 1464 | self.data.renameVar("__depends", "__base_depends") |
1465 | self.add_filewatch(self.data.getVar("__base_depends"), self.configwatcher) | 1465 | self.add_filewatch(self.data.getVar("__base_depends", False), self.configwatcher) |
1466 | 1466 | ||
1467 | self.parser = CookerParser(self, filelist, masked) | 1467 | self.parser = CookerParser(self, filelist, masked) |
1468 | self.parsecache_valid = True | 1468 | self.parsecache_valid = True |
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py index 630ee27589..0ca87a094e 100644 --- a/bitbake/lib/bb/cookerdata.py +++ b/bitbake/lib/bb/cookerdata.py | |||
@@ -301,15 +301,15 @@ class CookerDataBuilder(object): | |||
301 | 301 | ||
302 | # Nomally we only register event handlers at the end of parsing .bb files | 302 | # Nomally we only register event handlers at the end of parsing .bb files |
303 | # We register any handlers we've found so far here... | 303 | # We register any handlers we've found so far here... |
304 | for var in data.getVar('__BBHANDLERS') or []: | 304 | for var in data.getVar('__BBHANDLERS', False) or []: |
305 | bb.event.register(var, data.getVar(var), (data.getVarFlag(var, "eventmask", True) or "").split()) | 305 | bb.event.register(var, data.getVar(var, False), (data.getVarFlag(var, "eventmask", True) or "").split()) |
306 | 306 | ||
307 | if data.getVar("BB_WORKERCONTEXT", False) is None: | 307 | if data.getVar("BB_WORKERCONTEXT", False) is None: |
308 | bb.fetch.fetcher_init(data) | 308 | bb.fetch.fetcher_init(data) |
309 | bb.codeparser.parser_cache_init(data) | 309 | bb.codeparser.parser_cache_init(data) |
310 | bb.event.fire(bb.event.ConfigParsed(), data) | 310 | bb.event.fire(bb.event.ConfigParsed(), data) |
311 | 311 | ||
312 | if data.getVar("BB_INVALIDCONF") is True: | 312 | if data.getVar("BB_INVALIDCONF", False) is True: |
313 | data.setVar("BB_INVALIDCONF", False) | 313 | data.setVar("BB_INVALIDCONF", False) |
314 | self.parseConfigurationFiles(self.prefiles, self.postfiles) | 314 | self.parseConfigurationFiles(self.prefiles, self.postfiles) |
315 | return | 315 | return |
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 84f5355e42..8b21c466fe 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -419,7 +419,7 @@ def generate_dependencies(d): | |||
419 | deps = {} | 419 | deps = {} |
420 | values = {} | 420 | values = {} |
421 | 421 | ||
422 | tasklist = d.getVar('__BBTASKS') or [] | 422 | tasklist = d.getVar('__BBTASKS', False) or [] |
423 | for task in tasklist: | 423 | for task in tasklist: |
424 | deps[task], values[task] = build_dependencies(task, keys, shelldeps, varflagsexcl, d) | 424 | deps[task], values[task] = build_dependencies(task, keys, shelldeps, varflagsexcl, d) |
425 | newdeps = deps[task] | 425 | newdeps = deps[task] |
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 958469db62..cc772df498 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -1003,7 +1003,7 @@ def trusted_network(d, url): | |||
1003 | if d.getVar('BB_NO_NETWORK', True) == "1": | 1003 | if d.getVar('BB_NO_NETWORK', True) == "1": |
1004 | return True | 1004 | return True |
1005 | 1005 | ||
1006 | pkgname = d.expand(d.getVar('PN')) | 1006 | pkgname = d.expand(d.getVar('PN', False)) |
1007 | trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname) | 1007 | trusted_hosts = d.getVarFlag('BB_ALLOWED_NETWORKS', pkgname) |
1008 | 1008 | ||
1009 | if not trusted_hosts: | 1009 | if not trusted_hosts: |
diff --git a/bitbake/lib/bb/fetch2/clearcase.py b/bitbake/lib/bb/fetch2/clearcase.py index bfca2f7bcf..ba83e7cb60 100644 --- a/bitbake/lib/bb/fetch2/clearcase.py +++ b/bitbake/lib/bb/fetch2/clearcase.py | |||
@@ -9,7 +9,7 @@ Usage in the recipe: | |||
9 | 9 | ||
10 | SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" | 10 | SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" |
11 | SRCREV = "EXAMPLE_CLEARCASE_TAG" | 11 | SRCREV = "EXAMPLE_CLEARCASE_TAG" |
12 | PV = "${@d.getVar("SRCREV").replace("/", "+")}" | 12 | PV = "${@d.getVar("SRCREV", False).replace("/", "+")}" |
13 | 13 | ||
14 | The fetcher uses the rcleartool or cleartool remote client, depending on which one is available. | 14 | The fetcher uses the rcleartool or cleartool remote client, depending on which one is available. |
15 | 15 | ||
@@ -113,7 +113,7 @@ class ClearCase(FetchMethod): | |||
113 | if data.getVar("SRCREV", d, True) == "INVALID": | 113 | if data.getVar("SRCREV", d, True) == "INVALID": |
114 | raise FetchError("Set a valid SRCREV for the clearcase fetcher in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your choice.") | 114 | raise FetchError("Set a valid SRCREV for the clearcase fetcher in your recipe, e.g. SRCREV = \"/main/LATEST\" or any other label of your choice.") |
115 | 115 | ||
116 | ud.label = d.getVar("SRCREV") | 116 | ud.label = d.getVar("SRCREV", False) |
117 | ud.customspec = d.getVar("CCASE_CUSTOM_CONFIG_SPEC", True) | 117 | ud.customspec = d.getVar("CCASE_CUSTOM_CONFIG_SPEC", True) |
118 | 118 | ||
119 | ud.server = "%s://%s%s" % (ud.proto, ud.host, ud.path) | 119 | ud.server = "%s://%s%s" % (ud.proto, ud.host, ud.path) |
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index d079a33c62..5a6631a384 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py | |||
@@ -48,7 +48,7 @@ class Perforce(FetchMethod): | |||
48 | (user, pswd, host, port) = path.split('@')[0].split(":") | 48 | (user, pswd, host, port) = path.split('@')[0].split(":") |
49 | path = path.split('@')[1] | 49 | path = path.split('@')[1] |
50 | else: | 50 | else: |
51 | (host, port) = d.getVar('P4PORT').split(':') | 51 | (host, port) = d.getVar('P4PORT', False).split(':') |
52 | user = "" | 52 | user = "" |
53 | pswd = "" | 53 | pswd = "" |
54 | 54 | ||
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): | |||
81 | def mark_dependency(d, f): | 81 | def 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 | ||
90 | def check_dependency(d, f): | 90 | def 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 | ||
95 | def supports(fn, data): | 95 | def 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 | ||
316 | def finalize(fn, d, variant = None): | 316 | def 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 | ||
71 | def inherit(files, fn, lineno, d): | 71 | def 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 | ||
94 | def get_statements(filename, absolute_filename, base_name): | 94 | def 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 | ||
60 | def init(data): | 60 | def 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') |
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index e285c223dc..2c2e7ae48b 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -134,12 +134,12 @@ class DataExpansions(unittest.TestCase): | |||
134 | 134 | ||
135 | def test_rename(self): | 135 | def test_rename(self): |
136 | self.d.renameVar("foo", "newfoo") | 136 | self.d.renameVar("foo", "newfoo") |
137 | self.assertEqual(self.d.getVar("newfoo"), "value_of_foo") | 137 | self.assertEqual(self.d.getVar("newfoo", False), "value_of_foo") |
138 | self.assertEqual(self.d.getVar("foo"), None) | 138 | self.assertEqual(self.d.getVar("foo", False), None) |
139 | 139 | ||
140 | def test_deletion(self): | 140 | def test_deletion(self): |
141 | self.d.delVar("foo") | 141 | self.d.delVar("foo") |
142 | self.assertEqual(self.d.getVar("foo"), None) | 142 | self.assertEqual(self.d.getVar("foo", False), None) |
143 | 143 | ||
144 | def test_keys(self): | 144 | def test_keys(self): |
145 | keys = self.d.keys() | 145 | keys = self.d.keys() |
@@ -196,28 +196,28 @@ class TestMemoize(unittest.TestCase): | |||
196 | def test_memoized(self): | 196 | def test_memoized(self): |
197 | d = bb.data.init() | 197 | d = bb.data.init() |
198 | d.setVar("FOO", "bar") | 198 | d.setVar("FOO", "bar") |
199 | self.assertTrue(d.getVar("FOO") is d.getVar("FOO")) | 199 | self.assertTrue(d.getVar("FOO", False) is d.getVar("FOO", False)) |
200 | 200 | ||
201 | def test_not_memoized(self): | 201 | def test_not_memoized(self): |
202 | d1 = bb.data.init() | 202 | d1 = bb.data.init() |
203 | d2 = bb.data.init() | 203 | d2 = bb.data.init() |
204 | d1.setVar("FOO", "bar") | 204 | d1.setVar("FOO", "bar") |
205 | d2.setVar("FOO", "bar2") | 205 | d2.setVar("FOO", "bar2") |
206 | self.assertTrue(d1.getVar("FOO") is not d2.getVar("FOO")) | 206 | self.assertTrue(d1.getVar("FOO", False) is not d2.getVar("FOO", False)) |
207 | 207 | ||
208 | def test_changed_after_memoized(self): | 208 | def test_changed_after_memoized(self): |
209 | d = bb.data.init() | 209 | d = bb.data.init() |
210 | d.setVar("foo", "value of foo") | 210 | d.setVar("foo", "value of foo") |
211 | self.assertEqual(str(d.getVar("foo")), "value of foo") | 211 | self.assertEqual(str(d.getVar("foo", False)), "value of foo") |
212 | d.setVar("foo", "second value of foo") | 212 | d.setVar("foo", "second value of foo") |
213 | self.assertEqual(str(d.getVar("foo")), "second value of foo") | 213 | self.assertEqual(str(d.getVar("foo", False)), "second value of foo") |
214 | 214 | ||
215 | def test_same_value(self): | 215 | def test_same_value(self): |
216 | d = bb.data.init() | 216 | d = bb.data.init() |
217 | d.setVar("foo", "value of") | 217 | d.setVar("foo", "value of") |
218 | d.setVar("bar", "value of") | 218 | d.setVar("bar", "value of") |
219 | self.assertEqual(d.getVar("foo"), | 219 | self.assertEqual(d.getVar("foo", False), |
220 | d.getVar("bar")) | 220 | d.getVar("bar", False)) |
221 | 221 | ||
222 | class TestConcat(unittest.TestCase): | 222 | class TestConcat(unittest.TestCase): |
223 | def setUp(self): | 223 | def setUp(self): |
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 455af320e8..dcc4104262 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -309,7 +309,7 @@ class Parameters: | |||
309 | 309 | ||
310 | def hob_conf_filter(fn, data): | 310 | def hob_conf_filter(fn, data): |
311 | if fn.endswith("/local.conf"): | 311 | if fn.endswith("/local.conf"): |
312 | distro = data.getVar("DISTRO_HOB") | 312 | distro = data.getVar("DISTRO_HOB", False) |
313 | if distro: | 313 | if distro: |
314 | if distro != "defaultsetup": | 314 | if distro != "defaultsetup": |
315 | data.setVar("DISTRO", distro) | 315 | data.setVar("DISTRO", distro) |
@@ -320,13 +320,13 @@ def hob_conf_filter(fn, data): | |||
320 | "BB_NUMBER_THREADS_HOB", "PARALLEL_MAKE_HOB", "DL_DIR_HOB", \ | 320 | "BB_NUMBER_THREADS_HOB", "PARALLEL_MAKE_HOB", "DL_DIR_HOB", \ |
321 | "SSTATE_DIR_HOB", "SSTATE_MIRRORS_HOB", "INCOMPATIBLE_LICENSE_HOB"] | 321 | "SSTATE_DIR_HOB", "SSTATE_MIRRORS_HOB", "INCOMPATIBLE_LICENSE_HOB"] |
322 | for key in keys: | 322 | for key in keys: |
323 | var_hob = data.getVar(key) | 323 | var_hob = data.getVar(key, False) |
324 | if var_hob: | 324 | if var_hob: |
325 | data.setVar(key.split("_HOB")[0], var_hob) | 325 | data.setVar(key.split("_HOB")[0], var_hob) |
326 | return | 326 | return |
327 | 327 | ||
328 | if fn.endswith("/bblayers.conf"): | 328 | if fn.endswith("/bblayers.conf"): |
329 | layers = data.getVar("BBLAYERS_HOB") | 329 | layers = data.getVar("BBLAYERS_HOB", False) |
330 | if layers: | 330 | if layers: |
331 | data.setVar("BBLAYERS", layers) | 331 | data.setVar("BBLAYERS", layers) |
332 | return | 332 | return |