nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 183 lines 4.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 10 # dependencies 11 asn1crypto, 12 cryptography, 13 lxml, 14 pyhanko-certvalidator, 15 pyyaml, 16 requests, 17 tzlocal, 18 19 # optional-dependencies 20 fonttools, 21 uharfbuzz, 22 pillow, 23 python-barcode, 24 python-pkcs11, 25 aiohttp, 26 xsdata, 27 qrcode, 28 29 # tests 30 certomancer, 31 freezegun, 32 pytest-aiohttp, 33 pytestCheckHook, 34 python-pae, 35 requests-mock, 36 signxml, 37}: 38 39buildPythonPackage rec { 40 pname = "pyhanko"; 41 version = "0.32.0"; 42 pyproject = true; 43 44 src = fetchFromGitHub { 45 owner = "MatthiasValvekens"; 46 repo = "pyHanko"; 47 tag = "v${version}"; 48 hash = "sha256-UyJ9odchy63CcCkJVtBgraRQuD2fxqCciwLuhN4+8aw="; 49 }; 50 51 sourceRoot = "${src.name}/pkgs/pyhanko"; 52 53 postPatch = '' 54 substituteInPlace src/pyhanko/version/__init__.py \ 55 --replace-fail "0.0.0.dev1" "${version}" \ 56 --replace-fail "(0, 0, 0, 'dev1')" "tuple(\"${version}\".split(\".\"))" 57 substituteInPlace pyproject.toml \ 58 --replace-fail "0.0.0.dev1" "${version}" 59 ''; 60 61 build-system = [ setuptools ]; 62 63 dependencies = [ 64 asn1crypto 65 cryptography 66 pyhanko-certvalidator 67 pyyaml 68 requests 69 tzlocal 70 lxml 71 ]; 72 73 optional-dependencies = { 74 opentype = [ 75 fonttools 76 uharfbuzz 77 ]; 78 image-support = [ 79 pillow 80 python-barcode 81 ]; 82 pkcs11 = [ python-pkcs11 ]; 83 async-http = [ aiohttp ]; 84 etsi = [ 85 xsdata 86 signxml 87 ]; 88 qr = [ qrcode ]; 89 }; 90 91 nativeCheckInputs = [ 92 aiohttp 93 certomancer 94 freezegun 95 pytest-aiohttp 96 pytestCheckHook 97 python-pae 98 requests-mock 99 passthru.testData 100 signxml 101 ] 102 ++ lib.concatAttrValues optional-dependencies; 103 104 disabledTestPaths = [ 105 # ModuleNotFoundError: No module named 'csc_dummy' 106 "tests/test_csc.py" 107 ] 108 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 109 # OSError: One or more parameters passed to a function were not valid. 110 "tests/cli_tests" 111 ]; 112 113 disabledTests = [ 114 # Most of the test require working with local certificates, 115 # contacting OSCP or performing requests 116 "test_generic_data_sign_legacy" 117 "test_generic_data_sign" 118 "test_cms_v3_sign" 119 "test_detached_cms_with_self_reported_timestamp" 120 "test_detached_cms_with_tst" 121 "test_detached_cms_with_content_tst" 122 "test_detached_cms_with_wrong_content_tst" 123 "test_detached_with_malformed_content_tst" 124 "test_noop_attribute_prov" 125 "test_detached_cades_cms_with_tst" 126 "test_read_qr_config" 127 "test_no_changes_policy" 128 "test_bogus_metadata_manipulation" 129 "test_tamper_sig_obj" 130 "test_signed_file_diff_proxied_objs" 131 "test_pades_revinfo_live" 132 "test_diff_fallback_ok" 133 "test_no_diff_summary" 134 "test_ocsp_embed" 135 "test_ts_fetch_aiohttp" 136 "test_ts_fetch_requests" 137 138 # https://github.com/MatthiasValvekens/pyHanko/pull/595 139 "test_simple_text_stamp_on_page_with_leaky_graphics_state" 140 "test_simple_text_stamp_on_page_with_leaky_graphics_state_without_coord_correction" 141 ] 142 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 143 # OSError: One or more parameters passed to a function were not valid. 144 "test_detached_cms_with_duplicated_attr" 145 "test_detached_cms_with_wrong_tst" 146 "test_diff_analysis_add_extensions_dict" 147 "test_diff_analysis_update_indirect_extensions_not_all_path" 148 "test_no_certificates" 149 "test_ocsp_without_nextupdate_embed" 150 ]; 151 152 pythonImportsCheck = [ "pyhanko" ]; 153 154 passthru = { 155 testData = buildPythonPackage { 156 pname = "common-test-utils"; 157 inherit version pyproject src; 158 159 sourceRoot = "${src.name}/internal/common-test-utils"; 160 # Include the test pdf/xml files etc. in the build output 161 postPatch = '' 162 echo "graft src/test_data" > MANIFEST.in 163 ''; 164 165 build-system = [ setuptools ]; 166 167 dependencies = [ 168 certomancer 169 pyhanko-certvalidator 170 ]; 171 172 pythonRemoveDeps = [ "pyhanko" ]; 173 }; 174 }; 175 176 meta = { 177 description = "Sign and stamp PDF files"; 178 homepage = "https://github.com/MatthiasValvekens/pyHanko"; 179 changelog = "https://github.com/MatthiasValvekens/pyHanko/blob/${src.tag}/docs/changelog.rst#pyhanko"; 180 license = lib.licenses.mit; 181 maintainers = [ lib.maintainers.antonmosich ]; 182 }; 183}