diff options
| author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2025-08-08 15:21:43 +0200 |
|---|---|---|
| committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2025-08-09 19:05:15 +0200 |
| commit | ed929d4a7d3917737b97f781df483f6840d5bc4b (patch) | |
| tree | 9bf8335a570337f3c524644bf3e59e216881f08d | |
| parent | pdm: 2.24.2 -> 2.25.5 (diff) | |
| download | nixpkgs-ed929d4a7d3917737b97f781df483f6840d5bc4b.tar.gz | |
python3Packages.django*: fix compat with python 3.13.6 and newer
4 files changed, 76 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/django/3.13.6-html-parser.patch b/pkgs/development/python-modules/django/3.13.6-html-parser.patch new file mode 100644 index 000000000000..6d986be38478 --- /dev/null +++ b/pkgs/development/python-modules/django/3.13.6-html-parser.patch @@ -0,0 +1,58 @@ +From e0a1e8d549e7be25960b8ad060c63def3dc35d1d Mon Sep 17 00:00:00 2001 +From: Natalia <124304+nessita@users.noreply.github.com> +Date: Mon, 21 Jul 2025 15:23:32 -0300 +Subject: [PATCH 1/2] Fixed test_utils.tests.HTMLEqualTests.test_parsing_errors + following Python's HTMLParser fixed parsing. + +Further details about Python changes can be found in: +https://github.com/python/cpython/commit/0243f97cbadec8d985e63b1daec5d1cbc850cae3. + +Thank you Clifford Gama for the thorough review! +--- + tests/test_utils/tests.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py +index 37e87aa1022c..9c22b61b4ff2 100644 +--- a/tests/test_utils/tests.py ++++ b/tests/test_utils/tests.py +@@ -962,7 +962,7 @@ def test_parsing_errors(self): + "('Unexpected end tag `div` (Line 1, Column 6)', (1, 6))" + ) + with self.assertRaisesMessage(AssertionError, error_msg): +- self.assertHTMLEqual("< div></ div>", "<div></div>") ++ self.assertHTMLEqual("< div></div>", "<div></div>") + with self.assertRaises(HTMLParseError): + parse_html("</p>") + + +From e8afcf0e644553bcba3e5f931266963bffc46748 Mon Sep 17 00:00:00 2001 +From: Natalia <124304+nessita@users.noreply.github.com> +Date: Mon, 14 Jul 2025 14:45:03 -0300 +Subject: [PATCH 2/2] Fixed #36499 -- Adjusted + utils_tests.test_html.TestUtilsHtml.test_strip_tags following Python's + HTMLParser new behavior. + +Python fixed a quadratic complexity processing for HTMLParser in: +https://github.com/python/cpython/commit/6eb6c5dbfb528bd07d77b60fd71fd05d81d45c41. +--- + tests/utils_tests/test_html.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py +index 284f33aedcfb..51573b81eb9d 100644 +--- a/tests/utils_tests/test_html.py ++++ b/tests/utils_tests/test_html.py +@@ -142,10 +142,10 @@ def test_strip_tags(self): + ("&gotcha&#;<>", "&gotcha&#;<>"), + ("<sc<!-- -->ript>test<<!-- -->/script>", "ript>test"), + ("<script>alert()</script>&h", "alert()h"), +- ("><!" + ("&" * 16000) + "D", "><!" + ("&" * 16000) + "D"), ++ ("><!" + ("&" * 16000) + "D", ">"), + ("X<<<<br>br>br>br>X", "XX"), + ("<" * 50 + "a>" * 50, ""), +- (">" + "<a" * 500 + "a", ">" + "<a" * 500 + "a"), ++ (">" + "<a" * 500 + "a", ">"), + ("<a" * 49 + "a" * 951, "<a" * 49 + "a" * 951), + ("<" + "a" * 1_002, "<" + "a" * 1_002), + ) diff --git a/pkgs/development/python-modules/django/4.nix b/pkgs/development/python-modules/django/4.nix index 2bd5b6ae34ce..04a73e71871a 100644 --- a/pkgs/development/python-modules/django/4.nix +++ b/pkgs/development/python-modules/django/4.nix @@ -79,6 +79,12 @@ buildPythonPackage rec { includes = [ "django/*" ]; # tests don't apply hash = "sha256-8YwdOBNJq6+GNoxzdLyN9HEEIWRXGQk9YbyfPwYVkwU="; }) + + ] + ++ lib.optionals (pythonAtLeast "3.13") [ + # https://code.djangoproject.com/ticket/36499 + # https://github.com/django/django/pull/19639 + ./3.13.6-html-parser.patch ] ++ lib.optionals withGdal [ (replaceVars ./django_4_set_geos_gdal_lib.patch { diff --git a/pkgs/development/python-modules/django/5_1.nix b/pkgs/development/python-modules/django/5_1.nix index 4b2b815d9d11..bf01cf87c85c 100644 --- a/pkgs/development/python-modules/django/5_1.nix +++ b/pkgs/development/python-modules/django/5_1.nix @@ -4,6 +4,7 @@ buildPythonPackage, fetchFromGitHub, fetchpatch, + pythonAtLeast, pythonOlder, replaceVars, @@ -71,6 +72,11 @@ buildPythonPackage rec { hash = "sha256-+K20/V8sh036Ox9U7CSPgfxue7f28Sdhr3MsB7erVOk="; }) ] + ++ lib.optionals (pythonAtLeast "3.13") [ + # https://code.djangoproject.com/ticket/36499 + # https://github.com/django/django/pull/19639 + ./3.13.6-html-parser.patch + ] ++ lib.optionals withGdal [ (replaceVars ./django_5_set_geos_gdal_lib.patch { geos = geos; diff --git a/pkgs/development/python-modules/django/5_2.nix b/pkgs/development/python-modules/django/5_2.nix index 95ed0f2b0dfb..c1db9106da63 100644 --- a/pkgs/development/python-modules/django/5_2.nix +++ b/pkgs/development/python-modules/django/5_2.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchFromGitHub, - fetchpatch, + pythonAtLeast, pythonOlder, replaceVars, @@ -64,6 +64,11 @@ buildPythonPackage rec { # disable test that expects timezone issues ./django_5_disable_failing_tests.patch ] + ++ lib.optionals (pythonAtLeast "3.13") [ + # https://code.djangoproject.com/ticket/36499 + # https://github.com/django/django/pull/19639 + ./3.13.6-html-parser.patch + ] ++ lib.optionals withGdal [ (replaceVars ./django_5_set_geos_gdal_lib.patch { geos = geos; |
