python3Packages.pyhanko: 0.25.3 -> 0.31.0 (#459577)

This commit is contained in:
dotlambda
2025-11-10 01:10:51 +00:00
committed by GitHub
3 changed files with 150 additions and 36 deletions
+66
View File
@@ -0,0 +1,66 @@
{
lib,
fetchFromGitHub,
python3Packages,
nix-update-script,
}:
python3Packages.buildPythonApplication rec {
pname = "pyhanko-cli";
version = "0.2.0";
pyproject = true;
src = fetchFromGitHub {
owner = "MatthiasValvekens";
repo = "pyhanko";
tag = "pyhanko-cli/v${version}";
hash = "sha256-ZDHAcI2yoiVifYt05V85lz8mJmoyi10g4XoLQ+LhLHE=";
};
sourceRoot = "${src.name}/pkgs/pyhanko-cli";
postPatch = ''
substituteInPlace src/pyhanko/cli/version.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 = [ python3Packages.setuptools ];
dependencies =
with python3Packages;
[
asn1crypto
tzlocal
pyhanko
pyhanko-certvalidator
click
platformdirs
]
++ lib.flatten (lib.attrValues pyhanko.optional-dependencies);
nativeCheckInputs = with python3Packages; [
pytestCheckHook
pyhanko.testData
requests-mock
freezegun
certomancer
aiohttp
];
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex=pyhanko-cli/v(.*)"
];
};
meta = {
description = "Sign and stamp PDF files";
mainProgram = "pyhanko";
homepage = "https://github.com/MatthiasValvekens/pyHanko/tree/master/pkgs/pyhanko-cli";
changelog = "https://github.com/MatthiasValvekens/pyHanko/blob/pyhanko-cli/${src.tag}/docs/changelog.rst#pyhanko-cli";
license = lib.licenses.mit;
maintainers = [ lib.maintainers.antonmosich ];
};
}
@@ -1,34 +1,43 @@
{
lib,
aiohttp,
asn1crypto,
buildPythonPackage,
cryptography,
fetchFromGitHub,
freezegun,
nix-update-script,
asn1crypto,
cryptography,
oscrypto,
requests,
uritools,
aiohttp,
freezegun,
pytest-asyncio,
pytestCheckHook,
pythonOlder,
requests,
setuptools,
uritools,
}:
buildPythonPackage rec {
pname = "pyhanko-certvalidator";
version = "0.26.8";
version = "0.29.0";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "MatthiasValvekens";
repo = "certvalidator";
tag = "v${version}";
hash = "sha256-Gvahyuz3n/CNAEzMXS5Z0Z85yDqLUQu8Yis5oJ2jaKc=";
repo = "pyhanko";
tag = "pyhanko-certvalidator/v${version}";
hash = "sha256-ZDHAcI2yoiVifYt05V85lz8mJmoyi10g4XoLQ+LhLHE=";
};
sourceRoot = "${src.name}/pkgs/pyhanko-certvalidator";
postPatch = ''
substituteInPlace src/pyhanko_certvalidator/version.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 = [
@@ -48,11 +57,17 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pyhanko_certvalidator" ];
passthru.updateScript = nix-update-script {
extraArgs = [
"--version-regex=pyhanko-certvalidator/v(.*)"
];
};
meta = with lib; {
description = "Python library for validating X.509 certificates and paths";
homepage = "https://github.com/MatthiasValvekens/certvalidator";
changelog = "https://github.com/MatthiasValvekens/certvalidator/blob/v${version}/changelog.md";
homepage = "https://github.com/MatthiasValvekens/pyHanko/tree/master/pkgs/pyhanko-certvalidator";
changelog = "https://github.com/MatthiasValvekens/pyhanko/blob/pyhanko-certvalidator/${src.tag}/docs/changelog.rst#pyhanko-certvalidator";
license = licenses.mit;
maintainers = [ ];
maintainers = [ lib.maintainers.antonmosich ];
};
}
@@ -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=";
};
sourceRoot = "${src.name}/pkgs/pyhanko";
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 ];
pythonRelaxDeps = [
"cryptography"
];
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 ];
};
}