diff options
author | Frazer Clews <frazer.clews@codethink.co.uk> | 2020-01-16 17:11:19 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-19 13:31:05 +0000 |
commit | fa5524890e86d353ee7d2194ccdd6c84e9bd2d31 (patch) | |
tree | f3d46ddbd5dd2b772a727b04303bb97b8ae43b9b /bitbake/lib | |
parent | 0ac5174c7d39a3e49893df0d517d47bec1935555 (diff) | |
download | poky-fa5524890e86d353ee7d2194ccdd6c84e9bd2d31.tar.gz |
bitbake: lib: amend code to use proper singleton comparisons where possible
amend the code to handle singleton comparisons properly so it only checks
if they only refer to the same object or not, and not bother
comparing the values.
(Bitbake rev: b809a6812aa15a8a9af97bc382cc4b19571e6bfc)
Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
28 files changed, 65 insertions, 65 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 378f389b3a..c8e1352865 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py | |||
@@ -65,7 +65,7 @@ class Command: | |||
65 | # Can run synchronous commands straight away | 65 | # Can run synchronous commands straight away |
66 | command_method = getattr(self.cmds_sync, command) | 66 | command_method = getattr(self.cmds_sync, command) |
67 | if ro_only: | 67 | if ro_only: |
68 | if not hasattr(command_method, 'readonly') or False == getattr(command_method, 'readonly'): | 68 | if not hasattr(command_method, 'readonly') or not getattr(command_method, 'readonly'): |
69 | return None, "Not able to execute not readonly commands in readonly mode" | 69 | return None, "Not able to execute not readonly commands in readonly mode" |
70 | try: | 70 | try: |
71 | self.cooker.process_inotify_updates() | 71 | self.cooker.process_inotify_updates() |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 3d65b0cb74..8407db8b00 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1204,7 +1204,7 @@ class BBCooker: | |||
1204 | for c in collection_list: | 1204 | for c in collection_list: |
1205 | calc_layer_priority(c) | 1205 | calc_layer_priority(c) |
1206 | regex = self.data.getVar("BBFILE_PATTERN_%s" % c) | 1206 | regex = self.data.getVar("BBFILE_PATTERN_%s" % c) |
1207 | if regex == None: | 1207 | if regex is None: |
1208 | parselog.error("BBFILE_PATTERN_%s not defined" % c) | 1208 | parselog.error("BBFILE_PATTERN_%s not defined" % c) |
1209 | errors = True | 1209 | errors = True |
1210 | continue | 1210 | continue |
@@ -1310,7 +1310,7 @@ class BBCooker: | |||
1310 | self.parseConfiguration() | 1310 | self.parseConfiguration() |
1311 | 1311 | ||
1312 | # If we are told to do the None task then query the default task | 1312 | # If we are told to do the None task then query the default task |
1313 | if (task == None): | 1313 | if task is None: |
1314 | task = self.configuration.cmd | 1314 | task = self.configuration.cmd |
1315 | if not task.startswith("do_"): | 1315 | if not task.startswith("do_"): |
1316 | task = "do_%s" % task | 1316 | task = "do_%s" % task |
@@ -1454,7 +1454,7 @@ class BBCooker: | |||
1454 | self.buildSetVars() | 1454 | self.buildSetVars() |
1455 | 1455 | ||
1456 | # If we are told to do the None task then query the default task | 1456 | # If we are told to do the None task then query the default task |
1457 | if (task == None): | 1457 | if task is None: |
1458 | task = self.configuration.cmd | 1458 | task = self.configuration.cmd |
1459 | 1459 | ||
1460 | if not task.startswith("do_"): | 1460 | if not task.startswith("do_"): |
@@ -1687,7 +1687,7 @@ class CookerCollectFiles(object): | |||
1687 | def calc_bbfile_priority( self, filename, matched = None ): | 1687 | def calc_bbfile_priority( self, filename, matched = None ): |
1688 | for _, _, regex, pri in self.bbfile_config_priorities: | 1688 | for _, _, regex, pri in self.bbfile_config_priorities: |
1689 | if regex.match(filename): | 1689 | if regex.match(filename): |
1690 | if matched != None: | 1690 | if matched is not None: |
1691 | if not regex in matched: | 1691 | if not regex in matched: |
1692 | matched.add(regex) | 1692 | matched.add(regex) |
1693 | return pri | 1693 | return pri |
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index 0d75d0c1a9..6dc02172cb 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -79,7 +79,7 @@ def expand(s, d, varname = None): | |||
79 | return d.expand(s, varname) | 79 | return d.expand(s, varname) |
80 | 80 | ||
81 | def expandKeys(alterdata, readdata = None): | 81 | def expandKeys(alterdata, readdata = None): |
82 | if readdata == None: | 82 | if readdata is None: |
83 | readdata = alterdata | 83 | readdata = alterdata |
84 | 84 | ||
85 | todolist = {} | 85 | todolist = {} |
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 42143e7407..5cfbf36126 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -346,7 +346,7 @@ def set_UIHmask(handlerNum, level, debug_domains, mask): | |||
346 | 346 | ||
347 | def getName(e): | 347 | def getName(e): |
348 | """Returns the name of a class or class instance""" | 348 | """Returns the name of a class or class instance""" |
349 | if getattr(e, "__name__", None) == None: | 349 | if getattr(e, "__name__", None) is None: |
350 | return e.__class__.__name__ | 350 | return e.__class__.__name__ |
351 | else: | 351 | else: |
352 | return e.__name__ | 352 | return e.__name__ |
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 731c160892..18a6819d5d 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -1081,7 +1081,7 @@ def try_mirrors(fetch, d, origud, mirrors, check = False): | |||
1081 | 1081 | ||
1082 | for index, uri in enumerate(uris): | 1082 | for index, uri in enumerate(uris): |
1083 | ret = try_mirror_url(fetch, origud, uds[index], ld, check) | 1083 | ret = try_mirror_url(fetch, origud, uds[index], ld, check) |
1084 | if ret != False: | 1084 | if ret: |
1085 | return ret | 1085 | return ret |
1086 | return None | 1086 | return None |
1087 | 1087 | ||
@@ -1351,7 +1351,7 @@ class FetchMethod(object): | |||
1351 | """ | 1351 | """ |
1352 | 1352 | ||
1353 | # We cannot compute checksums for directories | 1353 | # We cannot compute checksums for directories |
1354 | if os.path.isdir(urldata.localpath) == True: | 1354 | if os.path.isdir(urldata.localpath): |
1355 | return False | 1355 | return False |
1356 | if urldata.localpath.find("*") != -1: | 1356 | if urldata.localpath.find("*") != -1: |
1357 | return False | 1357 | return False |
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index fa41b078f1..fe0a384af2 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -671,7 +671,7 @@ class Git(FetchMethod): | |||
671 | 671 | ||
672 | # search for version in the line | 672 | # search for version in the line |
673 | tag = tagregex.search(tag_head) | 673 | tag = tagregex.search(tag_head) |
674 | if tag == None: | 674 | if tag is None: |
675 | continue | 675 | continue |
676 | 676 | ||
677 | tag = tag.group('pver') | 677 | tag = tag.group('pver') |
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index f55db6f791..8f091efd02 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py | |||
@@ -41,7 +41,7 @@ class Osc(FetchMethod): | |||
41 | else: | 41 | else: |
42 | pv = d.getVar("PV", False) | 42 | pv = d.getVar("PV", False) |
43 | rev = bb.fetch2.srcrev_internal_helper(ud, d) | 43 | rev = bb.fetch2.srcrev_internal_helper(ud, d) |
44 | if rev and rev != True: | 44 | if rev: |
45 | ud.revision = rev | 45 | ud.revision = rev |
46 | else: | 46 | else: |
47 | ud.revision = "" | 47 | ud.revision = "" |
diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index b2ac11ecab..f57c2a4f52 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py | |||
@@ -104,7 +104,7 @@ class Perforce(FetchMethod): | |||
104 | if command == 'changes': | 104 | if command == 'changes': |
105 | p4cmd = '%s%s changes -m 1 //%s' % (ud.basecmd, p4opt, pathnrev) | 105 | p4cmd = '%s%s changes -m 1 //%s' % (ud.basecmd, p4opt, pathnrev) |
106 | elif command == 'print': | 106 | elif command == 'print': |
107 | if depot_filename != None: | 107 | if depot_filename is not None: |
108 | p4cmd = '%s%s print -o "p4/%s" "%s"' % (ud.basecmd, p4opt, filename, depot_filename) | 108 | p4cmd = '%s%s print -o "p4/%s" "%s"' % (ud.basecmd, p4opt, filename, depot_filename) |
109 | else: | 109 | else: |
110 | raise FetchError('No depot file name provided to p4 %s' % command, ud.url) | 110 | raise FetchError('No depot file name provided to p4 %s' % command, ud.url) |
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 34debe399b..5e982ecf38 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py | |||
@@ -58,7 +58,7 @@ class SSH(FetchMethod): | |||
58 | '''Class to fetch a module or modules via Secure Shell''' | 58 | '''Class to fetch a module or modules via Secure Shell''' |
59 | 59 | ||
60 | def supports(self, urldata, d): | 60 | def supports(self, urldata, d): |
61 | return __pattern__.match(urldata.url) != None | 61 | return __pattern__.match(urldata.url) is not None |
62 | 62 | ||
63 | def supports_checksum(self, urldata): | 63 | def supports_checksum(self, urldata): |
64 | return False | 64 | return False |
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 362c1a39ce..eb8cfa21b8 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -89,7 +89,7 @@ class DataNode(AstNode): | |||
89 | self.groupd = groupd | 89 | self.groupd = groupd |
90 | 90 | ||
91 | def getFunc(self, key, data): | 91 | def getFunc(self, key, data): |
92 | if 'flag' in self.groupd and self.groupd['flag'] != None: | 92 | if 'flag' in self.groupd and self.groupd['flag'] is not None: |
93 | return data.getVarFlag(key, self.groupd['flag'], expand=False, noweakdefault=True) | 93 | return data.getVarFlag(key, self.groupd['flag'], expand=False, noweakdefault=True) |
94 | else: | 94 | else: |
95 | return data.getVar(key, False, noweakdefault=True, parsing=True) | 95 | return data.getVar(key, False, noweakdefault=True, parsing=True) |
@@ -102,36 +102,36 @@ class DataNode(AstNode): | |||
102 | 'file': self.filename, | 102 | 'file': self.filename, |
103 | 'line': self.lineno, | 103 | 'line': self.lineno, |
104 | } | 104 | } |
105 | if "exp" in groupd and groupd["exp"] != None: | 105 | if "exp" in groupd and groupd["exp"] is not None: |
106 | data.setVarFlag(key, "export", 1, op = 'exported', **loginfo) | 106 | data.setVarFlag(key, "export", 1, op = 'exported', **loginfo) |
107 | 107 | ||
108 | op = "set" | 108 | op = "set" |
109 | if "ques" in groupd and groupd["ques"] != None: | 109 | if "ques" in groupd and groupd["ques"] is not None: |
110 | val = self.getFunc(key, data) | 110 | val = self.getFunc(key, data) |
111 | op = "set?" | 111 | op = "set?" |
112 | if val == None: | 112 | if val is None: |
113 | val = groupd["value"] | 113 | val = groupd["value"] |
114 | elif "colon" in groupd and groupd["colon"] != None: | 114 | elif "colon" in groupd and groupd["colon"] is not None: |
115 | e = data.createCopy() | 115 | e = data.createCopy() |
116 | op = "immediate" | 116 | op = "immediate" |
117 | val = e.expand(groupd["value"], key + "[:=]") | 117 | val = e.expand(groupd["value"], key + "[:=]") |
118 | elif "append" in groupd and groupd["append"] != None: | 118 | elif "append" in groupd and groupd["append"] is not None: |
119 | op = "append" | 119 | op = "append" |
120 | val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"]) | 120 | val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"]) |
121 | elif "prepend" in groupd and groupd["prepend"] != None: | 121 | elif "prepend" in groupd and groupd["prepend"] is not None: |
122 | op = "prepend" | 122 | op = "prepend" |
123 | val = "%s %s" % (groupd["value"], (self.getFunc(key, data) or "")) | 123 | val = "%s %s" % (groupd["value"], (self.getFunc(key, data) or "")) |
124 | elif "postdot" in groupd and groupd["postdot"] != None: | 124 | elif "postdot" in groupd and groupd["postdot"] is not None: |
125 | op = "postdot" | 125 | op = "postdot" |
126 | val = "%s%s" % ((self.getFunc(key, data) or ""), groupd["value"]) | 126 | val = "%s%s" % ((self.getFunc(key, data) or ""), groupd["value"]) |
127 | elif "predot" in groupd and groupd["predot"] != None: | 127 | elif "predot" in groupd and groupd["predot"] is not None: |
128 | op = "predot" | 128 | op = "predot" |
129 | val = "%s%s" % (groupd["value"], (self.getFunc(key, data) or "")) | 129 | val = "%s%s" % (groupd["value"], (self.getFunc(key, data) or "")) |
130 | else: | 130 | else: |
131 | val = groupd["value"] | 131 | val = groupd["value"] |
132 | 132 | ||
133 | flag = None | 133 | flag = None |
134 | if 'flag' in groupd and groupd['flag'] != None: | 134 | if 'flag' in groupd and groupd['flag'] is not None: |
135 | flag = groupd['flag'] | 135 | flag = groupd['flag'] |
136 | elif groupd["lazyques"]: | 136 | elif groupd["lazyques"]: |
137 | flag = "_defaultval" | 137 | flag = "_defaultval" |
diff --git a/bitbake/lib/bb/providers.py b/bitbake/lib/bb/providers.py index f80963cb40..81459c36d5 100644 --- a/bitbake/lib/bb/providers.py +++ b/bitbake/lib/bb/providers.py | |||
@@ -92,11 +92,11 @@ def preferredVersionMatch(pe, pv, pr, preferred_e, preferred_v, preferred_r): | |||
92 | Check if the version pe,pv,pr is the preferred one. | 92 | Check if the version pe,pv,pr is the preferred one. |
93 | If there is preferred version defined and ends with '%', then pv has to start with that version after removing the '%' | 93 | If there is preferred version defined and ends with '%', then pv has to start with that version after removing the '%' |
94 | """ | 94 | """ |
95 | if (pr == preferred_r or preferred_r == None): | 95 | if pr == preferred_r or preferred_r is None: |
96 | if (pe == preferred_e or preferred_e == None): | 96 | if pe == preferred_e or preferred_e is None: |
97 | if preferred_v == pv: | 97 | if preferred_v == pv: |
98 | return True | 98 | return True |
99 | if preferred_v != None and preferred_v.endswith('%') and pv.startswith(preferred_v[:len(preferred_v)-1]): | 99 | if preferred_v is not None and preferred_v.endswith('%') and pv.startswith(preferred_v[:len(preferred_v)-1]): |
100 | return True | 100 | return True |
101 | return False | 101 | return False |
102 | 102 | ||
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index 8c25e09e8a..d13a124983 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
@@ -362,7 +362,7 @@ class TaskData: | |||
362 | bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees(item), reasons=["No eligible PROVIDERs exist for '%s'" % item]), cfgData) | 362 | bb.event.fire(bb.event.NoProvider(item, dependees=self.get_dependees(item), reasons=["No eligible PROVIDERs exist for '%s'" % item]), cfgData) |
363 | raise bb.providers.NoProvider(item) | 363 | raise bb.providers.NoProvider(item) |
364 | 364 | ||
365 | if len(eligible) > 1 and foundUnique == False: | 365 | if len(eligible) > 1 and not foundUnique: |
366 | if item not in self.consider_msgs_cache: | 366 | if item not in self.consider_msgs_cache: |
367 | providers_list = [] | 367 | providers_list = [] |
368 | for fn in eligible: | 368 | for fn in eligible: |
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5cbca97f3f..82c62e3324 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -935,7 +935,7 @@ class BuildInfoHelper(object): | |||
935 | 935 | ||
936 | # only reset the build name if the one on the server is actually | 936 | # only reset the build name if the one on the server is actually |
937 | # a valid value for the build_name field | 937 | # a valid value for the build_name field |
938 | if build_name != None: | 938 | if build_name is not None: |
939 | build_info['build_name'] = build_name | 939 | build_info['build_name'] = build_name |
940 | changed = True | 940 | changed = True |
941 | 941 | ||
@@ -1194,7 +1194,7 @@ class BuildInfoHelper(object): | |||
1194 | evdata = BuildInfoHelper._get_data_from_event(event) | 1194 | evdata = BuildInfoHelper._get_data_from_event(event) |
1195 | 1195 | ||
1196 | for t in self.internal_state['targets']: | 1196 | for t in self.internal_state['targets']: |
1197 | if t.is_image == True: | 1197 | if t.is_image: |
1198 | output_files = list(evdata.keys()) | 1198 | output_files = list(evdata.keys()) |
1199 | for output in output_files: | 1199 | for output in output_files: |
1200 | if t.target in output and 'rootfs' in output and not output.endswith(".manifest"): | 1200 | if t.target in output and 'rootfs' in output and not output.endswith(".manifest"): |
@@ -1236,7 +1236,7 @@ class BuildInfoHelper(object): | |||
1236 | task_information['outcome'] = Task.OUTCOME_PREBUILT | 1236 | task_information['outcome'] = Task.OUTCOME_PREBUILT |
1237 | else: | 1237 | else: |
1238 | task_information['task_executed'] = True | 1238 | task_information['task_executed'] = True |
1239 | if 'noexec' in vars(event) and event.noexec == True: | 1239 | if 'noexec' in vars(event) and event.noexec: |
1240 | task_information['task_executed'] = False | 1240 | task_information['task_executed'] = False |
1241 | task_information['outcome'] = Task.OUTCOME_EMPTY | 1241 | task_information['outcome'] = Task.OUTCOME_EMPTY |
1242 | task_information['script_type'] = Task.CODING_NA | 1242 | task_information['script_type'] = Task.CODING_NA |
@@ -1776,7 +1776,7 @@ class BuildInfoHelper(object): | |||
1776 | image_file_extensions_unique = {} | 1776 | image_file_extensions_unique = {} |
1777 | image_fstypes = self.server.runCommand( | 1777 | image_fstypes = self.server.runCommand( |
1778 | ['getVariable', 'IMAGE_FSTYPES'])[0] | 1778 | ['getVariable', 'IMAGE_FSTYPES'])[0] |
1779 | if image_fstypes != None: | 1779 | if image_fstypes is not None: |
1780 | image_types_str = image_fstypes.strip() | 1780 | image_types_str = image_fstypes.strip() |
1781 | image_file_extensions = re.sub(r' {2,}', ' ', image_types_str) | 1781 | image_file_extensions = re.sub(r' {2,}', ' ', image_types_str) |
1782 | image_file_extensions_unique = set(image_file_extensions.split(' ')) | 1782 | image_file_extensions_unique = set(image_file_extensions.split(' ')) |
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 19008a4ead..a0340dfc20 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -447,7 +447,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
447 | if error: | 447 | if error: |
448 | logger.error("Command '%s' failed: %s" % (cmdline, error)) | 448 | logger.error("Command '%s' failed: %s" % (cmdline, error)) |
449 | return 1 | 449 | return 1 |
450 | elif ret != True: | 450 | elif not ret: |
451 | logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) | 451 | logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) |
452 | return 1 | 452 | return 1 |
453 | 453 | ||
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index 49569e375b..da4fbeabb6 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -238,7 +238,7 @@ class NCursesUI: | |||
238 | if error: | 238 | if error: |
239 | print("Error running command '%s': %s" % (cmdline, error)) | 239 | print("Error running command '%s': %s" % (cmdline, error)) |
240 | return | 240 | return |
241 | elif ret != True: | 241 | elif not ret: |
242 | print("Couldn't get default commandlind! %s" % ret) | 242 | print("Couldn't get default commandlind! %s" % ret) |
243 | return | 243 | return |
244 | except xmlrpc.client.Fault as x: | 244 | except xmlrpc.client.Fault as x: |
diff --git a/bitbake/lib/bb/ui/taskexp.py b/bitbake/lib/bb/ui/taskexp.py index 7895102b95..8fff244235 100644 --- a/bitbake/lib/bb/ui/taskexp.py +++ b/bitbake/lib/bb/ui/taskexp.py | |||
@@ -200,7 +200,7 @@ def main(server, eventHandler, params): | |||
200 | if error: | 200 | if error: |
201 | print("Error running command '%s': %s" % (cmdline, error)) | 201 | print("Error running command '%s': %s" % (cmdline, error)) |
202 | return 1 | 202 | return 1 |
203 | elif ret != True: | 203 | elif not ret: |
204 | print("Error running command '%s': returned %s" % (cmdline, ret)) | 204 | print("Error running command '%s': returned %s" % (cmdline, ret)) |
205 | return 1 | 205 | return 1 |
206 | except client.Fault as x: | 206 | except client.Fault as x: |
diff --git a/bitbake/lib/bb/ui/toasterui.py b/bitbake/lib/bb/ui/toasterui.py index 51892c9a09..9260f5d9d7 100644 --- a/bitbake/lib/bb/ui/toasterui.py +++ b/bitbake/lib/bb/ui/toasterui.py | |||
@@ -176,7 +176,7 @@ def main(server, eventHandler, params): | |||
176 | if error: | 176 | if error: |
177 | logger.error("Command '%s' failed: %s" % (cmdline, error)) | 177 | logger.error("Command '%s' failed: %s" % (cmdline, error)) |
178 | return 1 | 178 | return 1 |
179 | elif ret != True: | 179 | elif not ret: |
180 | logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) | 180 | logger.error("Command '%s' failed: returned %s" % (cmdline, ret)) |
181 | return 1 | 181 | return 1 |
182 | 182 | ||
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index fedb05064d..13d0d4a04c 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -46,7 +46,7 @@ class BBUIEventQueue: | |||
46 | self.EventHandle = ret | 46 | self.EventHandle = ret |
47 | error = "" | 47 | error = "" |
48 | 48 | ||
49 | if self.EventHandle != None: | 49 | if self.EventHandle is not None: |
50 | break | 50 | break |
51 | 51 | ||
52 | errmsg = "Could not register UI event handler. Error: %s, host %s, "\ | 52 | errmsg = "Could not register UI event handler. Error: %s, host %s, "\ |
diff --git a/bitbake/lib/bs4/__init__.py b/bitbake/lib/bs4/__init__.py index f6fdfd50b1..e35725b86e 100644 --- a/bitbake/lib/bs4/__init__.py +++ b/bitbake/lib/bs4/__init__.py | |||
@@ -427,7 +427,7 @@ class BeautifulSoup(Tag): | |||
427 | if self.is_xml: | 427 | if self.is_xml: |
428 | # Print the XML declaration | 428 | # Print the XML declaration |
429 | encoding_part = '' | 429 | encoding_part = '' |
430 | if eventual_encoding != None: | 430 | if eventual_encoding is not None: |
431 | encoding_part = ' encoding="%s"' % eventual_encoding | 431 | encoding_part = ' encoding="%s"' % eventual_encoding |
432 | prefix = '<?xml version="1.0"%s?>\n' % encoding_part | 432 | prefix = '<?xml version="1.0"%s?>\n' % encoding_part |
433 | else: | 433 | else: |
diff --git a/bitbake/lib/bs4/builder/_html5lib.py b/bitbake/lib/bs4/builder/_html5lib.py index 4091ce88b9..9e9216ef9c 100644 --- a/bitbake/lib/bs4/builder/_html5lib.py +++ b/bitbake/lib/bs4/builder/_html5lib.py | |||
@@ -321,7 +321,7 @@ class Element(treebuildersbase.Node): | |||
321 | return self.element.contents | 321 | return self.element.contents |
322 | 322 | ||
323 | def getNameTuple(self): | 323 | def getNameTuple(self): |
324 | if self.namespace == None: | 324 | if self.namespace is None: |
325 | return namespaces["html"], self.name | 325 | return namespaces["html"], self.name |
326 | else: | 326 | else: |
327 | return self.namespace, self.name | 327 | return self.namespace, self.name |
diff --git a/bitbake/lib/ply/yacc.py b/bitbake/lib/ply/yacc.py index d50886ed2f..561784f2f7 100644 --- a/bitbake/lib/ply/yacc.py +++ b/bitbake/lib/ply/yacc.py | |||
@@ -488,7 +488,7 @@ class LRParser: | |||
488 | # --! DEBUG | 488 | # --! DEBUG |
489 | return result | 489 | return result |
490 | 490 | ||
491 | if t == None: | 491 | if t is None: |
492 | 492 | ||
493 | # --! DEBUG | 493 | # --! DEBUG |
494 | debug.error('Error : %s', | 494 | debug.error('Error : %s', |
@@ -766,7 +766,7 @@ class LRParser: | |||
766 | n = symstack[-1] | 766 | n = symstack[-1] |
767 | return getattr(n,"value",None) | 767 | return getattr(n,"value",None) |
768 | 768 | ||
769 | if t == None: | 769 | if t is None: |
770 | 770 | ||
771 | # We have some kind of parsing error here. To handle | 771 | # We have some kind of parsing error here. To handle |
772 | # this, we are going to push the current token onto | 772 | # this, we are going to push the current token onto |
@@ -1021,7 +1021,7 @@ class LRParser: | |||
1021 | n = symstack[-1] | 1021 | n = symstack[-1] |
1022 | return getattr(n,"value",None) | 1022 | return getattr(n,"value",None) |
1023 | 1023 | ||
1024 | if t == None: | 1024 | if t is None: |
1025 | 1025 | ||
1026 | # We have some kind of parsing error here. To handle | 1026 | # We have some kind of parsing error here. To handle |
1027 | # this, we are going to push the current token onto | 1027 | # this, we are going to push the current token onto |
diff --git a/bitbake/lib/prserv/db.py b/bitbake/lib/prserv/db.py index 117d8c052c..cb2a2461e0 100644 --- a/bitbake/lib/prserv/db.py +++ b/bitbake/lib/prserv/db.py | |||
@@ -71,7 +71,7 @@ class PRTable(object): | |||
71 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 71 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
72 | (version, pkgarch, checksum)) | 72 | (version, pkgarch, checksum)) |
73 | row=data.fetchone() | 73 | row=data.fetchone() |
74 | if row != None: | 74 | if row is not None: |
75 | return row[0] | 75 | return row[0] |
76 | else: | 76 | else: |
77 | #no value found, try to insert | 77 | #no value found, try to insert |
@@ -87,7 +87,7 @@ class PRTable(object): | |||
87 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 87 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
88 | (version, pkgarch, checksum)) | 88 | (version, pkgarch, checksum)) |
89 | row=data.fetchone() | 89 | row=data.fetchone() |
90 | if row != None: | 90 | if row is not None: |
91 | return row[0] | 91 | return row[0] |
92 | else: | 92 | else: |
93 | raise prserv.NotFoundError | 93 | raise prserv.NotFoundError |
@@ -99,7 +99,7 @@ class PRTable(object): | |||
99 | % (self.table, self.table), | 99 | % (self.table, self.table), |
100 | (version, pkgarch, checksum, version, pkgarch)) | 100 | (version, pkgarch, checksum, version, pkgarch)) |
101 | row=data.fetchone() | 101 | row=data.fetchone() |
102 | if row != None: | 102 | if row is not None: |
103 | return row[0] | 103 | return row[0] |
104 | else: | 104 | else: |
105 | #no value found, try to insert | 105 | #no value found, try to insert |
@@ -116,7 +116,7 @@ class PRTable(object): | |||
116 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 116 | data=self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
117 | (version, pkgarch, checksum)) | 117 | (version, pkgarch, checksum)) |
118 | row=data.fetchone() | 118 | row=data.fetchone() |
119 | if row != None: | 119 | if row is not None: |
120 | return row[0] | 120 | return row[0] |
121 | else: | 121 | else: |
122 | raise prserv.NotFoundError | 122 | raise prserv.NotFoundError |
@@ -132,7 +132,7 @@ class PRTable(object): | |||
132 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 132 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
133 | (version, pkgarch, checksum)) | 133 | (version, pkgarch, checksum)) |
134 | row = data.fetchone() | 134 | row = data.fetchone() |
135 | if row != None: | 135 | if row is not None: |
136 | val=row[0] | 136 | val=row[0] |
137 | else: | 137 | else: |
138 | #no value found, try to insert | 138 | #no value found, try to insert |
@@ -147,7 +147,7 @@ class PRTable(object): | |||
147 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, | 147 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=?;" % self.table, |
148 | (version, pkgarch, checksum)) | 148 | (version, pkgarch, checksum)) |
149 | row = data.fetchone() | 149 | row = data.fetchone() |
150 | if row != None: | 150 | if row is not None: |
151 | val = row[0] | 151 | val = row[0] |
152 | return val | 152 | return val |
153 | 153 | ||
@@ -170,7 +170,7 @@ class PRTable(object): | |||
170 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=? AND value>=?;" % self.table, | 170 | data = self._execute("SELECT value FROM %s WHERE version=? AND pkgarch=? AND checksum=? AND value>=?;" % self.table, |
171 | (version,pkgarch,checksum,value)) | 171 | (version,pkgarch,checksum,value)) |
172 | row=data.fetchone() | 172 | row=data.fetchone() |
173 | if row != None: | 173 | if row is not None: |
174 | return row[0] | 174 | return row[0] |
175 | else: | 175 | else: |
176 | return None | 176 | return None |
diff --git a/bitbake/lib/pyinotify.py b/bitbake/lib/pyinotify.py index 1528a22e8d..6ae40a2d76 100644 --- a/bitbake/lib/pyinotify.py +++ b/bitbake/lib/pyinotify.py | |||
@@ -1274,7 +1274,7 @@ class Notifier: | |||
1274 | basename = os.path.basename(sys.argv[0]) or 'pyinotify' | 1274 | basename = os.path.basename(sys.argv[0]) or 'pyinotify' |
1275 | pid_file = os.path.join(dirname, basename + '.pid') | 1275 | pid_file = os.path.join(dirname, basename + '.pid') |
1276 | 1276 | ||
1277 | if pid_file != False and os.path.lexists(pid_file): | 1277 | if pid_file and os.path.lexists(pid_file): |
1278 | err = 'Cannot daemonize: pid file %s already exists.' % pid_file | 1278 | err = 'Cannot daemonize: pid file %s already exists.' % pid_file |
1279 | raise NotifierError(err) | 1279 | raise NotifierError(err) |
1280 | 1280 | ||
@@ -1308,7 +1308,7 @@ class Notifier: | |||
1308 | fork_daemon() | 1308 | fork_daemon() |
1309 | 1309 | ||
1310 | # Write pid | 1310 | # Write pid |
1311 | if pid_file != False: | 1311 | if pid_file: |
1312 | flags = os.O_WRONLY|os.O_CREAT|os.O_NOFOLLOW|os.O_EXCL | 1312 | flags = os.O_WRONLY|os.O_CREAT|os.O_NOFOLLOW|os.O_EXCL |
1313 | fd_pid = os.open(pid_file, flags, 0o0600) | 1313 | fd_pid = os.open(pid_file, flags, 0o0600) |
1314 | os.write(fd_pid, bytes(str(os.getpid()) + '\n', | 1314 | os.write(fd_pid, bytes(str(os.getpid()) + '\n', |
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index cfcd4a00e5..20f9dce569 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
@@ -78,7 +78,7 @@ class Command(BaseCommand): | |||
78 | template_conf = os.environ.get("TEMPLATECONF", "") | 78 | template_conf = os.environ.get("TEMPLATECONF", "") |
79 | custom_xml_only = os.environ.get("CUSTOM_XML_ONLY") | 79 | custom_xml_only = os.environ.get("CUSTOM_XML_ONLY") |
80 | 80 | ||
81 | if ToasterSetting.objects.filter(name='CUSTOM_XML_ONLY').count() > 0 or (not custom_xml_only == None): | 81 | if ToasterSetting.objects.filter(name='CUSTOM_XML_ONLY').count() > 0 or custom_xml_only is not None: |
82 | # only use the custom settings | 82 | # only use the custom settings |
83 | pass | 83 | pass |
84 | elif "poky" in template_conf: | 84 | elif "poky" in template_conf: |
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index bb6b5decff..caf069721a 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -1647,14 +1647,14 @@ class CustomImageRecipe(Recipe): | |||
1647 | """ | 1647 | """ |
1648 | # Check if we're aldready up-to-date or not | 1648 | # Check if we're aldready up-to-date or not |
1649 | target = self.get_last_successful_built_target() | 1649 | target = self.get_last_successful_built_target() |
1650 | if target == None: | 1650 | if target is None: |
1651 | # So we've never actually built this Custom recipe but what about | 1651 | # So we've never actually built this Custom recipe but what about |
1652 | # the recipe it's based on? | 1652 | # the recipe it's based on? |
1653 | target = \ | 1653 | target = \ |
1654 | Target.objects.filter(Q(build__outcome=Build.SUCCEEDED) & | 1654 | Target.objects.filter(Q(build__outcome=Build.SUCCEEDED) & |
1655 | Q(build__project=self.project) & | 1655 | Q(build__project=self.project) & |
1656 | Q(target=self.base_recipe.name)).last() | 1656 | Q(target=self.base_recipe.name)).last() |
1657 | if target == None: | 1657 | if target is None: |
1658 | return | 1658 | return |
1659 | 1659 | ||
1660 | if target.build.completed_on == self.last_updated: | 1660 | if target.build.completed_on == self.last_updated: |
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 354b61f081..b703da3048 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
@@ -212,7 +212,7 @@ def filtered_installedsize(size, installed_size): | |||
212 | """If package.installed_size not null and not empty return it, | 212 | """If package.installed_size not null and not empty return it, |
213 | else return package.size | 213 | else return package.size |
214 | """ | 214 | """ |
215 | return size if (installed_size == 0) or (installed_size == "") or (installed_size == None) else installed_size | 215 | return size if (installed_size == 0) or (installed_size == "") or (installed_size is None) else installed_size |
216 | 216 | ||
217 | @register.filter | 217 | @register.filter |
218 | def filtered_packageversion(version, revision): | 218 | def filtered_packageversion(version, revision): |
@@ -228,7 +228,7 @@ def filter_sizeovertotal(package_object, total_size): | |||
228 | formatted nicely. | 228 | formatted nicely. |
229 | """ | 229 | """ |
230 | size = package_object.installed_size | 230 | size = package_object.installed_size |
231 | if size == None or size == '': | 231 | if size is None or size == '': |
232 | size = package_object.size | 232 | size = package_object.size |
233 | 233 | ||
234 | return '{:.1%}'.format(float(size)/float(total_size)) | 234 | return '{:.1%}'.format(float(size)/float(total_size)) |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 7fecdaa973..e2ead830b1 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -51,7 +51,7 @@ class MimeTypeFinder(object): | |||
51 | def get_mimetype(self, path): | 51 | def get_mimetype(self, path): |
52 | guess = mimetypes.guess_type(path, self._strict) | 52 | guess = mimetypes.guess_type(path, self._strict) |
53 | guessed_type = guess[0] | 53 | guessed_type = guess[0] |
54 | if guessed_type == None: | 54 | if guessed_type is None: |
55 | guessed_type = 'application/octet-stream' | 55 | guessed_type = 'application/octet-stream' |
56 | return guessed_type | 56 | return guessed_type |
57 | 57 | ||
@@ -126,7 +126,7 @@ def _lv_to_dict(prj, x = None): | |||
126 | return {"id": x.pk, | 126 | return {"id": x.pk, |
127 | "name": x.layer.name, | 127 | "name": x.layer.name, |
128 | "tooltip": "%s | %s" % (x.layer.vcs_url,x.get_vcs_reference()), | 128 | "tooltip": "%s | %s" % (x.layer.vcs_url,x.get_vcs_reference()), |
129 | "detail": "(%s" % x.layer.vcs_url + (")" if x.release == None else " | "+x.get_vcs_reference()+")"), | 129 | "detail": "(%s" % x.layer.vcs_url + (")" if x.release is None else " | "+x.get_vcs_reference()+")"), |
130 | "giturl": x.layer.vcs_url, | 130 | "giturl": x.layer.vcs_url, |
131 | "layerdetailurl" : reverse('layerdetails', args=(prj.id,x.pk)), | 131 | "layerdetailurl" : reverse('layerdetails', args=(prj.id,x.pk)), |
132 | "revision" : x.get_vcs_reference(), | 132 | "revision" : x.get_vcs_reference(), |
@@ -718,7 +718,7 @@ def _get_dir_entries(build_id, target_id, start): | |||
718 | resolved_id = o.sym_target_id | 718 | resolved_id = o.sym_target_id |
719 | resolved_path = o.path | 719 | resolved_path = o.path |
720 | if target_packages.count(): | 720 | if target_packages.count(): |
721 | while resolved_id != "" and resolved_id != None: | 721 | while resolved_id != "" and resolved_id is not None: |
722 | tf = Target_File.objects.get(pk=resolved_id) | 722 | tf = Target_File.objects.get(pk=resolved_id) |
723 | resolved_path = tf.path | 723 | resolved_path = tf.path |
724 | resolved_id = tf.sym_target_id | 724 | resolved_id = tf.sym_target_id |
@@ -730,10 +730,10 @@ def _get_dir_entries(build_id, target_id, start): | |||
730 | entry['package_id'] = str(p.id) | 730 | entry['package_id'] = str(p.id) |
731 | entry['package'] = p.name | 731 | entry['package'] = p.name |
732 | # don't use resolved path from above, show immediate link-to | 732 | # don't use resolved path from above, show immediate link-to |
733 | if o.sym_target_id != "" and o.sym_target_id != None: | 733 | if o.sym_target_id != "" and o.sym_target_id is not None: |
734 | entry['link_to'] = Target_File.objects.get(pk=o.sym_target_id).path | 734 | entry['link_to'] = Target_File.objects.get(pk=o.sym_target_id).path |
735 | entry['size'] = filtered_filesizeformat(o.size) | 735 | entry['size'] = filtered_filesizeformat(o.size) |
736 | if entry['link_to'] != None: | 736 | if entry['link_to'] is not None: |
737 | entry['permission'] = node_str[o.inodetype] + o.permission | 737 | entry['permission'] = node_str[o.inodetype] + o.permission |
738 | else: | 738 | else: |
739 | entry['permission'] = node_str[o.inodetype] + o.permission | 739 | entry['permission'] = node_str[o.inodetype] + o.permission |
@@ -755,7 +755,7 @@ def dirinfo(request, build_id, target_id, file_path=None): | |||
755 | objects = _get_dir_entries(build_id, target_id, '/') | 755 | objects = _get_dir_entries(build_id, target_id, '/') |
756 | packages_sum = Package.objects.filter(id__in=Target_Installed_Package.objects.filter(target_id=target_id).values('package_id')).aggregate(Sum('installed_size')) | 756 | packages_sum = Package.objects.filter(id__in=Target_Installed_Package.objects.filter(target_id=target_id).values('package_id')).aggregate(Sum('installed_size')) |
757 | dir_list = None | 757 | dir_list = None |
758 | if file_path != None: | 758 | if file_path is not None: |
759 | """ | 759 | """ |
760 | Link from the included package detail file list page and is | 760 | Link from the included package detail file list page and is |
761 | requesting opening the dir info to a specific file path. | 761 | requesting opening the dir info to a specific file path. |
@@ -1029,15 +1029,15 @@ def _get_package_dependency_count(package, target_id, is_installed): | |||
1029 | 1029 | ||
1030 | def _get_package_alias(package): | 1030 | def _get_package_alias(package): |
1031 | alias = package.installed_name | 1031 | alias = package.installed_name |
1032 | if alias != None and alias != '' and alias != package.name: | 1032 | if alias is not None and alias != '' and alias != package.name: |
1033 | return alias | 1033 | return alias |
1034 | else: | 1034 | else: |
1035 | return '' | 1035 | return '' |
1036 | 1036 | ||
1037 | def _get_fullpackagespec(package): | 1037 | def _get_fullpackagespec(package): |
1038 | r = package.name | 1038 | r = package.name |
1039 | version_good = package.version != None and package.version != '' | 1039 | version_good = package.version is not None and package.version != '' |
1040 | revision_good = package.revision != None and package.revision != '' | 1040 | revision_good = package.revision is not None and package.revision != '' |
1041 | if version_good or revision_good: | 1041 | if version_good or revision_good: |
1042 | r += '_' | 1042 | r += '_' |
1043 | if version_good: | 1043 | if version_good: |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py index 9af54ec2f2..3e246fda83 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/buildimport.py +++ b/bitbake/lib/toaster/toastermain/management/commands/buildimport.py | |||
@@ -505,7 +505,7 @@ class Command(BaseCommand): | |||
505 | default_release = Release.objects.get(id=1) | 505 | default_release = Release.objects.get(id=1) |
506 | 506 | ||
507 | # SANITY: if 'reconfig' but project does not exist (deleted externally), switch to 'import' | 507 | # SANITY: if 'reconfig' but project does not exist (deleted externally), switch to 'import' |
508 | if ("reconfigure" == options['command']) and (None == project): | 508 | if ("reconfigure" == options['command']) and project is None: |
509 | options['command'] = 'import' | 509 | options['command'] = 'import' |
510 | 510 | ||
511 | # 'Configure': | 511 | # 'Configure': |