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