]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
license.py: Drop visit_Str from SeenVisitor in selftest
authorSunil Dora <sunilkumar.dora@windriver.com>
Fri, 27 Mar 2026 13:46:35 +0000 (19:16 +0530)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 27 Mar 2026 17:12:44 +0000 (17:12 +0000)
ast.Str was deprecated in Python 3.8 and removed in Python 3.14.
In [1], visit_Str was already removed from the LicenseVisitor
subclasses (FlattenVisitor, ListVisitor) in oe/license.py since
bitbake now requires Python 3.8+.

However, the test-only SeenVisitor class in the selftest was
missed at that time and still uses visit_Str/node.s. On Python
3.14, ast.Str is fully removed so visit_Str is never called,
causing test_single_licenses to return [] instead of the
expected license list.

Replace visit_Str/node.s with visit_Constant/node.value in
SeenVisitor.

[1] https://git.openembedded.org/openembedded-core/commit/meta/lib/oe/license.py?id=6d3da37adbcaf5a7a3dade08f9d052571b195249

Fixes [YOCTO #16220]

Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/oelib/license.py

index 5eea12e761905293aba653f3acc6383a44aefc13..49b28951f765787a0d27e89c1d1d59aff9db0370 100644 (file)
@@ -12,8 +12,8 @@ class SeenVisitor(oe.license.LicenseVisitor):
         self.seen = []
         oe.license.LicenseVisitor.__init__(self)
 
-    def visit_Str(self, node):
-        self.seen.append(node.s)
+    def visit_Constant(self, node):
+        self.seen.append(node.value)
 
 class TestSingleLicense(TestCase):
     licenses = [