at 23.05-pre 3.0 kB view raw
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5, asn1crypto 6, click 7, cryptography 8, pyhanko-certvalidator 9, pytz 10, pyyaml 11, qrcode 12, requests 13, tzlocal 14, certomancer 15, freezegun 16, python-pae 17, pytest-aiohttp 18, requests-mock 19, pytestCheckHook 20# Flags to add to the library 21, extraPubkeyAlgsSupport ? false 22, oscrypto 23, opentypeSupport ? false 24, fonttools 25, uharfbuzz 26, imageSupport ? false 27, pillow 28, python-barcode 29, pkcs11Support ? false 30, python-pkcs11 31, asyncHttpSupport ? false 32, aiohttp 33}: 34 35buildPythonPackage rec { 36 pname = "pyhanko"; 37 version = "0.12.1"; 38 format = "setuptools"; 39 40 disabled = pythonOlder "3.7"; 41 42 # Tests are only available on GitHub 43 src = fetchFromGitHub { 44 owner = "MatthiasValvekens"; 45 repo = "pyHanko"; 46 rev = version; 47 sha256 = "sha256-W60NTKEtCqJ/QdtNiieKUsrl2jIjIH86Wych68R3mBc="; 48 }; 49 50 propagatedBuildInputs = [ 51 click 52 pyhanko-certvalidator 53 pytz 54 pyyaml 55 qrcode 56 tzlocal 57 ] ++ lib.optionals (extraPubkeyAlgsSupport) [ 58 oscrypto 59 ] ++ lib.optionals (opentypeSupport) [ 60 fonttools 61 uharfbuzz 62 ] ++ lib.optionals (imageSupport) [ 63 pillow 64 python-barcode 65 ] ++ lib.optionals (pkcs11Support) [ 66 python-pkcs11 67 ] ++ lib.optionals (asyncHttpSupport) [ 68 aiohttp 69 ]; 70 71 postPatch = '' 72 substituteInPlace setup.py \ 73 --replace ", 'pytest-runner'" "" \ 74 --replace "pytest-aiohttp~=0.3.0" "pytest-aiohttp~=1.0.3" 75 ''; 76 77 checkInputs = [ 78 aiohttp 79 certomancer 80 freezegun 81 python-pae 82 pytest-aiohttp 83 requests-mock 84 pytestCheckHook 85 ]; 86 87 disabledTestPaths = lib.optionals (!opentypeSupport) [ 88 "pyhanko_tests/test_stamp.py" 89 "pyhanko_tests/test_text.py" 90 ] ++ lib.optionals (!imageSupport) [ 91 "pyhanko_tests/test_barcode.py" 92 ] ++ lib.optionals (!pkcs11Support) [ 93 "pyhanko_tests/test_pkcs11.py" 94 ]; 95 96 disabledTests = [ 97 # Most of the test require working with local certificates, 98 # contacting OSCP or performing requests 99 "test_generic_data_sign_legacy" 100 "test_generic_data_sign" 101 "test_cms_v3_sign" 102 "test_detached_cms_with_self_reported_timestamp" 103 "test_detached_cms_with_tst" 104 "test_detached_cms_with_content_tst" 105 "test_detached_cms_with_wrong_content_tst" 106 "test_detached_with_malformed_content_tst" 107 "test_noop_attribute_prov" 108 "test_detached_cades_cms_with_tst" 109 "test_read_qr_config" 110 "test_no_changes_policy" 111 "test_bogus_metadata_manipulation" 112 "test_tamper_sig_obj" 113 "test_signed_file_diff_proxied_objs" 114 "test_pades_revinfo_live" 115 "test_diff_fallback_ok" 116 "test_no_diff_summary" 117 "test_ocsp_embed" 118 "test_ts_fetch_aiohttp" 119 "test_ts_fetch_requests" 120 ]; 121 122 pythonImportsCheck = [ 123 "pyhanko" 124 ]; 125 126 meta = with lib; { 127 description = "Sign and stamp PDF files"; 128 homepage = "https://github.com/MatthiasValvekens/pyHanko"; 129 license = licenses.mit; 130 maintainers = with maintainers; [ wolfangaukang ]; 131 }; 132}