1{ lib
2, buildPythonPackage
3, cryptography
4, defusedxml
5, fetchFromGitHub
6, httpretty
7, lxml
8, oauthlib
9, pyjwt
10, pytestCheckHook
11, python-jose
12, python3-openid
13, python3-saml
14, pythonOlder
15, requests
16, requests-oauthlib
17}:
18
19buildPythonPackage rec {
20 pname = "social-auth-core";
21 version = "4.4.2";
22 format = "setuptools";
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "python-social-auth";
28 repo = "social-core";
29 rev = "refs/tags/${version}";
30 hash = "sha256-o/qx3bwaj2fiNKM3fafFxOW27JrJ9jG4M4uSnnJDpes=";
31 };
32
33 propagatedBuildInputs = [
34 cryptography
35 defusedxml
36 oauthlib
37 pyjwt
38 python3-openid
39 requests
40 requests-oauthlib
41 ];
42
43 passthru.optional-dependencies = {
44 openidconnect = [
45 python-jose
46 ];
47 saml = [
48 lxml
49 python3-saml
50 ];
51 azuread = [
52 cryptography
53 ];
54 };
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 httpretty
59 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
60
61 # Disable checking the code coverage
62 prePatch = ''
63 substituteInPlace social_core/tests/requirements.txt \
64 --replace "coverage>=3.6" "" \
65 --replace "pytest-cov>=2.7.1" ""
66
67 substituteInPlace tox.ini \
68 --replace "{posargs:-v --cov=social_core}" "{posargs:-v}"
69 '';
70
71 pythonImportsCheck = [
72 "social_core"
73 ];
74
75 meta = with lib; {
76 description = "Module for social authentication/registration mechanisms";
77 homepage = "https://github.com/python-social-auth/social-core";
78 license = licenses.bsd3;
79 maintainers = with maintainers; [ n0emis ];
80 };
81}