From b055793dde56e314c0400607b1414b78a3e5facf Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Sat, 29 Nov 2025 00:10:14 +0100 Subject: [PATCH 1/2] python313Packages.splinter: fix build with lxml 6 lxml 6 doesn't find a `` tag via the XPath expression `//body` anymore when the parsed HTML doesn't contain any tags at all. This causes some of splinter's tests to fail when lxml 6 is used. --- .../python-modules/splinter/default.nix | 4 ++ .../python-modules/splinter/lxml-6.patch | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 pkgs/development/python-modules/splinter/lxml-6.patch diff --git a/pkgs/development/python-modules/splinter/default.nix b/pkgs/development/python-modules/splinter/default.nix index b63e1876e002..a181b0349bbe 100644 --- a/pkgs/development/python-modules/splinter/default.nix +++ b/pkgs/development/python-modules/splinter/default.nix @@ -29,6 +29,10 @@ buildPythonPackage rec { hash = "sha256-PGGql8yI1YosoUBAyDoI/8k7s4sVYnXEV7eow3GHH88="; }; + patches = [ + ./lxml-6.patch + ]; + nativeBuildInputs = [ setuptools ]; propagatedBuildInputs = [ urllib3 ]; diff --git a/pkgs/development/python-modules/splinter/lxml-6.patch b/pkgs/development/python-modules/splinter/lxml-6.patch new file mode 100644 index 000000000000..1be98665cd11 --- /dev/null +++ b/pkgs/development/python-modules/splinter/lxml-6.patch @@ -0,0 +1,42 @@ +diff --git a/tests/fake_django/urls.py b/tests/fake_django/urls.py +index 2ab75ff..bd736ab 100644 +--- a/tests/fake_django/urls.py ++++ b/tests/fake_django/urls.py +@@ -52,7 +52,8 @@ def post_form(request): + + + def request_headers(request): +- body = "\n".join(f"{key}: {value}" for key, value in request.META.items()) ++ headers = "\n".join(f"{key}: {value}" for key, value in request.META.items()) ++ body = f"{headers}" + return HttpResponse(body) + + +@@ -67,7 +68,7 @@ def upload_file(request): + + + def foo(request): +- return HttpResponse("BAR!") ++ return HttpResponse("BAR!") + + + def query_string(request): +diff --git a/tests/fake_webapp.py b/tests/fake_webapp.py +index ccd5bab..efc31c5 100644 +--- a/tests/fake_webapp.py ++++ b/tests/fake_webapp.py +@@ -119,12 +119,12 @@ def upload_file(): + + @app.route("/headers", methods=["GET"]) + def request_headers(): +- return str(request.headers) ++ return f"{request.headers}" + + + @app.route("/foo") + def foo(): +- return "BAR!" ++ return "BAR!" + + + @app.route("/query", methods=["GET"]) From 98d16344238dbadaf22e92727efe030f2b524820 Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Sat, 29 Nov 2025 00:11:12 +0100 Subject: [PATCH 2/2] python313Packages.splinter: modernize --- .../python-modules/splinter/default.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/splinter/default.nix b/pkgs/development/python-modules/splinter/default.nix index a181b0349bbe..298e2c1af625 100644 --- a/pkgs/development/python-modules/splinter/default.nix +++ b/pkgs/development/python-modules/splinter/default.nix @@ -1,7 +1,6 @@ { lib, buildPythonPackage, - pythonOlder, fetchFromGitHub, setuptools, urllib3, @@ -17,9 +16,6 @@ buildPythonPackage rec { pname = "splinter"; version = "0.21.0"; - - disabled = pythonOlder "3.8"; - pyproject = true; src = fetchFromGitHub { @@ -33,9 +29,9 @@ buildPythonPackage rec { ./lxml-6.patch ]; - nativeBuildInputs = [ setuptools ]; + build-system = [ setuptools ]; - propagatedBuildInputs = [ urllib3 ]; + dependencies = [ urllib3 ]; optional-dependencies = { "zope.testbrowser" = [ @@ -88,11 +84,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "splinter" ]; - meta = with lib; { + meta = { changelog = "https://splinter.readthedocs.io/en/latest/news.html"; description = "Browser abstraction for web acceptance testing"; homepage = "https://github.com/cobrateam/splinter"; - license = licenses.bsd3; - maintainers = with maintainers; [ dotlambda ]; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ dotlambda ]; }; }