python310Packages.drf-nested-routers: fix django4 compat

by backporting patches, that have not yet made it into a new release.

Move django into buildInputs, because we require consumers to bring
their own django version anyway.

Migrate tests to pytest, because they work very well and are easier to
maintain.
This commit is contained in:
Martin Weinelt
2023-08-03 14:35:37 +02:00
parent fe50817d10
commit ca5c50bcf9
@@ -1,33 +1,55 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, fetchpatch
, django
, djangorestframework
, pytest
, pytest-cov
, pytestCheckHook
, pytest-django
, ipdb
, python
}:
buildPythonPackage rec {
pname = "drf-nested-routers";
version = "0.93.4";
format = "setuptools";
src = fetchFromGitHub {
owner = "alanjds";
repo = "drf-nested-routers";
rev = "v${version}";
rev = "refs/tags/v${version}";
hash = "sha256-qlXNDydoQJ9FZB6G7yV/pNmx3BEo+lvRqsfjrvlbdNY=";
};
propagatedBuildInputs = [ django djangorestframework setuptools ];
nativeCheckInputs = [ pytest pytest-cov pytest-django ipdb ];
patches = [
# django4 compatibility
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/59764cc356f7f593422b26845a9dfac0ad196120.patch";
hash = "sha256-mq3vLHzQlGl2EReJ5mVVQMMcYgGIVt/T+qi1STtQ0aI=";
})
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/723a5729dd2ffcb66fe315f229789ca454986fa4.patch";
hash = "sha256-UCbBjwlidqsJ9vEEWlGzfqqMOr0xuB2TAaUxHsLzFfU=";
})
(fetchpatch {
url = "https://github.com/alanjds/drf-nested-routers/commit/38e49eb73759bc7dcaaa9166169590f5315e1278.patch";
hash = "sha256-IW4BLhHHhXDUZqHaXg46qWoQ89pMXv0ZxKjOCTnDcI0=";
})
];
checkPhase = ''
${python.interpreter} runtests.py --nolint
'';
buildInputs = [
django
];
propagatedBuildInputs = [
djangorestframework
];
nativeCheckInputs = [
ipdb
pytestCheckHook
pytest-django
];
meta = with lib; {
homepage = "https://github.com/alanjds/drf-nested-routers";