diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2023-12-31 11:04:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-02 14:41:06 +0000 |
commit | 39581827102c54359ec22eebc89ff68af4ec8633 (patch) | |
tree | 7fda1a4c560d9f4b52bbc8ceae7464ccf3f5d571 /bitbake/lib/bb | |
parent | 280917c2e70b103872c4495836dc7d1bcc30022a (diff) | |
download | poky-39581827102c54359ec22eebc89ff68af4ec8633.tar.gz |
bitbake: bitbake/codeparser.py: address ast module deprecations in py 3.12
Specifically:
/srv/work/alex/poky/bitbake/lib/bb/codeparser.py:279: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
if isinstance(node.args[0], ast.Str):
/srv/work/alex/poky/bitbake/lib/bb/codeparser.py:280: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
value = node.args[0].s
(Bitbake rev: de8ba2770d9a1a94af3d084f9540da7e2fae6022)
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/codeparser.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index cd39409434..2e8b7ced3c 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py | |||
@@ -258,17 +258,17 @@ class PythonParser(): | |||
258 | if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs or name in self.containsanyfuncs): | 258 | if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs or name in self.containsanyfuncs): |
259 | if isinstance(node.args[0], ast.Constant) and isinstance(node.args[0].value, str): | 259 | if isinstance(node.args[0], ast.Constant) and isinstance(node.args[0].value, str): |
260 | varname = node.args[0].value | 260 | varname = node.args[0].value |
261 | if name in self.containsfuncs and isinstance(node.args[1], ast.Str): | 261 | if name in self.containsfuncs and isinstance(node.args[1], ast.Constant): |
262 | if varname not in self.contains: | 262 | if varname not in self.contains: |
263 | self.contains[varname] = set() | 263 | self.contains[varname] = set() |
264 | self.contains[varname].add(node.args[1].s) | 264 | self.contains[varname].add(node.args[1].value) |
265 | elif name in self.containsanyfuncs and isinstance(node.args[1], ast.Str): | 265 | elif name in self.containsanyfuncs and isinstance(node.args[1], ast.Constant): |
266 | if varname not in self.contains: | 266 | if varname not in self.contains: |
267 | self.contains[varname] = set() | 267 | self.contains[varname] = set() |
268 | self.contains[varname].update(node.args[1].s.split()) | 268 | self.contains[varname].update(node.args[1].value.split()) |
269 | elif name.endswith(self.getvarflags): | 269 | elif name.endswith(self.getvarflags): |
270 | if isinstance(node.args[1], ast.Str): | 270 | if isinstance(node.args[1], ast.Constant): |
271 | self.references.add('%s[%s]' % (varname, node.args[1].s)) | 271 | self.references.add('%s[%s]' % (varname, node.args[1].value)) |
272 | else: | 272 | else: |
273 | self.warn(node.func, node.args[1]) | 273 | self.warn(node.func, node.args[1]) |
274 | else: | 274 | else: |
@@ -276,8 +276,8 @@ class PythonParser(): | |||
276 | else: | 276 | else: |
277 | self.warn(node.func, node.args[0]) | 277 | self.warn(node.func, node.args[0]) |
278 | elif name and name.endswith(".expand"): | 278 | elif name and name.endswith(".expand"): |
279 | if isinstance(node.args[0], ast.Str): | 279 | if isinstance(node.args[0], ast.Constant): |
280 | value = node.args[0].s | 280 | value = node.args[0].value |
281 | d = bb.data.init() | 281 | d = bb.data.init() |
282 | parser = d.expandWithRefs(value, self.name) | 282 | parser = d.expandWithRefs(value, self.name) |
283 | self.references |= parser.references | 283 | self.references |= parser.references |
@@ -287,8 +287,8 @@ class PythonParser(): | |||
287 | self.contains[varname] = set() | 287 | self.contains[varname] = set() |
288 | self.contains[varname] |= parser.contains[varname] | 288 | self.contains[varname] |= parser.contains[varname] |
289 | elif name in self.execfuncs: | 289 | elif name in self.execfuncs: |
290 | if isinstance(node.args[0], ast.Str): | 290 | if isinstance(node.args[0], ast.Constant): |
291 | self.var_execs.add(node.args[0].s) | 291 | self.var_execs.add(node.args[0].value) |
292 | else: | 292 | else: |
293 | self.warn(node.func, node.args[0]) | 293 | self.warn(node.func, node.args[0]) |
294 | elif name and isinstance(node.func, (ast.Name, ast.Attribute)): | 294 | elif name and isinstance(node.func, (ast.Name, ast.Attribute)): |