1{
2 lib,
3 aiohttp,
4 asn1crypto,
5 buildPythonPackage,
6 certomancer,
7 click,
8 cryptography,
9 defusedxml,
10 fetchFromGitHub,
11 fonttools,
12 freezegun,
13 oscrypto,
14 pillow,
15 pyhanko-certvalidator,
16 pytest-aiohttp,
17 pytestCheckHook,
18 python-barcode,
19 python-pae,
20 python-pkcs11,
21 pythonOlder,
22 pytz,
23 pyyaml,
24 qrcode,
25 requests,
26 requests-mock,
27 setuptools,
28 tzlocal,
29 uharfbuzz,
30 wheel,
31 xsdata,
32}:
33
34buildPythonPackage rec {
35 pname = "pyhanko";
36 version = "0.21.0";
37 pyproject = true;
38
39 disabled = pythonOlder "3.8";
40
41 src = fetchFromGitHub {
42 owner = "MatthiasValvekens";
43 repo = "pyHanko";
44 rev = "refs/tags/v${version}";
45 hash = "sha256-+RlrXuKMY89mO4iuFw7RLQABy+wLrAeHlEvTDCpBSqU=";
46 };
47
48 postPatch = ''
49 substituteInPlace pyproject.toml \
50 --replace ' "pytest-runner",' ""
51 '';
52
53 nativeBuildInputs = [
54 setuptools
55 wheel
56 ];
57
58 propagatedBuildInputs = [
59 asn1crypto
60 click
61 cryptography
62 pyhanko-certvalidator
63 pytz
64 pyyaml
65 qrcode
66 requests
67 tzlocal
68 ];
69
70 passthru.optional-dependencies = {
71 extra-pubkey-algs = [ oscrypto ];
72 xmp = [ defusedxml ];
73 opentype = [
74 fonttools
75 uharfbuzz
76 ];
77 image-support = [
78 pillow
79 python-barcode
80 ];
81 pkcs11 = [ python-pkcs11 ];
82 async-http = [ aiohttp ];
83 etsi = [ xsdata ];
84 };
85
86 nativeCheckInputs = [
87 aiohttp
88 certomancer
89 freezegun
90 python-pae
91 pytest-aiohttp
92 requests-mock
93 pytestCheckHook
94 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
95
96 disabledTestPaths = [
97 # ModuleNotFoundError: No module named 'csc_dummy'
98 "pyhanko_tests/test_csc.py"
99 ];
100
101 disabledTests = [
102 # Most of the test require working with local certificates,
103 # contacting OSCP or performing requests
104 "test_generic_data_sign_legacy"
105 "test_generic_data_sign"
106 "test_cms_v3_sign"
107 "test_detached_cms_with_self_reported_timestamp"
108 "test_detached_cms_with_tst"
109 "test_detached_cms_with_content_tst"
110 "test_detached_cms_with_wrong_content_tst"
111 "test_detached_with_malformed_content_tst"
112 "test_noop_attribute_prov"
113 "test_detached_cades_cms_with_tst"
114 "test_read_qr_config"
115 "test_no_changes_policy"
116 "test_bogus_metadata_manipulation"
117 "test_tamper_sig_obj"
118 "test_signed_file_diff_proxied_objs"
119 "test_pades_revinfo_live"
120 "test_diff_fallback_ok"
121 "test_no_diff_summary"
122 "test_ocsp_embed"
123 "test_ts_fetch_aiohttp"
124 "test_ts_fetch_requests"
125 ];
126
127 pythonImportsCheck = [ "pyhanko" ];
128
129 meta = with lib; {
130 description = "Sign and stamp PDF files";
131 mainProgram = "pyhanko";
132 homepage = "https://github.com/MatthiasValvekens/pyHanko";
133 changelog = "https://github.com/MatthiasValvekens/pyHanko/blob/v${version}/docs/changelog.rst";
134 license = licenses.mit;
135 maintainers = with maintainers; [ wolfangaukang ];
136 };
137}