depot/third_party/nixpkgs/pkgs/development/python-modules/dj-rest-auth/default.nix
Default email e7ec2969af Project import generated by Copybara.
GitOrigin-RevId: 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d
2024-01-13 09:15:51 +01:00

83 lines
1.8 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, django
, django-allauth
, djangorestframework
, djangorestframework-simplejwt
, responses
, unittest-xml-reporting
, python
, setuptools
}:
buildPythonPackage rec {
pname = "dj-rest-auth";
version = "5.0.2";
pyproject = true;
src = fetchFromGitHub {
owner = "iMerica";
repo = "dj-rest-auth";
rev = "refs/tags/${version}";
hash = "sha256-TqeNpxXn+v89fEiJ4AVNhp8blCfYQKFQfYmZ6/QlRbQ=";
};
patches = [
(fetchpatch {
# https://github.com/iMerica/dj-rest-auth/pull/561
url = "https://github.com/iMerica/dj-rest-auth/commit/be0cf53d94582183320b0994082f0a312c1066d9.patch";
hash = "sha256-BhZ7BWW8m609cVn1WCyPfpZq/706YVZAesrkcMKTD3A=";
})
];
postPatch = ''
substituteInPlace setup.py \
--replace "coveralls>=1.11.1" "" \
--replace "==" ">="
'';
nativeBuildInputs = [
setuptools
];
buildInputs = [
django
];
propagatedBuildInputs = [
djangorestframework
];
passthru.optional-dependencies.with_social = [
django-allauth
];
nativeCheckInputs = [
djangorestframework-simplejwt
responses
unittest-xml-reporting
] ++ passthru.optional-dependencies.with_social;
preCheck = ''
# connects to graph.facebook.com
substituteInPlace dj_rest_auth/tests/test_serializers.py \
--replace "def test_http_error" "def dont_test_http_error"
'';
checkPhase = ''
runHook preCheck
${python.interpreter} runtests.py
runHook postCheck
'';
pythonImportsCheck = [ "dj_rest_auth" ];
meta = with lib; {
description = "Authentication for Django Rest Framework";
homepage = "https://github.com/iMerica/dj-rest-auth";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}