1{ lib
2, stdenv
3, aiohttp
4, aioresponses
5, buildPythonPackage
6, cachetools
7, cryptography
8, fetchPypi
9, flask
10, freezegun
11, grpcio
12, mock
13, oauth2client
14, pyasn1-modules
15, pyopenssl
16, pytest-asyncio
17, pytest-localserver
18, pytestCheckHook
19, pythonOlder
20, pyu2f
21, requests
22, responses
23, rsa
24, six
25, urllib3
26}:
27
28buildPythonPackage rec {
29 pname = "google-auth";
30 version = "2.19.1";
31 format = "setuptools";
32
33 disabled = pythonOlder "3.6";
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-qc+oiz4WGWhF5ko2WOuVOZISnROsczewZMZUb3fBcYM=";
38 };
39
40 propagatedBuildInputs = [
41 cachetools
42 pyasn1-modules
43 rsa
44 six
45 urllib3
46 ];
47
48 passthru.optional-dependencies = {
49 aiohttp = [
50 aiohttp
51 requests
52 ];
53 enterprise_cert = [
54 cryptography
55 pyopenssl
56 ];
57 pyopenssl = [
58 pyopenssl
59 ];
60 reauth = [
61 pyu2f
62 ];
63 requests = [
64 requests
65 ];
66 };
67
68 nativeCheckInputs = [
69 aioresponses
70 flask
71 freezegun
72 grpcio
73 mock
74 oauth2client
75 pytest-asyncio
76 pytest-localserver
77 pytestCheckHook
78 responses
79 ] ++ passthru.optional-dependencies.aiohttp
80 # `cryptography` is still required on `aarch64-darwin` for `tests/crypt/*`
81 ++ (if (stdenv.isDarwin && stdenv.isAarch64) then [ cryptography ] else passthru.optional-dependencies.enterprise_cert)
82 ++ passthru.optional-dependencies.reauth;
83
84 pythonImportsCheck = [
85 "google.auth"
86 "google.oauth2"
87 ];
88
89 disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
90 # Disable tests using pyOpenSSL as it does not build on M1 Macs
91 "tests/transport/test__mtls_helper.py"
92 "tests/transport/test_requests.py"
93 "tests/transport/test_urllib3.py"
94 "tests/transport/test__custom_tls_signer.py"
95 ];
96
97 __darwinAllowLocalNetworking = true;
98
99 meta = with lib; {
100 description = "Google Auth Python Library";
101 longDescription = ''
102 This library simplifies using Google's various server-to-server
103 authentication mechanisms to access Google APIs.
104 '';
105 homepage = "https://github.com/googleapis/google-auth-library-python";
106 changelog = "https://github.com/googleapis/google-auth-library-python/blob/v${version}/CHANGELOG.md";
107 license = licenses.asl20;
108 maintainers = with maintainers; [ SuperSandro2000 ];
109 };
110}