From 7f3efc4ffb6c1e64aede5be27ee981fd3b848d38 Mon Sep 17 00:00:00 2001 From: "P. R. d. O" Date: Thu, 21 Apr 2022 18:28:45 -0600 Subject: [PATCH] python310Packages.pyhanko: init at 0.12.1 --- ...0001-Updating-pytest-aiohttp-version.patch | 25 ++++ .../python-modules/pyhanko/default.nix | 132 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 159 insertions(+) create mode 100644 pkgs/development/python-modules/pyhanko/0001-Updating-pytest-aiohttp-version.patch create mode 100644 pkgs/development/python-modules/pyhanko/default.nix diff --git a/pkgs/development/python-modules/pyhanko/0001-Updating-pytest-aiohttp-version.patch b/pkgs/development/python-modules/pyhanko/0001-Updating-pytest-aiohttp-version.patch new file mode 100644 index 00000000000..562dc6461ef --- /dev/null +++ b/pkgs/development/python-modules/pyhanko/0001-Updating-pytest-aiohttp-version.patch @@ -0,0 +1,25 @@ +From 942d4fd37786941bae91b769ef6499a4b4da6843 Mon Sep 17 00:00:00 2001 +From: "P. R. d. O" +Date: Sat, 9 Apr 2022 12:40:59 -0600 +Subject: [PATCH] Updating pytest-aiohttp version + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index fe33d9a..694fab4 100644 +--- a/setup.py ++++ b/setup.py +@@ -85,7 +85,7 @@ setup( + tests_require=[ + 'pytest>=6.1.1', 'requests-mock>=1.8.0', + 'freezegun>=1.1.0', 'certomancer~=0.8.1', +- 'aiohttp~=3.8.0', 'pytest-aiohttp~=0.3.0', ++ 'aiohttp~=3.8.0', 'pytest-aiohttp~=1.0.3', + 'python-pae==0.1.0' + ], + keywords="signature pdf pades digital-signature pkcs11" +-- +2.35.1 + diff --git a/pkgs/development/python-modules/pyhanko/default.nix b/pkgs/development/python-modules/pyhanko/default.nix new file mode 100644 index 00000000000..2cd71ae0f33 --- /dev/null +++ b/pkgs/development/python-modules/pyhanko/default.nix @@ -0,0 +1,132 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, asn1crypto +, click +, cryptography +, pyhanko-certvalidator +, pytz +, pyyaml +, qrcode +, requests +, tzlocal +, certomancer +, freezegun +, python-pae +, pytest-aiohttp +, requests-mock +, pytestCheckHook +# Flags to add to the library +, extraPubkeyAlgsSupport ? false +, oscrypto +, opentypeSupport ? false +, fonttools +, uharfbuzz +, imageSupport ? false +, pillow +, python-barcode +, pkcs11Support ? false +, python-pkcs11 +, asyncHttpSupport ? false +, aiohttp +}: + +buildPythonPackage rec { + pname = "pyhanko"; + version = "0.12.1"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + # Tests are only available on GitHub + src = fetchFromGitHub { + owner = "MatthiasValvekens"; + repo = "pyHanko"; + rev = version; + sha256 = "sha256-W60NTKEtCqJ/QdtNiieKUsrl2jIjIH86Wych68R3mBc="; + }; + + propagatedBuildInputs = [ + click + pyhanko-certvalidator + pytz + pyyaml + qrcode + tzlocal + ] ++ lib.optionals (extraPubkeyAlgsSupport) [ + oscrypto + ] ++ lib.optionals (opentypeSupport) [ + fonttools + uharfbuzz + ] ++ lib.optionals (imageSupport) [ + pillow + python-barcode + ] ++ lib.optionals (pkcs11Support) [ + python-pkcs11 + ] ++ lib.optionals (asyncHttpSupport) [ + aiohttp + ]; + + postPatch = '' + substituteInPlace setup.py \ + --replace ", 'pytest-runner'" "" \ + --replace "pytest-aiohttp~=0.3.0" "pytest-aiohttp~=1.0.3" + ''; + + checkInputs = [ + aiohttp + certomancer + freezegun + python-pae + pytest-aiohttp + requests-mock + pytestCheckHook + ]; + + disabledTestPaths = lib.optionals (!opentypeSupport) [ + "pyhanko_tests/test_stamp.py" + "pyhanko_tests/test_text.py" + ] ++ lib.optionals (!imageSupport) [ + "pyhanko_tests/test_barcode.py" + ] ++ lib.optionals (!pkcs11Support) [ + "pyhanko_tests/test_pkcs11.py" + ]; + + disabledTests = [ + # Most of the test require working with local certificates, + # contacting OSCP or performing requests + "test_generic_data_sign_legacy" + "test_generic_data_sign" + "test_cms_v3_sign" + "test_detached_cms_with_self_reported_timestamp" + "test_detached_cms_with_tst" + "test_detached_cms_with_content_tst" + "test_detached_cms_with_wrong_content_tst" + "test_detached_with_malformed_content_tst" + "test_noop_attribute_prov" + "test_detached_cades_cms_with_tst" + "test_read_qr_config" + "test_no_changes_policy" + "test_bogus_metadata_manipulation" + "test_tamper_sig_obj" + "test_signed_file_diff_proxied_objs" + "test_pades_revinfo_live" + "test_diff_fallback_ok" + "test_no_diff_summary" + "test_ocsp_embed" + "test_ts_fetch_aiohttp" + "test_ts_fetch_requests" + ]; + + pythonImportsCheck = [ + "pyhanko" + ]; + + meta = with lib; { + description = "Sign and stamp PDF files"; + homepage = "https://github.com/MatthiasValvekens/pyHanko"; + license = licenses.mit; + maintainers = with maintainers; [ wolfangaukang ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 8e4ce686c94..b38c5873e38 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7161,6 +7161,8 @@ in { pyhamcrest = callPackage ../development/python-modules/pyhamcrest { }; + pyhanko = callPackage ../development/python-modules/pyhanko { }; + pyhanko-certvalidator = callPackage ../development/python-modules/pyhanko-certvalidator { }; pyhaversion = callPackage ../development/python-modules/pyhaversion { };