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