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