1{ lib
2, buildPythonPackage
3, isPy3k
4, fetchFromGitHub
5, substituteAll
6, xmlsec
7, cryptography, defusedxml, pyopenssl, dateutil, pytz, requests, six
8, mock, pyasn1, pymongo, pytest, responses, xmlschema, importlib-resources
9}:
10
11buildPythonPackage rec {
12 pname = "pysaml2";
13 version = "6.5.1";
14
15 disabled = !isPy3k;
16
17 # No tests in PyPI tarball
18 src = fetchFromGitHub {
19 owner = "IdentityPython";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "1gh74csjk6af23agyigk4id79s4li1xnkmbpp73aqyvlly2kd0b7";
23 };
24
25 patches = [
26 (substituteAll {
27 src = ./hardcode-xmlsec1-path.patch;
28 inherit xmlsec;
29 })
30 ];
31
32 postPatch = ''
33 # fix failing tests on systems with 32bit time_t
34 sed -i 's/2999\(-.*T\)/2029\1/g' tests/*.xml
35 '';
36
37 propagatedBuildInputs = [
38 cryptography
39 dateutil
40 defusedxml
41 importlib-resources
42 pyopenssl
43 pytz
44 requests
45 six
46 xmlschema
47 ];
48
49 checkInputs = [ mock pyasn1 pymongo pytest responses ];
50
51 # Disabled tests try to access the network
52 checkPhase = ''
53 py.test -k "not test_load_extern_incommon \
54 and not test_load_remote_encoding \
55 and not test_load_external \
56 and not test_conf_syslog"
57 '';
58
59 meta = with lib; {
60 homepage = "https://github.com/rohe/pysaml2";
61 description = "Python implementation of SAML Version 2 Standard";
62 license = licenses.asl20;
63 };
64
65}