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