Files
nixpkgs/pkgs/development/python-modules/html5lib/python314-compat.patch
Martin Weinelt 1690f975ae python3Packages.html5lib: 1.1 -> 1.1-unstable-2024-02-21
Reenables the tests and backports a fix for Python 3.14 compat.
2025-11-25 12:35:46 -08:00

27 lines
1002 B
Diff

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,