From cbda4e872410bcef6c2ff63767915d4f2f9df0bc Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 30 Mar 2026 16:34:15 +0200 Subject: [PATCH] python3Packages.django_4: drop Removing due to it becoming a leaf package right before it's EOL on April 30th. Closes: #490868 --- .../python-modules/bcrypt/default.nix | 4 +- pkgs/development/python-modules/django/4.nix | 174 ------------------ .../django/django_4_set_geos_gdal_lib.patch | 26 --- .../django/django_4_set_zoneinfo_dir.patch | 13 -- .../django/django_4_tests.patch | 51 ----- .../python-modules/sqlparse/default.nix | 2 - pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 2 - 8 files changed, 3 insertions(+), 270 deletions(-) delete mode 100644 pkgs/development/python-modules/django/4.nix delete mode 100644 pkgs/development/python-modules/django/django_4_set_geos_gdal_lib.patch delete mode 100644 pkgs/development/python-modules/django/django_4_set_zoneinfo_dir.patch delete mode 100644 pkgs/development/python-modules/django/django_4_tests.patch diff --git a/pkgs/development/python-modules/bcrypt/default.nix b/pkgs/development/python-modules/bcrypt/default.nix index b50cb3faef22..464986863266 100644 --- a/pkgs/development/python-modules/bcrypt/default.nix +++ b/pkgs/development/python-modules/bcrypt/default.nix @@ -10,7 +10,7 @@ pytestCheckHook, # for passthru.tests asyncssh, - django_4, + django, fastapi, paramiko, twisted, @@ -57,7 +57,7 @@ buildPythonPackage rec { passthru.tests = { inherit asyncssh - django_4 + django fastapi paramiko twisted diff --git a/pkgs/development/python-modules/django/4.nix b/pkgs/development/python-modules/django/4.nix deleted file mode 100644 index 69127fd6767f..000000000000 --- a/pkgs/development/python-modules/django/4.nix +++ /dev/null @@ -1,174 +0,0 @@ -{ - lib, - stdenv, - buildPythonPackage, - fetchFromGitHub, - fetchpatch, - pythonAtLeast, - replaceVars, - - # build - setuptools, - - # patched in - geos, - gdal, - withGdal ? false, - - # propagates - asgiref, - sqlparse, - - # extras - argon2-cffi, - bcrypt, - - # tests - aiosmtpd, - docutils, - geoip2, - jinja2, - numpy, - pillow, - pylibmc, - pymemcache, - python, - pywatchman, - pyyaml, - pytz, - redis, - selenium, - tblib, - tzdata, -}: - -buildPythonPackage rec { - pname = "django"; - version = "4.2.29"; - pyproject = true; - - disabled = pythonAtLeast "3.13"; - - src = fetchFromGitHub { - owner = "django"; - repo = "django"; - tag = version; - hash = "sha256-30OcLxtACSxLJ1jT+k7fmM8CyMyleXSPc+l7/3JZKzI="; - }; - - patches = [ - (replaceVars ./django_4_set_zoneinfo_dir.patch { - zoneinfo = tzdata + "/share/zoneinfo"; - }) - # make sure the tests don't remove packages from our pythonpath - # and disable failing tests - ./django_4_tests.patch - - # fix filename length limit tests on bcachefs - # FIXME: remove if ever backported - (fetchpatch { - url = "https://github.com/django/django/commit/12f4f95405c7857cbf2f4bf4d0261154aac31676.patch"; - hash = "sha256-+K20/V8sh036Ox9U7CSPgfxue7f28Sdhr3MsB7erVOk="; - }) - - # backport fix for https://code.djangoproject.com/ticket/36056 - # FIXME: remove if ever backported upstream - (fetchpatch { - url = "https://github.com/django/django/commit/ec0e784f91b551c654f0962431cc31091926792d.patch"; - includes = [ "django/*" ]; # tests don't apply - hash = "sha256-8YwdOBNJq6+GNoxzdLyN9HEEIWRXGQk9YbyfPwYVkwU="; - }) - - ] - ++ lib.optionals withGdal [ - (replaceVars ./django_4_set_geos_gdal_lib.patch { - geos = geos; - gdal = gdal; - extension = stdenv.hostPlatform.extensions.sharedLibrary; - }) - ]; - - postPatch = '' - substituteInPlace tests/utils_tests/test_autoreload.py \ - --replace "/usr/bin/python" "${python.interpreter}" - '' - + lib.optionalString (pythonAtLeast "3.12" && stdenv.hostPlatform.system == "aarch64-linux") '' - # Test regression after xz was reverted from 5.6.0 to 5.4.6 - # https://hydra.nixos.org/build/254630990 - substituteInPlace tests/view_tests/tests/test_debug.py \ - --replace-fail "test_files" "dont_test_files" - '' - + lib.optionalString (pythonAtLeast "3.13") '' - # Fixed CommandTypes.test_help_default_options_with_custom_arguments test on Python 3.13+. - # https://github.com/django/django/commit/3426a5c33c36266af42128ee9eca4921e68ea876 - substituteInPlace tests/admin_scripts/tests.py --replace-fail \ - "test_help_default_options_with_custom_arguments" \ - "dont_test_help_default_options_with_custom_arguments" - ''; - - nativeBuildInputs = [ setuptools ]; - - propagatedBuildInputs = [ - asgiref - sqlparse - ]; - - optional-dependencies = { - argon2 = [ argon2-cffi ]; - bcrypt = [ bcrypt ]; - }; - - nativeCheckInputs = [ - # tests/requirements/py3.txt - aiosmtpd - docutils - geoip2 - jinja2 - numpy - pillow - pylibmc - pymemcache - pywatchman - pyyaml - pytz - redis - selenium - tblib - tzdata - ] - ++ lib.concatAttrValues optional-dependencies; - - doCheck = - !stdenv.hostPlatform.isDarwin - # pywatchman depends on folly which does not support 32bits - && !stdenv.hostPlatform.is32bit; - - preCheck = '' - # make sure the installed library gets imported - rm -rf django - - # provide timezone data, works only on linux - export TZDIR=${tzdata}/${python.sitePackages}/tzdata/zoneinfo - ''; - - checkPhase = '' - runHook preCheck - - pushd tests - ${python.interpreter} runtests.py --settings=test_sqlite - popd - - runHook postCheck - ''; - - __darwinAllowLocalNetworking = true; - - meta = { - changelog = "https://docs.djangoproject.com/en/${lib.versions.majorMinor version}/releases/${version}/"; - description = "High-level Python Web framework that encourages rapid development and clean, pragmatic design"; - mainProgram = "django-admin"; - homepage = "https://www.djangoproject.com"; - license = lib.licenses.bsd3; - maintainers = with lib.maintainers; [ hexa ]; - }; -} diff --git a/pkgs/development/python-modules/django/django_4_set_geos_gdal_lib.patch b/pkgs/development/python-modules/django/django_4_set_geos_gdal_lib.patch deleted file mode 100644 index b3da31f1e109..000000000000 --- a/pkgs/development/python-modules/django/django_4_set_geos_gdal_lib.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py -index 05b5732..91fafee 100644 ---- a/django/contrib/gis/gdal/libgdal.py -+++ b/django/contrib/gis/gdal/libgdal.py -@@ -14,7 +14,7 @@ try: - from django.conf import settings - lib_path = settings.GDAL_LIBRARY_PATH - except (AttributeError, ImportError, ImproperlyConfigured, OSError): -- lib_path = None -+ lib_path = "@gdal@/lib/libgdal@extension@" - - if lib_path: - lib_names = None -diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py -index 2cdb5d3..fac2d04 100644 ---- a/django/contrib/gis/geos/libgeos.py -+++ b/django/contrib/gis/geos/libgeos.py -@@ -24,7 +24,7 @@ def load_geos(): - from django.conf import settings - lib_path = settings.GEOS_LIBRARY_PATH - except (AttributeError, ImportError, ImproperlyConfigured, OSError): -- lib_path = None -+ lib_path = "@geos@/lib/libgeos_c@extension@" - - # Setting the appropriate names for the GEOS-C library. - if lib_path: diff --git a/pkgs/development/python-modules/django/django_4_set_zoneinfo_dir.patch b/pkgs/development/python-modules/django/django_4_set_zoneinfo_dir.patch deleted file mode 100644 index d9848772b85a..000000000000 --- a/pkgs/development/python-modules/django/django_4_set_zoneinfo_dir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/django/conf/__init__.py b/django/conf/__init__.py -index cb70a71791..5156f7dd73 100644 ---- a/django/conf/__init__.py -+++ b/django/conf/__init__.py -@@ -227,7 +227,7 @@ class Settings: - if hasattr(time, "tzset") and self.TIME_ZONE: - # When we can, attempt to validate the timezone. If we can't find - # this file, no check happens and it's harmless. -- zoneinfo_root = Path("/usr/share/zoneinfo") -+ zoneinfo_root = Path("@zoneinfo@") - zone_info_file = zoneinfo_root.joinpath(*self.TIME_ZONE.split("/")) - if zoneinfo_root.exists() and not zone_info_file.exists(): - raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE) diff --git a/pkgs/development/python-modules/django/django_4_tests.patch b/pkgs/development/python-modules/django/django_4_tests.patch deleted file mode 100644 index 689e1ed652a8..000000000000 --- a/pkgs/development/python-modules/django/django_4_tests.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py -index 6d67c2931a..0c1f407f88 100644 ---- a/tests/admin_scripts/tests.py -+++ b/tests/admin_scripts/tests.py -@@ -127,6 +127,7 @@ class AdminScriptTestCase(SimpleTestCase): - del test_environ["DJANGO_SETTINGS_MODULE"] - python_path = [base_dir, django_dir, tests_dir] - python_path.extend(ext_backend_base_dirs) -+ python_path.extend(sys.path) - test_environ["PYTHONPATH"] = os.pathsep.join(python_path) - test_environ["PYTHONWARNINGS"] = "" - -diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py -index 36f22d5f09..6cc6888980 100644 ---- a/tests/auth_tests/test_hashers.py -+++ b/tests/auth_tests/test_hashers.py -@@ -1,4 +1,4 @@ --from unittest import mock, skipUnless -+from unittest import mock, skipUnless, skip - - from django.conf.global_settings import PASSWORD_HASHERS - from django.contrib.auth.hashers import ( -@@ -241,6 +241,7 @@ class TestUtilsHashPass(SimpleTestCase): - - @ignore_warnings(category=RemovedInDjango50Warning) - @skipUnless(crypt, "no crypt module to generate password.") -+ @skip("Legacy crypt algorithms are unsupported in nixpkgs") - @override_settings( - PASSWORD_HASHERS=["django.contrib.auth.hashers.CryptPasswordHasher"] - ) -diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py -index 62cbffbee9..2f0ec718f8 100644 ---- a/tests/settings_tests/tests.py -+++ b/tests/settings_tests/tests.py -@@ -2,7 +2,7 @@ import os - import sys - import unittest - from types import ModuleType, SimpleNamespace --from unittest import mock -+from unittest import mock, skip - - from django.conf import ( - ENVIRONMENT_VARIABLE, -@@ -342,6 +342,7 @@ class SettingsTests(SimpleTestCase): - getattr(s, "foo") - - @requires_tz_support -+ @skip("Assertion fails, exception does not get raised") - @mock.patch("django.conf.global_settings.TIME_ZONE", "test") - def test_incorrect_timezone(self): - with self.assertRaisesMessage(ValueError, "Incorrect timezone setting: test"): diff --git a/pkgs/development/python-modules/sqlparse/default.nix b/pkgs/development/python-modules/sqlparse/default.nix index 652813e38ae4..20086d0bb43e 100644 --- a/pkgs/development/python-modules/sqlparse/default.nix +++ b/pkgs/development/python-modules/sqlparse/default.nix @@ -8,7 +8,6 @@ # for passthru.tests django, - django_4, django-silk, pgadmin4, }: @@ -36,7 +35,6 @@ buildPythonPackage rec { passthru.tests = { inherit django - django_4 django-silk pgadmin4 ; diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 223f597fd1d0..3f7af9295e62 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -152,6 +152,7 @@ mapAliases { django-crispy-bootstrap5 = crispy-bootstrap5; # added 2025-06-11 django-modelsearch = modelsearch; # added 2026-03-02 django_3 = throw "Django 3 has reached it's EOL in 2024-04 and has therefore been removed."; # added 2025-01-25 + django_4 = throw "Django 4 has reached it's EOL in 2026-04 and has therefore been removed."; # added 2026-03-30 django_5_1 = throw "Django 5.1 has reached it's EOL in 2025-12 and has therefore been removed."; # added 2025-11-30" django_5_2 = django_5; # added 2026-01-18 django_appconf = throw "'django_appconf' has been renamed to/replaced by 'django-appconf'"; # Converted to throw 2025-10-29 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b667a6235c6c..115f36295c15 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4443,8 +4443,6 @@ self: super: with self; { { }; # LTS in extended support phase - django_4 = callPackage ../development/python-modules/django/4.nix { }; - django_5 = callPackage ../development/python-modules/django/5.nix { }; django_6 = callPackage ../development/python-modules/django/6.nix { };