git: 3ee163b98330 - main - lang/spidermonkey128: fix build with Python 3.14+ (+)

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Thu, 15 Oct 2026 21:25:15 UTC
The branch main has been updated by fluffy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3ee163b98330b87d817bdb7f3f57b883c5a48542

commit 3ee163b98330b87d817bdb7f3f57b883c5a48542
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2026-10-15 21:20:02 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2026-10-15 21:23:57 +0000

    lang/spidermonkey128: fix build with Python 3.14+ (+)
    
    AttributeError: module 'ast' has no attribute 'Str'
    
    Python have deprecated ast.Str, ast.Num, ast.Bytes since 3.8 and dropped they out in 3.14
    Use ast.Constant instead
    
    Reported by:    bulk -t
    Approved by:    portmgr blanket (fix build)
---
 ...tch-python_mozbuild_mozbuild_frontend_reader.py | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/lang/spidermonkey128/files/patch-python_mozbuild_mozbuild_frontend_reader.py b/lang/spidermonkey128/files/patch-python_mozbuild_mozbuild_frontend_reader.py
new file mode 100644
index 000000000000..c6b30bc0e024
--- /dev/null
+++ b/lang/spidermonkey128/files/patch-python_mozbuild_mozbuild_frontend_reader.py
@@ -0,0 +1,38 @@
+--- python/mozbuild/mozbuild/frontend/reader.py.orig	2025-08-11 17:07:23 UTC
++++ python/mozbuild/mozbuild/frontend/reader.py
+@@ -470,7 +470,7 @@ class TemplateFunction(object):
+             return c(
+                 ast.Subscript(
+                     value=c(ast.Name(id=self._global_name, ctx=ast.Load())),
+-                    slice=c(ast.Index(value=c(ast.Str(s=node.id)))),
++                    slice=c(ast.Index(value=c(ast.Constant(value=node.id)))),
+                     ctx=node.ctx,
+                 )
+             )
+@@ -1035,8 +1035,8 @@ class BuildReader(object):
+                 else:
+                     # Others
+                     assert isinstance(target.slice, ast.Index)
+-                    assert isinstance(target.slice.value, ast.Str)
+-                    key = target.slice.value.s
++                    assert isinstance(target.slice.value, ast.Constant)
++                    key = target.slice.value.value
+ 
+             return name, key
+ 
+@@ -1044,11 +1044,11 @@ class BuildReader(object):
+             value = node.value
+             if isinstance(value, ast.List):
+                 for v in value.elts:
+-                    assert isinstance(v, ast.Str)
+-                    yield v.s
++                    assert isinstance(v, ast.Constant)
++                    yield v.value
+             else:
+-                assert isinstance(value, ast.Str)
+-                yield value.s
++                assert isinstance(value, ast.Constant)
++                yield value.value
+ 
+         assignments = []
+