1{
2 lib,
3 buildPythonPackage,
4 cryptography,
5 defusedxml,
6 fetchFromGitHub,
7 fetchpatch,
8 paste,
9 poetry-core,
10 pyasn1,
11 pymongo,
12 pyopenssl,
13 pytestCheckHook,
14 python-dateutil,
15 pythonOlder,
16 pytz,
17 repoze-who,
18 requests,
19 responses,
20 setuptools,
21 replaceVars,
22 xmlschema,
23 xmlsec,
24 zope-interface,
25}:
26
27buildPythonPackage rec {
28 pname = "pysaml2";
29 version = "7.5.2";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "IdentityPython";
34 repo = "pysaml2";
35 tag = "v${version}";
36 hash = "sha256-2mvAXTruZqoSBUgfT2VEAnWQXVdviG0e49y7LPK5x00=";
37 };
38
39 patches = [
40 (replaceVars ./hardcode-xmlsec1-path.patch {
41 inherit xmlsec;
42 })
43 # Replaces usages of deprecated/removed pyopenssl APIs
44 (fetchpatch {
45 url = "https://github.com/IdentityPython/pysaml2/pull/977/commits/930a652a240c8cd1489429a7d70cf5fa7ef1606a.patch";
46 hash = "sha256-kBNvGk5pwVmpW1wsIWVH9wapu6kjFavaTt4e3Llaw2c=";
47 })
48 ];
49
50 postPatch = ''
51 # Fix failing tests on systems with 32bit time_t
52 sed -i 's/2999\(-.*T\)/2029\1/g' tests/*.xml
53 '';
54
55 pythonRelaxDeps = [ "xmlschema" ];
56
57 nativeBuildInputs = [
58 poetry-core
59 ];
60
61 propagatedBuildInputs = [
62 cryptography
63 defusedxml
64 pyopenssl
65 python-dateutil
66 pytz
67 requests
68 setuptools
69 xmlschema
70 ];
71
72 optional-dependencies = {
73 s2repoze = [
74 paste
75 repoze-who
76 zope-interface
77 ];
78 };
79
80 nativeCheckInputs = [
81 pyasn1
82 pymongo
83 pytestCheckHook
84 responses
85 ];
86
87 disabledTests = [
88 # Disabled tests try to access the network
89 "test_load_extern_incommon"
90 "test_load_remote_encoding"
91 "test_load_external"
92 "test_conf_syslog"
93
94 # Broken XML schema check in 7.5.2
95 "test_namespace_processing"
96 ];
97
98 pythonImportsCheck = [ "saml2" ];
99
100 meta = with lib; {
101 description = "Python implementation of SAML Version 2 Standard";
102 homepage = "https://github.com/IdentityPython/pysaml2";
103 changelog = "https://github.com/IdentityPython/pysaml2/blob/v${version}/CHANGELOG.md";
104 license = licenses.asl20;
105 maintainers = [ ];
106 };
107}