diff options
author | Ross Burton <ross@burtonini.com> | 2021-10-13 16:10:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 22:31:56 +0100 |
commit | abc93390a3f19bc4cc159c5690a478b9e2270906 (patch) | |
tree | f67a8487490ac4688ba4f5d9ef93b011901dbe0e /meta/lib | |
parent | 1f0bec0421617e8aa9645c385195a755f0d44e75 (diff) | |
download | openembedded-core-abc93390a3f19bc4cc159c5690a478b9e2270906.tar.gz |
oe/license: implement ast.NodeVisitor.visit_Constant
Since Python 3.8 visit_Num(), visit_Str() and so on are all deprecated
and replaced with visit_Constant. We can't yet remove the deprecated
functions until we require 3.8, but we can implement visit_Constant to
silence the deprecation warnings.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/license.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/meta/lib/oe/license.py b/meta/lib/oe/license.py index 665d32ecbb..b5d378a549 100644 --- a/meta/lib/oe/license.py +++ b/meta/lib/oe/license.py @@ -74,6 +74,9 @@ class FlattenVisitor(LicenseVisitor): def visit_Str(self, node): self.licenses.append(node.s) + def visit_Constant(self, node): + self.licenses.append(node.value) + def visit_BinOp(self, node): if isinstance(node.op, ast.BitOr): left = FlattenVisitor(self.choose_licenses) @@ -227,6 +230,9 @@ class ListVisitor(LicenseVisitor): def visit_Str(self, node): self.licenses.add(node.s) + def visit_Constant(self, node): + self.licenses.add(node.value) + def list_licenses(licensestr): """Simply get a list of all licenses mentioned in a license string. Binary operators are not applied or taken into account in any way""" |