Index | Thread | Search

From:
Daniel Dickman <didickman@gmail.com>
Subject:
fix devel/py-sure with Python 3.14
To:
ports@openbsd.org
Date:
Tue, 18 Nov 2025 18:49:32 -0500

Download raw body.

Thread
py-sure needs a fix in setup.py related to the migration from ast.Str to 
ast.Constant that happened in Python 3.8.

The patch below (+ version bump for the port) should fix things.

Without this diff, version ends up being None and the PLIST ends up with 
MODPY_DISTV = 0.0.0 instead of the proper version.

In Python 3.14 things changed enough that this now breaks code using when 
using pre Python 3.8 ast patterns, so the current code is on its last legs 
with Python 3.13.

py-sure only has one reverse TDEP (www/py-httpretty) but running tests for 
that port don't work for me under Python 3.14. And that port is also close 
to 4 years old, so it might not have kept up with Python version changes 
either.

ok?

=== patches/patch-setup_py ===

Update for Python 3.8+

Index: setup.py
--- setup.py.orig
+++ setup.py
@@ -49,8 +49,12 @@ class VersionFinder(ast.NodeVisitor):
 
     def visit_Assign(self, node):
         try:
-            if node.targets[0].id == self.VARIABLE_NAME:
-                self.version = node.value.s
+            target = node.targets[0]
+            if isinstance(target, ast.Name) and target.id == self.VARIABLE_NAME:
+                value = node.value
+                if isinstance(value, ast.Constant):
+                    if isinstance(value.value, str):
+                        self.version = value.value
         except Exception:
             pass