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