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