projects/aports·blob master · refs

40 lines · 1.5 KiB

1Patch-Source: https://github.com/html5lib/html5lib-python/pull/589
2---
3From b90dafff1bf342d34d539098013d0b9f318c7641 Mon Sep 17 00:00:00 2001
4From: Andrew Sukach <[email protected]>
5Date: Fri, 12 Sep 2025 21:53:31 -0700
6Subject: [PATCH] `setup.py`: fix version parsing on Python 3.14 (ast.Str
7 removed)
8
9Python 3.14 removes the ast.Str node type. String literals now appear
10as ast.Constant(value=str).
11Update the AST check to accept both ast.Str (for older Pythons) and
12ast.Constant with a string value (for Python 3.8+), allowing html5lib to
13build successfully on Python 3.14 while remaining compatible with older
14version.
15---
16 setup.py | 11 ++++++++---
17 1 file changed, 8 insertions(+), 3 deletions(-)
18
19diff --git a/setup.py b/setup.py
20index 30ee0575..42ab6f67 100644
21--- a/setup.py
22+++ b/setup.py
23@@ -92,9 +92,14 @@ def default_environment():
24 for a in assignments:
25 if (len(a.targets) == 1 and
26 isinstance(a.targets[0], ast.Name) and
27- a.targets[0].id == "__version__" and
28- isinstance(a.value, ast.Str)):
29- version = a.value.s
30+ a.targets[0].id == "__version__"):
31+ if hasattr(ast, "Str") and isinstance(a.value, ast.Str):
32+ version = a.value.s
33+ elif (hasattr(ast, "Constant")
34+ and isinstance(a.value, ast.Constant)
35+ and isinstance(a.value.value, str)):
36+ version = a.value.value
37+assert version is not None
38
39 setup(name='html5lib',
40 version=version,