1{
2 lib,
3 buildPythonPackage,
4 django,
5 django-allauth,
6 djangorestframework,
7 djangorestframework-simplejwt,
8 fetchFromGitHub,
9 fetchpatch,
10 python,
11 responses,
12 setuptools,
13 unittest-xml-reporting,
14}:
15
16buildPythonPackage rec {
17 pname = "dj-rest-auth";
18 version = "7.0.1";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "iMerica";
23 repo = "dj-rest-auth";
24 tag = version;
25 hash = "sha256-bus7Sf5H4PA5YFrkX7hbALOq04koDz3KTO42hHFJPhw=";
26 };
27
28 patches = [
29 # See https://github.com/iMerica/dj-rest-auth/pull/683
30 (fetchpatch {
31 name = "djangorestframework-simplejwt_5.5_compatibility.patch";
32 url = "https://github.com/iMerica/dj-rest-auth/commit/cc5587e4e3f327697709f3f0d491650bff5464e7.diff";
33 hash = "sha256-2LahibxuNECAfjqsbNs2ezaWt1VH0ZBNwSNWCZwIe8I=";
34 })
35 ];
36
37 postPatch = ''
38 substituteInPlace setup.py \
39 --replace-fail "==" ">="
40 '';
41
42 build-system = [ setuptools ];
43
44 buildInputs = [ django ];
45
46 dependencies = [ djangorestframework ];
47
48 optional-dependencies.with_social = [
49 django-allauth
50 ] ++ django-allauth.optional-dependencies.socialaccount;
51
52 nativeCheckInputs = [
53 djangorestframework-simplejwt
54 responses
55 unittest-xml-reporting
56 ] ++ optional-dependencies.with_social;
57
58 preCheck = ''
59 # Test connects to graph.facebook.com
60 substituteInPlace dj_rest_auth/tests/test_serializers.py \
61 --replace-fail "def test_http_error" "def dont_test_http_error"
62 '';
63
64 checkPhase = ''
65 runHook preCheck
66 ${python.interpreter} runtests.py
67 runHook postCheck
68 '';
69
70 pythonImportsCheck = [ "dj_rest_auth" ];
71
72 meta = with lib; {
73 description = "Authentication for Django Rest Framework";
74 homepage = "https://github.com/iMerica/dj-rest-auth";
75 changelog = "https://github.com/iMerica/dj-rest-auth/releases/tag/${version}";
76 license = licenses.mit;
77 maintainers = [ ];
78 };
79}