summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-02 11:07:17 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-03 10:12:42 +0000
commit9abab49f2bcac3ea80f96f837e181904bfae8848 (patch)
tree863f0a8f90ea0ca21e2f7922704fbaee4c0b9650 /bitbake
parent5fb6b453f633796f28e230420e17b644adde8b11 (diff)
downloadpoky-9abab49f2bcac3ea80f96f837e181904bfae8848.tar.gz
bitbake: lib/bb: Clean up use of len()
(Bitbake rev: bbbc843e86639604d00d76b1949b94a78cf1d95d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-diffsigs4
-rw-r--r--bitbake/lib/bb/cooker.py6
-rw-r--r--bitbake/lib/bb/cookerdata.py2
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py4
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py2
-rw-r--r--bitbake/lib/bb/runqueue.py66
-rw-r--r--bitbake/lib/bb/taskdata.py4
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py20
-rw-r--r--bitbake/lib/bb/ui/uievent.py4
9 files changed, 56 insertions, 56 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 6646dccdfa..cf4cc706a2 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -60,7 +60,7 @@ def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None):
60 60
61 if sig1 and sig2: 61 if sig1 and sig2:
62 sigfiles = find_siginfo(bbhandler, pn, taskname, [sig1, sig2]) 62 sigfiles = find_siginfo(bbhandler, pn, taskname, [sig1, sig2])
63 if len(sigfiles) == 0: 63 if not sigfiles:
64 logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2)) 64 logger.error('No sigdata files found matching %s %s matching either %s or %s' % (pn, taskname, sig1, sig2))
65 sys.exit(1) 65 sys.exit(1)
66 elif not sig1 in sigfiles: 66 elif not sig1 in sigfiles:
@@ -86,7 +86,7 @@ def recursecb(key, hash1, hash2):
86 hashfiles = find_siginfo(tinfoil, key, None, hashes) 86 hashfiles = find_siginfo(tinfoil, key, None, hashes)
87 87
88 recout = [] 88 recout = []
89 if len(hashfiles) == 0: 89 if not hashfiles:
90 recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2)) 90 recout.append("Unable to find matching sigdata for %s with hashes %s or %s" % (key, hash1, hash2))
91 elif not hash1 in hashfiles: 91 elif not hash1 in hashfiles:
92 recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1)) 92 recout.append("Unable to find matching sigdata for %s with hash %s" % (key, hash1))
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index af794b4c42..194595ce8b 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1656,7 +1656,7 @@ class BBCooker:
1656 # Return a copy, don't modify the original 1656 # Return a copy, don't modify the original
1657 pkgs_to_build = pkgs_to_build[:] 1657 pkgs_to_build = pkgs_to_build[:]
1658 1658
1659 if len(pkgs_to_build) == 0: 1659 if not pkgs_to_build:
1660 raise NothingToBuild 1660 raise NothingToBuild
1661 1661
1662 ignore = (self.data.getVar("ASSUME_PROVIDED") or "").split() 1662 ignore = (self.data.getVar("ASSUME_PROVIDED") or "").split()
@@ -1795,10 +1795,10 @@ class CookerCollectFiles(object):
1795 files.sort( key=lambda fileitem: self.calc_bbfile_priority(fileitem)[0] ) 1795 files.sort( key=lambda fileitem: self.calc_bbfile_priority(fileitem)[0] )
1796 config.setVar("BBFILES_PRIORITIZED", " ".join(files)) 1796 config.setVar("BBFILES_PRIORITIZED", " ".join(files))
1797 1797
1798 if not len(files): 1798 if not files:
1799 files = self.get_bbfiles() 1799 files = self.get_bbfiles()
1800 1800
1801 if not len(files): 1801 if not files:
1802 collectlog.error("no recipe files to build, check your BBPATH and BBFILES?") 1802 collectlog.error("no recipe files to build, check your BBPATH and BBFILES?")
1803 bb.event.fire(CookerExit(), eventdata) 1803 bb.event.fire(CookerExit(), eventdata)
1804 1804
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index ba657c03b6..592bc2968e 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -86,7 +86,7 @@ class ConfigParameters(object):
86 action['msg'] = "Only one target can be used with the --environment option." 86 action['msg'] = "Only one target can be used with the --environment option."
87 elif self.options.buildfile and len(self.options.pkgs_to_build) > 0: 87 elif self.options.buildfile and len(self.options.pkgs_to_build) > 0:
88 action['msg'] = "No target should be used with the --environment and --buildfile options." 88 action['msg'] = "No target should be used with the --environment and --buildfile options."
89 elif len(self.options.pkgs_to_build) > 0: 89 elif self.options.pkgs_to_build:
90 action['action'] = ["showEnvironmentTarget", self.options.pkgs_to_build] 90 action['action'] = ["showEnvironmentTarget", self.options.pkgs_to_build]
91 else: 91 else:
92 action['action'] = ["showEnvironment", self.options.buildfile] 92 action['action'] = ["showEnvironment", self.options.buildfile]
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 000b49a500..1d6e4e0964 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -770,7 +770,7 @@ def get_srcrev(d, method_name='sortable_revision'):
770 if urldata[u].method.supports_srcrev(): 770 if urldata[u].method.supports_srcrev():
771 scms.append(u) 771 scms.append(u)
772 772
773 if len(scms) == 0: 773 if not scms:
774 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI") 774 raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
775 775
776 if len(scms) == 1 and len(urldata[scms[0]].names) == 1: 776 if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
@@ -1636,7 +1636,7 @@ class Fetch(object):
1636 if localonly and cache: 1636 if localonly and cache:
1637 raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time") 1637 raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time")
1638 1638
1639 if len(urls) == 0: 1639 if not urls:
1640 urls = d.getVar("SRC_URI").split() 1640 urls = d.getVar("SRC_URI").split()
1641 self.urls = urls 1641 self.urls = urls
1642 self.d = d 1642 self.d = d
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index a7110a988d..c5c23d5260 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -163,7 +163,7 @@ class GitSM(Git):
163 else: 163 else:
164 self.process_submodules(ud, ud.clonedir, need_update_submodule, d) 164 self.process_submodules(ud, ud.clonedir, need_update_submodule, d)
165 165
166 if len(need_update_list) > 0: 166 if need_update_list:
167 logger.debug('gitsm: Submodules requiring update: %s' % (' '.join(need_update_list))) 167 logger.debug('gitsm: Submodules requiring update: %s' % (' '.join(need_update_list)))
168 return True 168 return True
169 169
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 10511a09dc..87c00462c1 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -547,7 +547,7 @@ class RunQueueData:
547 next_points.append(revdep) 547 next_points.append(revdep)
548 task_done[revdep] = True 548 task_done[revdep] = True
549 endpoints = next_points 549 endpoints = next_points
550 if len(next_points) == 0: 550 if not next_points:
551 break 551 break
552 552
553 # Circular dependency sanity check 553 # Circular dependency sanity check
@@ -589,7 +589,7 @@ class RunQueueData:
589 589
590 found = False 590 found = False
591 for mc in self.taskData: 591 for mc in self.taskData:
592 if len(taskData[mc].taskentries) > 0: 592 if taskData[mc].taskentries:
593 found = True 593 found = True
594 break 594 break
595 if not found: 595 if not found:
@@ -773,7 +773,7 @@ class RunQueueData:
773 # Find the dependency chain endpoints 773 # Find the dependency chain endpoints
774 endpoints = set() 774 endpoints = set()
775 for tid in self.runtaskentries: 775 for tid in self.runtaskentries:
776 if len(deps[tid]) == 0: 776 if not deps[tid]:
777 endpoints.add(tid) 777 endpoints.add(tid)
778 # Iterate the chains collating dependencies 778 # Iterate the chains collating dependencies
779 while endpoints: 779 while endpoints:
@@ -784,11 +784,11 @@ class RunQueueData:
784 cumulativedeps[dep].update(cumulativedeps[tid]) 784 cumulativedeps[dep].update(cumulativedeps[tid])
785 if tid in deps[dep]: 785 if tid in deps[dep]:
786 deps[dep].remove(tid) 786 deps[dep].remove(tid)
787 if len(deps[dep]) == 0: 787 if not deps[dep]:
788 next.add(dep) 788 next.add(dep)
789 endpoints = next 789 endpoints = next
790 #for tid in deps: 790 #for tid in deps:
791 # if len(deps[tid]) != 0: 791 # if deps[tid]:
792 # bb.warn("Sanity test failure, dependencies left for %s (%s)" % (tid, deps[tid])) 792 # bb.warn("Sanity test failure, dependencies left for %s (%s)" % (tid, deps[tid]))
793 793
794 # Loop here since recrdeptasks can depend upon other recrdeptasks and we have to 794 # Loop here since recrdeptasks can depend upon other recrdeptasks and we have to
@@ -958,7 +958,7 @@ class RunQueueData:
958 delcount[tid] = self.runtaskentries[tid] 958 delcount[tid] = self.runtaskentries[tid]
959 del self.runtaskentries[tid] 959 del self.runtaskentries[tid]
960 960
961 if len(self.runtaskentries) == 0: 961 if not self.runtaskentries:
962 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the recipes of the taskgraphs of the targets %s" % (str(self.cooker.configuration.runall), str(self.targets))) 962 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the recipes of the taskgraphs of the targets %s" % (str(self.cooker.configuration.runall), str(self.targets)))
963 963
964 self.init_progress_reporter.next_stage() 964 self.init_progress_reporter.next_stage()
@@ -983,7 +983,7 @@ class RunQueueData:
983 delcount[tid] = self.runtaskentries[tid] 983 delcount[tid] = self.runtaskentries[tid]
984 del self.runtaskentries[tid] 984 del self.runtaskentries[tid]
985 985
986 if len(self.runtaskentries) == 0: 986 if not self.runtaskentries:
987 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the taskgraphs of the targets %s" % (str(self.cooker.configuration.runonly), str(self.targets))) 987 bb.msg.fatal("RunQueue", "Could not find any tasks with the tasknames %s to run within the taskgraphs of the targets %s" % (str(self.cooker.configuration.runonly), str(self.targets)))
988 988
989 # 989 #
@@ -991,7 +991,7 @@ class RunQueueData:
991 # 991 #
992 992
993 # Check to make sure we still have tasks to run 993 # Check to make sure we still have tasks to run
994 if len(self.runtaskentries) == 0: 994 if not self.runtaskentries:
995 if not taskData[''].abort: 995 if not taskData[''].abort:
996 bb.msg.fatal("RunQueue", "All buildable tasks have been run but the build is incomplete (--continue mode). Errors for the tasks that failed will have been printed above.") 996 bb.msg.fatal("RunQueue", "All buildable tasks have been run but the build is incomplete (--continue mode). Errors for the tasks that failed will have been printed above.")
997 else: 997 else:
@@ -1015,7 +1015,7 @@ class RunQueueData:
1015 endpoints = [] 1015 endpoints = []
1016 for tid in self.runtaskentries: 1016 for tid in self.runtaskentries:
1017 revdeps = self.runtaskentries[tid].revdeps 1017 revdeps = self.runtaskentries[tid].revdeps
1018 if len(revdeps) == 0: 1018 if not revdeps:
1019 endpoints.append(tid) 1019 endpoints.append(tid)
1020 for dep in revdeps: 1020 for dep in revdeps:
1021 if dep in self.runtaskentries[tid].depends: 1021 if dep in self.runtaskentries[tid].depends:
@@ -1188,9 +1188,9 @@ class RunQueueData:
1188 # Iterate over the task list and call into the siggen code 1188 # Iterate over the task list and call into the siggen code
1189 dealtwith = set() 1189 dealtwith = set()
1190 todeal = set(self.runtaskentries) 1190 todeal = set(self.runtaskentries)
1191 while len(todeal) > 0: 1191 while todeal:
1192 for tid in todeal.copy(): 1192 for tid in todeal.copy():
1193 if len(self.runtaskentries[tid].depends - dealtwith) == 0: 1193 if not (self.runtaskentries[tid].depends - dealtwith):
1194 dealtwith.add(tid) 1194 dealtwith.add(tid)
1195 todeal.remove(tid) 1195 todeal.remove(tid)
1196 self.prepare_task_hash(tid) 1196 self.prepare_task_hash(tid)
@@ -1500,10 +1500,10 @@ class RunQueue:
1500 self.rqexe = RunQueueExecute(self) 1500 self.rqexe = RunQueueExecute(self)
1501 1501
1502 # If we don't have any setscene functions, skip execution 1502 # If we don't have any setscene functions, skip execution
1503 if len(self.rqdata.runq_setscene_tids) == 0: 1503 if not self.rqdata.runq_setscene_tids:
1504 logger.info('No setscene tasks') 1504 logger.info('No setscene tasks')
1505 for tid in self.rqdata.runtaskentries: 1505 for tid in self.rqdata.runtaskentries:
1506 if len(self.rqdata.runtaskentries[tid].depends) == 0: 1506 if not self.rqdata.runtaskentries[tid].depends:
1507 self.rqexe.setbuildable(tid) 1507 self.rqexe.setbuildable(tid)
1508 self.rqexe.tasks_notcovered.add(tid) 1508 self.rqexe.tasks_notcovered.add(tid)
1509 self.rqexe.sqdone = True 1509 self.rqexe.sqdone = True
@@ -1780,7 +1780,7 @@ class RunQueueExecute:
1780 bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" % 1780 bb.fatal("Invalid scheduler '%s'. Available schedulers: %s" %
1781 (self.scheduler, ", ".join(obj.name for obj in schedulers))) 1781 (self.scheduler, ", ".join(obj.name for obj in schedulers)))
1782 1782
1783 #if len(self.rqdata.runq_setscene_tids) > 0: 1783 #if self.rqdata.runq_setscene_tids:
1784 self.sqdata = SQData() 1784 self.sqdata = SQData()
1785 build_scenequeue_data(self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self) 1785 build_scenequeue_data(self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self)
1786 1786
@@ -1821,7 +1821,7 @@ class RunQueueExecute:
1821 # worker must have died? 1821 # worker must have died?
1822 pass 1822 pass
1823 1823
1824 if len(self.failed_tids) != 0: 1824 if self.failed_tids:
1825 self.rq.state = runQueueFailed 1825 self.rq.state = runQueueFailed
1826 return 1826 return
1827 1827
@@ -1837,7 +1837,7 @@ class RunQueueExecute:
1837 self.rq.read_workers() 1837 self.rq.read_workers()
1838 return self.rq.active_fds() 1838 return self.rq.active_fds()
1839 1839
1840 if len(self.failed_tids) != 0: 1840 if self.failed_tids:
1841 self.rq.state = runQueueFailed 1841 self.rq.state = runQueueFailed
1842 return True 1842 return True
1843 1843
@@ -2001,7 +2001,7 @@ class RunQueueExecute:
2001 if x not in self.tasks_scenequeue_done: 2001 if x not in self.tasks_scenequeue_done:
2002 logger.error("Task %s was never processed by the setscene code" % x) 2002 logger.error("Task %s was never processed by the setscene code" % x)
2003 err = True 2003 err = True
2004 if len(self.rqdata.runtaskentries[x].depends) == 0 and x not in self.runq_buildable: 2004 if not self.rqdata.runtaskentries[x].depends and x not in self.runq_buildable:
2005 logger.error("Task %s was never marked as buildable by the setscene code" % x) 2005 logger.error("Task %s was never marked as buildable by the setscene code" % x)
2006 err = True 2006 err = True
2007 return err 2007 return err
@@ -2025,7 +2025,7 @@ class RunQueueExecute:
2025 # Find the next setscene to run 2025 # Find the next setscene to run
2026 for nexttask in self.sorted_setscene_tids: 2026 for nexttask in self.sorted_setscene_tids:
2027 if nexttask in self.sq_buildable and nexttask not in self.sq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values(): 2027 if nexttask in self.sq_buildable and nexttask not in self.sq_running and self.sqdata.stamps[nexttask] not in self.build_stamps.values():
2028 if nexttask not in self.sqdata.unskippable and len(self.sqdata.sq_revdeps[nexttask]) > 0 and self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and self.check_dependencies(nexttask, self.sqdata.sq_revdeps[nexttask]): 2028 if nexttask not in self.sqdata.unskippable and self.sqdata.sq_revdeps[nexttask] and self.sqdata.sq_revdeps[nexttask].issubset(self.scenequeue_covered) and self.check_dependencies(nexttask, self.sqdata.sq_revdeps[nexttask]):
2029 if nexttask not in self.rqdata.target_tids: 2029 if nexttask not in self.rqdata.target_tids:
2030 logger.debug2("Skipping setscene for task %s" % nexttask) 2030 logger.debug2("Skipping setscene for task %s" % nexttask)
2031 self.sq_task_skip(nexttask) 2031 self.sq_task_skip(nexttask)
@@ -2189,7 +2189,7 @@ class RunQueueExecute:
2189 if self.can_start_task(): 2189 if self.can_start_task():
2190 return True 2190 return True
2191 2191
2192 if self.stats.active > 0 or len(self.sq_live) > 0: 2192 if self.stats.active > 0 or self.sq_live:
2193 self.rq.read_workers() 2193 self.rq.read_workers()
2194 return self.rq.active_fds() 2194 return self.rq.active_fds()
2195 2195
@@ -2201,7 +2201,7 @@ class RunQueueExecute:
2201 self.sq_task_failoutright(tid) 2201 self.sq_task_failoutright(tid)
2202 return True 2202 return True
2203 2203
2204 if len(self.failed_tids) != 0: 2204 if self.failed_tids:
2205 self.rq.state = runQueueFailed 2205 self.rq.state = runQueueFailed
2206 return True 2206 return True
2207 2207
@@ -2280,7 +2280,7 @@ class RunQueueExecute:
2280 covered.intersection_update(self.tasks_scenequeue_done) 2280 covered.intersection_update(self.tasks_scenequeue_done)
2281 2281
2282 for tid in notcovered | covered: 2282 for tid in notcovered | covered:
2283 if len(self.rqdata.runtaskentries[tid].depends) == 0: 2283 if not self.rqdata.runtaskentries[tid].depends:
2284 self.setbuildable(tid) 2284 self.setbuildable(tid)
2285 elif self.rqdata.runtaskentries[tid].depends.issubset(self.runq_complete): 2285 elif self.rqdata.runtaskentries[tid].depends.issubset(self.runq_complete):
2286 self.setbuildable(tid) 2286 self.setbuildable(tid)
@@ -2339,7 +2339,7 @@ class RunQueueExecute:
2339 # Now iterate those tasks in dependency order to regenerate their taskhash/unihash 2339 # Now iterate those tasks in dependency order to regenerate their taskhash/unihash
2340 next = set() 2340 next = set()
2341 for p in total: 2341 for p in total:
2342 if len(self.rqdata.runtaskentries[p].depends) == 0: 2342 if not self.rqdata.runtaskentries[p].depends:
2343 next.add(p) 2343 next.add(p)
2344 elif self.rqdata.runtaskentries[p].depends.isdisjoint(total): 2344 elif self.rqdata.runtaskentries[p].depends.isdisjoint(total):
2345 next.add(p) 2345 next.add(p)
@@ -2349,7 +2349,7 @@ class RunQueueExecute:
2349 current = next.copy() 2349 current = next.copy()
2350 next = set() 2350 next = set()
2351 for tid in current: 2351 for tid in current:
2352 if len(self.rqdata.runtaskentries[p].depends) and not self.rqdata.runtaskentries[tid].depends.isdisjoint(total): 2352 if self.rqdata.runtaskentries[p].depends and not self.rqdata.runtaskentries[tid].depends.isdisjoint(total):
2353 continue 2353 continue
2354 orighash = self.rqdata.runtaskentries[tid].hash 2354 orighash = self.rqdata.runtaskentries[tid].hash
2355 dc = bb.parse.siggen.get_data_caches(self.rqdata.dataCaches, mc_from_tid(tid)) 2355 dc = bb.parse.siggen.get_data_caches(self.rqdata.dataCaches, mc_from_tid(tid))
@@ -2436,7 +2436,7 @@ class RunQueueExecute:
2436 if not harddepfail and self.sqdata.sq_revdeps[tid].issubset(self.scenequeue_covered | self.scenequeue_notcovered): 2436 if not harddepfail and self.sqdata.sq_revdeps[tid].issubset(self.scenequeue_covered | self.scenequeue_notcovered):
2437 if tid not in self.sq_buildable: 2437 if tid not in self.sq_buildable:
2438 self.sq_buildable.add(tid) 2438 self.sq_buildable.add(tid)
2439 if len(self.sqdata.sq_revdeps[tid]) == 0: 2439 if not self.sqdata.sq_revdeps[tid]:
2440 self.sq_buildable.add(tid) 2440 self.sq_buildable.add(tid)
2441 2441
2442 if tid in self.sqdata.outrightfail: 2442 if tid in self.sqdata.outrightfail:
@@ -2652,7 +2652,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2652 for tid in rqdata.runtaskentries: 2652 for tid in rqdata.runtaskentries:
2653 sq_revdeps[tid] = copy.copy(rqdata.runtaskentries[tid].revdeps) 2653 sq_revdeps[tid] = copy.copy(rqdata.runtaskentries[tid].revdeps)
2654 sq_revdeps_squash[tid] = set() 2654 sq_revdeps_squash[tid] = set()
2655 if (len(sq_revdeps[tid]) == 0) and tid not in rqdata.runq_setscene_tids: 2655 if not sq_revdeps[tid] and tid not in rqdata.runq_setscene_tids:
2656 #bb.warn("Added endpoint %s" % (tid)) 2656 #bb.warn("Added endpoint %s" % (tid))
2657 endpoints[tid] = set() 2657 endpoints[tid] = set()
2658 2658
@@ -2693,9 +2693,9 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2693 sq_revdeps[dep].remove(point) 2693 sq_revdeps[dep].remove(point)
2694 if tasks: 2694 if tasks:
2695 sq_revdeps_squash[dep] |= tasks 2695 sq_revdeps_squash[dep] |= tasks
2696 if len(sq_revdeps[dep]) == 0 and dep not in rqdata.runq_setscene_tids: 2696 if not sq_revdeps[dep] and dep not in rqdata.runq_setscene_tids:
2697 newendpoints[dep] = task 2697 newendpoints[dep] = task
2698 if len(newendpoints) != 0: 2698 if newendpoints:
2699 process_endpoints(newendpoints) 2699 process_endpoints(newendpoints)
2700 2700
2701 process_endpoints(endpoints) 2701 process_endpoints(endpoints)
@@ -2707,7 +2707,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2707 # Take the build endpoints (no revdeps) and find the sstate tasks they depend upon 2707 # Take the build endpoints (no revdeps) and find the sstate tasks they depend upon
2708 new = True 2708 new = True
2709 for tid in rqdata.runtaskentries: 2709 for tid in rqdata.runtaskentries:
2710 if len(rqdata.runtaskentries[tid].revdeps) == 0: 2710 if not rqdata.runtaskentries[tid].revdeps:
2711 sqdata.unskippable.add(tid) 2711 sqdata.unskippable.add(tid)
2712 sqdata.unskippable |= sqrq.cantskip 2712 sqdata.unskippable |= sqrq.cantskip
2713 while new: 2713 while new:
@@ -2716,7 +2716,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2716 for tid in sorted(orig, reverse=True): 2716 for tid in sorted(orig, reverse=True):
2717 if tid in rqdata.runq_setscene_tids: 2717 if tid in rqdata.runq_setscene_tids:
2718 continue 2718 continue
2719 if len(rqdata.runtaskentries[tid].depends) == 0: 2719 if not rqdata.runtaskentries[tid].depends:
2720 # These are tasks which have no setscene tasks in their chain, need to mark as directly buildable 2720 # These are tasks which have no setscene tasks in their chain, need to mark as directly buildable
2721 sqrq.setbuildable(tid) 2721 sqrq.setbuildable(tid)
2722 sqdata.unskippable |= rqdata.runtaskentries[tid].depends 2722 sqdata.unskippable |= rqdata.runtaskentries[tid].depends
@@ -2731,7 +2731,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2731 for taskcounter, tid in enumerate(rqdata.runtaskentries): 2731 for taskcounter, tid in enumerate(rqdata.runtaskentries):
2732 if tid in rqdata.runq_setscene_tids: 2732 if tid in rqdata.runq_setscene_tids:
2733 pass 2733 pass
2734 elif len(sq_revdeps_squash[tid]) != 0: 2734 elif sq_revdeps_squash[tid]:
2735 bb.msg.fatal("RunQueue", "Something went badly wrong during scenequeue generation, aborting. Please report this problem.") 2735 bb.msg.fatal("RunQueue", "Something went badly wrong during scenequeue generation, aborting. Please report this problem.")
2736 else: 2736 else:
2737 del sq_revdeps_squash[tid] 2737 del sq_revdeps_squash[tid]
@@ -2796,7 +2796,7 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
2796 sqdata.multiconfigs = set() 2796 sqdata.multiconfigs = set()
2797 for tid in sqdata.sq_revdeps: 2797 for tid in sqdata.sq_revdeps:
2798 sqdata.multiconfigs.add(mc_from_tid(tid)) 2798 sqdata.multiconfigs.add(mc_from_tid(tid))
2799 if len(sqdata.sq_revdeps[tid]) == 0: 2799 if not sqdata.sq_revdeps[tid]:
2800 sqrq.sq_buildable.add(tid) 2800 sqrq.sq_buildable.add(tid)
2801 2801
2802 rqdata.init_progress_reporter.finish() 2802 rqdata.init_progress_reporter.finish()
@@ -3050,7 +3050,7 @@ class runQueuePipe():
3050 raise 3050 raise
3051 end = len(self.queue) 3051 end = len(self.queue)
3052 found = True 3052 found = True
3053 while found and len(self.queue): 3053 while found and self.queue:
3054 found = False 3054 found = False
3055 index = self.queue.find(b"</event>") 3055 index = self.queue.find(b"</event>")
3056 while index != -1 and self.queue.startswith(b"<event>"): 3056 while index != -1 and self.queue.startswith(b"<event>"):
@@ -3088,7 +3088,7 @@ class runQueuePipe():
3088 def close(self): 3088 def close(self):
3089 while self.read(): 3089 while self.read():
3090 continue 3090 continue
3091 if len(self.queue) > 0: 3091 if self.queue:
3092 print("Warning, worker left partial message: %s" % self.queue) 3092 print("Warning, worker left partial message: %s" % self.queue)
3093 self.input.close() 3093 self.input.close()
3094 3094
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py
index 47bad6d1fa..7bfcdb8414 100644
--- a/bitbake/lib/bb/taskdata.py
+++ b/bitbake/lib/bb/taskdata.py
@@ -451,12 +451,12 @@ class TaskData:
451 for target in self.build_targets: 451 for target in self.build_targets:
452 if fn in self.build_targets[target]: 452 if fn in self.build_targets[target]:
453 self.build_targets[target].remove(fn) 453 self.build_targets[target].remove(fn)
454 if len(self.build_targets[target]) == 0: 454 if not self.build_targets[target]:
455 self.remove_buildtarget(target, missing_list) 455 self.remove_buildtarget(target, missing_list)
456 for target in self.run_targets: 456 for target in self.run_targets:
457 if fn in self.run_targets[target]: 457 if fn in self.run_targets[target]:
458 self.run_targets[target].remove(fn) 458 self.run_targets[target].remove(fn)
459 if len(self.run_targets[target]) == 0: 459 if not self.run_targets[target]:
460 self.remove_runtarget(target, missing_list) 460 self.remove_runtarget(target, missing_list)
461 461
462 def remove_buildtarget(self, target, missing_list=None): 462 def remove_buildtarget(self, target, missing_list=None):
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 43aa592842..8588849dd4 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -483,11 +483,11 @@ class ORMWrapper(object):
483 483
484 # we already created the root directory, so ignore any 484 # we already created the root directory, so ignore any
485 # entry for it 485 # entry for it
486 if len(path) == 0: 486 if not path:
487 continue 487 continue
488 488
489 parent_path = "/".join(path.split("/")[:len(path.split("/")) - 1]) 489 parent_path = "/".join(path.split("/")[:len(path.split("/")) - 1])
490 if len(parent_path) == 0: 490 if not parent_path:
491 parent_path = "/" 491 parent_path = "/"
492 parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY) 492 parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY)
493 tf_obj = Target_File.objects.create( 493 tf_obj = Target_File.objects.create(
@@ -633,7 +633,7 @@ class ORMWrapper(object):
633 packagefile_objects.append(Package_File( package = packagedict[p]['object'], 633 packagefile_objects.append(Package_File( package = packagedict[p]['object'],
634 path = targetpath, 634 path = targetpath,
635 size = targetfilesize)) 635 size = targetfilesize))
636 if len(packagefile_objects): 636 if packagefile_objects:
637 Package_File.objects.bulk_create(packagefile_objects) 637 Package_File.objects.bulk_create(packagefile_objects)
638 except KeyError as e: 638 except KeyError as e:
639 errormsg += " stpi: Key error, package %s key %s \n" % ( p, e ) 639 errormsg += " stpi: Key error, package %s key %s \n" % ( p, e )
@@ -673,7 +673,7 @@ class ORMWrapper(object):
673 logger.warning("Could not add dependency to the package %s " 673 logger.warning("Could not add dependency to the package %s "
674 "because %s is an unknown package", p, px) 674 "because %s is an unknown package", p, px)
675 675
676 if len(packagedeps_objs) > 0: 676 if packagedeps_objs:
677 Package_Dependency.objects.bulk_create(packagedeps_objs) 677 Package_Dependency.objects.bulk_create(packagedeps_objs)
678 else: 678 else:
679 logger.info("No package dependencies created") 679 logger.info("No package dependencies created")
@@ -767,7 +767,7 @@ class ORMWrapper(object):
767 packagefile_objects.append(Package_File( package = bp_object, 767 packagefile_objects.append(Package_File( package = bp_object,
768 path = path, 768 path = path,
769 size = package_info['FILES_INFO'][path] )) 769 size = package_info['FILES_INFO'][path] ))
770 if len(packagefile_objects): 770 if packagefile_objects:
771 Package_File.objects.bulk_create(packagefile_objects) 771 Package_File.objects.bulk_create(packagefile_objects)
772 772
773 def _po_byname(p): 773 def _po_byname(p):
@@ -809,7 +809,7 @@ class ORMWrapper(object):
809 packagedeps_objs.append(Package_Dependency( package = bp_object, 809 packagedeps_objs.append(Package_Dependency( package = bp_object,
810 depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RCONFLICTS)) 810 depends_on = _po_byname(p), dep_type = Package_Dependency.TYPE_RCONFLICTS))
811 811
812 if len(packagedeps_objs) > 0: 812 if packagedeps_objs:
813 Package_Dependency.objects.bulk_create(packagedeps_objs) 813 Package_Dependency.objects.bulk_create(packagedeps_objs)
814 814
815 return bp_object 815 return bp_object
@@ -826,7 +826,7 @@ class ORMWrapper(object):
826 desc = vardump[root_var]['doc'] 826 desc = vardump[root_var]['doc']
827 if desc is None: 827 if desc is None:
828 desc = '' 828 desc = ''
829 if len(desc): 829 if desc:
830 HelpText.objects.get_or_create(build=build_obj, 830 HelpText.objects.get_or_create(build=build_obj,
831 area=HelpText.VARIABLE, 831 area=HelpText.VARIABLE,
832 key=k, text=desc) 832 key=k, text=desc)
@@ -846,7 +846,7 @@ class ORMWrapper(object):
846 file_name = vh['file'], 846 file_name = vh['file'],
847 line_number = vh['line'], 847 line_number = vh['line'],
848 operation = vh['op'])) 848 operation = vh['op']))
849 if len(varhist_objects): 849 if varhist_objects:
850 VariableHistory.objects.bulk_create(varhist_objects) 850 VariableHistory.objects.bulk_create(varhist_objects)
851 851
852 852
@@ -1069,7 +1069,7 @@ class BuildInfoHelper(object):
1069 for t in self.internal_state['targets']: 1069 for t in self.internal_state['targets']:
1070 buildname = self.internal_state['build'].build_name 1070 buildname = self.internal_state['build'].build_name
1071 pe, pv = task_object.recipe.version.split(":",1) 1071 pe, pv = task_object.recipe.version.split(":",1)
1072 if len(pe) > 0: 1072 if pe:
1073 package = task_object.recipe.name + "-" + pe + "_" + pv 1073 package = task_object.recipe.name + "-" + pe + "_" + pv
1074 else: 1074 else:
1075 package = task_object.recipe.name + "-" + pv 1075 package = task_object.recipe.name + "-" + pv
@@ -1618,7 +1618,7 @@ class BuildInfoHelper(object):
1618 1618
1619 if 'backlog' in self.internal_state: 1619 if 'backlog' in self.internal_state:
1620 # if we have a backlog of events, do our best to save them here 1620 # if we have a backlog of events, do our best to save them here
1621 if len(self.internal_state['backlog']): 1621 if self.internal_state['backlog']:
1622 tempevent = self.internal_state['backlog'].pop() 1622 tempevent = self.internal_state['backlog'].pop()
1623 logger.debug("buildinfohelper: Saving stored event %s " 1623 logger.debug("buildinfohelper: Saving stored event %s "
1624 % tempevent) 1624 % tempevent)
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py
index 8607d0523b..e19c770bc9 100644
--- a/bitbake/lib/bb/ui/uievent.py
+++ b/bitbake/lib/bb/ui/uievent.py
@@ -73,13 +73,13 @@ class BBUIEventQueue:
73 73
74 self.eventQueueLock.acquire() 74 self.eventQueueLock.acquire()
75 75
76 if len(self.eventQueue) == 0: 76 if not self.eventQueue:
77 self.eventQueueLock.release() 77 self.eventQueueLock.release()
78 return None 78 return None
79 79
80 item = self.eventQueue.pop(0) 80 item = self.eventQueue.pop(0)
81 81
82 if len(self.eventQueue) == 0: 82 if not self.eventQueue:
83 self.eventQueueNotify.clear() 83 self.eventQueueNotify.clear()
84 84
85 self.eventQueueLock.release() 85 self.eventQueueLock.release()