Unverified Commit 9ae26d37 authored by Anton Mosich's avatar Anton Mosich
Browse files

python3Packages.pyhanko: 0.25.3 -> 0.31.0

See https://docs.pyhanko.eu/en/latest/changelog.html#pyhanko for
changelog, the passthru.testData is needed for the tests of both pyhanko
itself and pyhanko-cli.
parent 3af65397
Loading
Loading
Loading
Loading
+53 −20
Original line number Diff line number Diff line
@@ -9,17 +9,14 @@

  # dependencies
  asn1crypto,
  click,
  cryptography,
  lxml,
  pyhanko-certvalidator,
  pyyaml,
  qrcode,
  requests,
  tzlocal,

  # optional-dependencies
  oscrypto,
  defusedxml,
  fonttools,
  uharfbuzz,
  pillow,
@@ -27,6 +24,7 @@
  python-pkcs11,
  aiohttp,
  xsdata,
  qrcode,

  # tests
  certomancer,
@@ -35,40 +33,44 @@
  pytestCheckHook,
  python-pae,
  requests-mock,
  signxml,
}:

buildPythonPackage rec {
  pname = "pyhanko";
  version = "0.25.3";
  version = "0.31.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "MatthiasValvekens";
    repo = "pyHanko";
    tag = "v${version}";
    hash = "sha256-HJkCQ5YDVr17gtY4PW89ep7GwFdP21/ruBEKm7j3+Qo=";
    hash = "sha256-ZDHAcI2yoiVifYt05V85lz8mJmoyi10g4XoLQ+LhLHE=";
  };

  build-system = [ setuptools ];
  sourceRoot = "${src.name}/pkgs/pyhanko";

  pythonRelaxDeps = [
    "cryptography"
  ];
  postPatch = ''
    substituteInPlace src/pyhanko/version/__init__.py \
      --replace-fail "0.0.0.dev1" "${version}" \
      --replace-fail "(0, 0, 0, 'dev1')" "tuple(\"${version}\".split(\".\"))"
    substituteInPlace pyproject.toml \
      --replace-fail "0.0.0.dev1" "${version}"
  '';

  build-system = [ setuptools ];

  dependencies = [
    asn1crypto
    click
    cryptography
    pyhanko-certvalidator
    pyyaml
    qrcode
    requests
    tzlocal
    lxml
  ];

  optional-dependencies = {
    extra-pubkey-algs = [ oscrypto ];
    xmp = [ defusedxml ];
    opentype = [
      fonttools
      uharfbuzz
@@ -79,7 +81,11 @@ buildPythonPackage rec {
    ];
    pkcs11 = [ python-pkcs11 ];
    async-http = [ aiohttp ];
    etsi = [ xsdata ];
    etsi = [
      xsdata
      signxml
    ];
    qr = [ qrcode ];
  };

  nativeCheckInputs = [
@@ -90,16 +96,18 @@ buildPythonPackage rec {
    pytestCheckHook
    python-pae
    requests-mock
    passthru.testData
    signxml
  ]
  ++ lib.flatten (lib.attrValues optional-dependencies);

  disabledTestPaths = [
    # ModuleNotFoundError: No module named 'csc_dummy'
    "pyhanko_tests/test_csc.py"
    "tests/test_csc.py"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # OSError: One or more parameters passed to a function were not valid.
    "pyhanko_tests/cli_tests"
    "tests/cli_tests"
  ];

  disabledTests = [
@@ -126,6 +134,10 @@ buildPythonPackage rec {
    "test_ocsp_embed"
    "test_ts_fetch_aiohttp"
    "test_ts_fetch_requests"

    # https://github.com/MatthiasValvekens/pyHanko/pull/595
    "test_simple_text_stamp_on_page_with_leaky_graphics_state"
    "test_simple_text_stamp_on_page_with_leaky_graphics_state_without_coord_correction"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # OSError: One or more parameters passed to a function were not valid.
@@ -139,12 +151,33 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "pyhanko" ];

  passthru = {
    testData = buildPythonPackage {
      pname = "common-test-utils";
      inherit version pyproject src;

      sourceRoot = "${src.name}/internal/common-test-utils";
      # Include the test pdf/xml files etc. in the build output
      postPatch = ''
        echo "graft src/test_data" > MANIFEST.in
      '';

      build-system = [ setuptools ];

      dependencies = [
        certomancer
        pyhanko-certvalidator
      ];

      pythonRemoveDeps = [ "pyhanko" ];
    };
  };

  meta = {
    description = "Sign and stamp PDF files";
    mainProgram = "pyhanko";
    homepage = "https://github.com/MatthiasValvekens/pyHanko";
    changelog = "https://github.com/MatthiasValvekens/pyHanko/blob/v${version}/docs/changelog.rst";
    changelog = "https://github.com/MatthiasValvekens/pyHanko/blob/${src.tag}/docs/changelog.rst#pyhanko";
    license = lib.licenses.mit;
    maintainers = [ ];
    maintainers = [ lib.maintainers.antonmosich ];
  };
}