1{ lib
2, buildPythonPackage
3, cryptography
4, defusedxml
5, fetchFromGitHub
6, fetchPypi
7, importlib-resources
8, poetry-core
9, pyasn1
10, pymongo
11, pyopenssl
12, pytestCheckHook
13, python-dateutil
14, pythonOlder
15, pytz
16, requests
17, responses
18, setuptools
19, substituteAll
20, xmlschema
21, xmlsec
22}:
23
24let
25 pymongo3 = pymongo.overridePythonAttrs(old: rec {
26 version = "3.12.3";
27 src = fetchPypi {
28 pname = "pymongo";
29 inherit version;
30 hash = "sha256-ConK3ABipeU2ZN3gQ/bAlxcrjBxfAJRJAJUoL/mZWl8=";
31 };
32 });
33in buildPythonPackage rec {
34 pname = "pysaml2";
35 version = "7.4.1";
36 format = "pyproject";
37
38 disabled = pythonOlder "3.9";
39
40 src = fetchFromGitHub {
41 owner = "IdentityPython";
42 repo = pname;
43 rev = "v${version}";
44 hash = "sha256-QHAbm6u5oH3O7MEVFE+sW98raquv89KJ8gonk3Yyu/0=";
45 };
46
47 nativeBuildInputs = [
48 poetry-core
49 ];
50
51 propagatedBuildInputs = [
52 cryptography
53 defusedxml
54 pyopenssl
55 python-dateutil
56 pytz
57 requests
58 setuptools
59 xmlschema
60 ] ++ lib.optionals (pythonOlder "3.9") [
61 importlib-resources
62 ];
63
64 nativeCheckInputs = [
65 pyasn1
66 pymongo3
67 pytestCheckHook
68 responses
69 ];
70
71 patches = [
72 (substituteAll {
73 src = ./hardcode-xmlsec1-path.patch;
74 inherit xmlsec;
75 })
76 ];
77
78 postPatch = ''
79 # fix failing tests on systems with 32bit time_t
80 sed -i 's/2999\(-.*T\)/2029\1/g' tests/*.xml
81 '';
82
83 disabledTests = [
84 # Disabled tests try to access the network
85 "test_load_extern_incommon"
86 "test_load_remote_encoding"
87 "test_load_external"
88 "test_conf_syslog"
89 ];
90
91 pythonImportsCheck = [
92 "saml2"
93 ];
94
95 meta = with lib; {
96 description = "Python implementation of SAML Version 2 Standard";
97 homepage = "https://github.com/IdentityPython/pysaml2";
98 license = licenses.asl20;
99 maintainers = with maintainers; [ ];
100 };
101}