about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/social-auth-core/default.nix
blob: d81101ac9a9dc970b1acc7a867f652949e6176e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{ lib
, buildPythonPackage
, cryptography
, defusedxml
, fetchFromGitHub
, httpretty
, lxml
, oauthlib
, pyjwt
, pytestCheckHook
, python-jose
, python3-openid
, python3-saml
, pythonOlder
, requests
, requests-oauthlib
}:

buildPythonPackage rec {
  pname = "social-auth-core";
  version = "4.5.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "python-social-auth";
    repo = "social-core";
    rev = "refs/tags/${version}";
    hash = "sha256-5WEXXLl0IUPMbji8bWjTbAjY8VSLOTQvrfSCE9+ui5Y=";
  };

  propagatedBuildInputs = [
    cryptography
    defusedxml
    oauthlib
    pyjwt
    python3-openid
    requests
    requests-oauthlib
  ];

  passthru.optional-dependencies = {
    openidconnect = [
      python-jose
    ];
    saml = [
      lxml
      python3-saml
    ];
    azuread = [
      cryptography
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    httpretty
  ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);

  # Disable checking the code coverage
  prePatch = ''
    substituteInPlace social_core/tests/requirements.txt \
      --replace "coverage>=3.6" "" \
      --replace "pytest-cov>=2.7.1" ""

    substituteInPlace tox.ini \
      --replace "{posargs:-v --cov=social_core}" "{posargs:-v}"
  '';

  pythonImportsCheck = [
    "social_core"
  ];

  meta = with lib; {
    description = "Module for social authentication/registration mechanisms";
    homepage = "https://github.com/python-social-auth/social-core";
    changelog = "https://github.com/python-social-auth/social-core/blob/${version}/CHANGELOG.md";
    license = licenses.bsd3;
    maintainers = with maintainers; [ n0emis ];
  };
}