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:30:58 +0000 |
commit | b809a6812aa15a8a9af97bc382cc4b19571e6bfc (patch) | |
tree | 2558aa5cbbf8807b56968fdd1a2850a65aa897b7 /lib/bb/parse | |
parent | 4367692a932ac135c5aa4f9f2a4e4f0150f76697 (diff) | |
download | bitbake-b809a6812aa15a8a9af97bc382cc4b19571e6bfc.tar.gz |
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.
Signed-off-by: Frazer Clews <frazer.clews@codethink.co.uk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse')
-rw-r--r-- | lib/bb/parse/ast.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index 362c1a39c..eb8cfa21b 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -89,7 +89,7 @@ class DataNode(AstNode): self.groupd = groupd def getFunc(self, key, data): - if 'flag' in self.groupd and self.groupd['flag'] != None: + if 'flag' in self.groupd and self.groupd['flag'] is not None: return data.getVarFlag(key, self.groupd['flag'], expand=False, noweakdefault=True) else: return data.getVar(key, False, noweakdefault=True, parsing=True) @@ -102,36 +102,36 @@ class DataNode(AstNode): 'file': self.filename, 'line': self.lineno, } - if "exp" in groupd and groupd["exp"] != None: + if "exp" in groupd and groupd["exp"] is not None: data.setVarFlag(key, "export", 1, op = 'exported', **loginfo) op = "set" - if "ques" in groupd and groupd["ques"] != None: + if "ques" in groupd and groupd["ques"] is not None: val = self.getFunc(key, data) op = "set?" - if val == None: + if val is None: val = groupd["value"] - elif "colon" in groupd and groupd["colon"] != None: + elif "colon" in groupd and groupd["colon"] is not None: e = data.createCopy() op = "immediate" val = e.expand(groupd["value"], key + "[:=]") - elif "append" in groupd and groupd["append"] != None: + elif "append" in groupd and groupd["append"] is not None: op = "append" val = "%s %s" % ((self.getFunc(key, data) or ""), groupd["value"]) - elif "prepend" in groupd and groupd["prepend"] != None: + elif "prepend" in groupd and groupd["prepend"] is not None: op = "prepend" val = "%s %s" % (groupd["value"], (self.getFunc(key, data) or "")) - elif "postdot" in groupd and groupd["postdot"] != None: + elif "postdot" in groupd and groupd["postdot"] is not None: op = "postdot" val = "%s%s" % ((self.getFunc(key, data) or ""), groupd["value"]) - elif "predot" in groupd and groupd["predot"] != None: + elif "predot" in groupd and groupd["predot"] is not None: op = "predot" val = "%s%s" % (groupd["value"], (self.getFunc(key, data) or "")) else: val = groupd["value"] flag = None - if 'flag' in groupd and groupd['flag'] != None: + if 'flag' in groupd and groupd['flag'] is not None: flag = groupd['flag'] elif groupd["lazyques"]: flag = "_defaultval" |