1{ stdenv, buildPythonPackage, fetchpatch, fetchPypi
2, pytest, mock, oauth2client, flask, requests, urllib3, pytest-localserver, six, pyasn1-modules, cachetools, rsa }:
3
4buildPythonPackage rec {
5 pname = "google-auth";
6 version = "1.6.3";
7
8 src = fetchPypi {
9 inherit pname version;
10 sha256 = "0f7c6a64927d34c1a474da92cfc59e552a5d3b940d3266606c6a28b72888b9e4";
11 };
12 patches = [
13 (fetchpatch {
14 name = "use-new-pytest-api-to-keep-building-with-pytest5.patch";
15 url = "https://github.com/googleapis/google-auth-library-python/commit/b482417a04dbbc207fcd6baa7a67e16b1a9ffc77.patch";
16 sha256 = "07jpa7pa6sffbcwlsg5fgcv2vvngil5qpmv6fhjqp7fnvx0674s0";
17 })
18 ];
19
20 checkInputs = [ pytest mock oauth2client flask requests urllib3 pytest-localserver ];
21 propagatedBuildInputs = [ six pyasn1-modules cachetools rsa ];
22
23 # The removed test tests the working together of google_auth and google's https://pypi.python.org/pypi/oauth2client
24 # but the latter is deprecated. Since it is not currently part of the nixpkgs collection and deprecated it will
25 # probably never be. We just remove the test to make the tests work again.
26 postPatch = ''rm tests/test__oauth2client.py'';
27
28 checkPhase = ''
29 py.test
30 '';
31
32 meta = with stdenv.lib; {
33 description = "This library simplifies using Google’s various server-to-server authentication mechanisms to access Google APIs.";
34 homepage = "https://google-auth.readthedocs.io/en/latest/";
35 license = licenses.asl20;
36 maintainers = with maintainers; [ vanschelven ];
37 };
38}