[Backport release-26.05] python3Packages.django-cacheops: fix and modernize (#565332)

This commit is contained in:
Jonas Heinrich
2026-09-21 13:11:49 +00:00
committed by GitHub
2 changed files with 49 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
From 938f8ba11c0676a1b9090c1cf788321ec24979e6 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 29 May 2026 12:00:23 +1000
Subject: [PATCH] Support Python 3.14 pickle changes
pickle.dump() and friends in Python 3.14 will now raise PicklingError
rather than AttributeError when they encounter something that can not be
pickled, extend test_385 to handle both exceptions.
---
tests/tests.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/tests.py b/tests/tests.py
index f99f8e26..5ad67a55 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -2,6 +2,7 @@
from functools import reduce
import operator
import re
+from pickle import PicklingError
import platform
import unittest
from unittest import mock
@@ -659,7 +660,7 @@ def test_366(self):
def test_385(self):
Client.objects.create(name='Client Name')
- with self.assertRaisesRegex(AttributeError, "local object"):
+ with self.assertRaisesRegex((AttributeError, PicklingError), "local object"):
Client.objects.filter(name='Client Name').cache().first()
invalidate_model(Client)

View File

@@ -1,7 +1,8 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
fetchpatch,
django,
funcy,
redis,
@@ -18,17 +19,24 @@
setuptools,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "django-cacheops";
version = "7.2";
pyproject = true;
src = fetchPypi {
pname = "django_cacheops";
inherit version;
hash = "sha256-y8EcwDISlaNkTie8smlA8Iy5wucdPuUGy8/wvdoanzM=";
src = fetchFromGitHub {
owner = "Suor";
repo = "django-cacheops";
tag = finalAttrs.version;
hash = "sha256-o0QPBfoYZzBPMjDQt8ck2Tkx3qInyfnN88buire0yc4=";
};
patches = [
# Fixes failure with python3.14 pickle changes
# https://github.com/Suor/django-cacheops/pull/511
./Support-Python-3.14-pickle-changes.patch
];
pythonRelaxDeps = [ "funcy" ];
build-system = [ setuptools ];
@@ -59,8 +67,8 @@ buildPythonPackage rec {
meta = {
description = "Slick ORM cache with automatic granular event-driven invalidation for Django";
homepage = "https://github.com/Suor/django-cacheops";
changelog = "https://github.com/Suor/django-cacheops/blob/${version}/CHANGELOG";
changelog = "https://github.com/Suor/django-cacheops/blob/${finalAttrs.version}/CHANGELOG";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ onny ];
};
}
})