Skip to contentSkip to conversation

license.py: avoid deprecated ast.Str

PATCH New [email protected] 1 participant 1 message Aug 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 license.py: avoid deprecated ast.Str

From: Martin Jansa <[email protected]>

* it's deprecated since python-3.12 and removed in 3.14 causing:

openembedded-core/meta/lib/oe/license.py', lineno: 176, function: visit

     0172:
     0173:        LicenseVisitor.__init__(self)
     0174:
     0175:    def visit(self, node):

*** 0176: if isinstance(node, ast.Str):
0177: lic = node.s
0178:
0179: if license_ok(self._canonical_license(self._d, lic),
0180: self._dont_want_licenses) == True:
Exception: AttributeError: module 'ast' has no attribute 'Str'

---
 meta/lib/oe/license.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oe/license.py +2 -2
index 6e55fa1e7f..ca779d3d83 100644
@@ -173,8 +173,8 @@ class ManifestVisitor(LicenseVisitor):
         LicenseVisitor.__init__(self)
 
     def visit(self, node):
-        if isinstance(node, ast.Str):
-            lic = node.s
+        if isinstance(node, ast.Constant):
+            lic = node.value
 
             if license_ok(self._canonical_license(self._d, lic),
                     self._dont_want_licenses) == True: