summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/html5lib/python314-compat.patch
blob: 5351032f1232baf52b136640a9d0e1517f1e323e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 379f9476c2a5ee370cd7ec856ee9092cace88499 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Wed, 30 Oct 2024 15:44:40 +0100
Subject: [PATCH] Avoid ast.Str on Python 3.8+

It has been deprecated since Python 3.8 and was removed from Python 3.14+.
---
 setup.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/setup.py b/setup.py
index 30ee0575..62272c18 100644
--- a/setup.py
+++ b/setup.py
@@ -93,8 +93,9 @@ def default_environment():
         if (len(a.targets) == 1 and
                 isinstance(a.targets[0], ast.Name) and
                 a.targets[0].id == "__version__" and
-                isinstance(a.value, ast.Str)):
-            version = a.value.s
+                ((sys.version_info >= (3, 8) and isinstance(a.value, ast.Constant)) or
+                    isinstance(a.value, ast.Str))):
+            version = a.value.value if sys.version_info >= (3, 8) else a.value.s
 
 setup(name='html5lib',
       version=version,