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/bb/parse/ast.py | |
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/bb/parse/ast.py')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 20 |
1 files changed, 10 insertions, 10 deletions
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" |