diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix
index fb6e80b44995..990ccacb4fbc 100644
--- a/pkgs/development/python-modules/html5lib/default.nix
+++ b/pkgs/development/python-modules/html5lib/default.nix
@@ -1,47 +1,48 @@
{
lib,
buildPythonPackage,
- fetchPypi,
- fetchpatch,
+ fetchFromGitHub,
+ setuptools,
six,
webencodings,
- mock,
pytest-expect,
pytestCheckHook,
+ unstableGitUpdater,
}:
-buildPythonPackage rec {
+buildPythonPackage {
pname = "html5lib";
- version = "1.1";
- format = "setuptools";
+ version = "1.1-unstable-2024-02-21";
+ pyproject = true;
- src = fetchPypi {
- inherit pname version;
- sha256 = "b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f";
+ src = fetchFromGitHub {
+ owner = "html5lib";
+ repo = "html5lib-python";
+ rev = "fd4f032bc090d44fb11a84b352dad7cbee0a4745";
+ hash = "sha256-Hyte1MEqlrD2enfunK1qtm3FJlUDqmhSyrCjo7VaBgA=";
};
patches = [
- # Fix compatibility with pytest 6.
- # Will be included in the next release after 1.1.
- (fetchpatch {
- url = "https://github.com/html5lib/html5lib-python/commit/2c19b9899ab3a3e8bd0ca35e5d78544334204169.patch";
- hash = "sha256-VGCeB6o2QO/skeCZs8XLPfgEYVOSRL8cCpG7ajbZWEs=";
- })
+ # https://github.com/html5lib/html5lib-python/pull/583
+ ./python314-compat.patch
];
- propagatedBuildInputs = [
+ build-system = [ setuptools ];
+
+ dependencies = [
six
webencodings
];
- # latest release not compatible with pytest 6
- doCheck = false;
nativeCheckInputs = [
- mock
pytest-expect
pytestCheckHook
];
+ passthru.updateScript = unstableGitUpdater {
+ branch = "master";
+ };
+
meta = {
homepage = "https://github.com/html5lib/html5lib-python";
downloadPage = "https://github.com/html5lib/html5lib-python/releases";
diff --git a/pkgs/development/python-modules/html5lib/python314-compat.patch b/pkgs/development/python-modules/html5lib/python314-compat.patch
new file mode 100644
index 000000000000..5351032f1232
--- /dev/null
+++ b/pkgs/development/python-modules/html5lib/python314-compat.patch
@@ -0,0 +1,26 @@
+From 379f9476c2a5ee370cd7ec856ee9092cace88499 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?=
+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,