2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
flit-core,
|
|
|
|
|
|
|
|
# docs
|
|
|
|
sphinxHook,
|
|
|
|
sphinx-rtd-theme,
|
|
|
|
myst-parser,
|
|
|
|
|
|
|
|
# propagates
|
|
|
|
typing-extensions,
|
|
|
|
|
|
|
|
# optionals
|
|
|
|
cryptography,
|
|
|
|
pillow,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
fpdf2,
|
|
|
|
pytestCheckHook,
|
|
|
|
pytest-timeout,
|
2023-03-15 16:39:30 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pypdf";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "4.2.0";
|
2023-03-15 16:39:30 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "py-pdf";
|
|
|
|
repo = "pypdf";
|
|
|
|
rev = "refs/tags/${version}";
|
|
|
|
# fetch sample files used in tests
|
|
|
|
fetchSubmodules = true;
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-ksLpxfRxrNVXezF0VjbAqadpF6bv/SAOOnCKabhugo0=";
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"doc"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
flit-core
|
|
|
|
|
|
|
|
# docs
|
|
|
|
sphinxHook
|
|
|
|
sphinx-rtd-theme
|
|
|
|
myst-parser
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace "--disable-socket" ""
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (pythonOlder "3.10") [ typing-extensions ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
passthru.optional-dependencies = rec {
|
|
|
|
full = crypto ++ image;
|
2024-06-05 15:53:02 +00:00
|
|
|
crypto = [ cryptography ];
|
|
|
|
image = [ pillow ];
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pypdf" ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
nativeCheckInputs = [
|
2024-06-05 15:53:02 +00:00
|
|
|
(fpdf2.overridePythonAttrs { doCheck = false; }) # avoid reference loop
|
2023-03-15 16:39:30 +00:00
|
|
|
pytestCheckHook
|
2023-08-22 20:05:09 +00:00
|
|
|
pytest-timeout
|
2023-03-15 16:39:30 +00:00
|
|
|
] ++ passthru.optional-dependencies.full;
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# don't access the network
|
2024-06-05 15:53:02 +00:00
|
|
|
"-m"
|
|
|
|
"'not enable_socket'"
|
2023-08-22 20:05:09 +00:00
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files";
|
|
|
|
homepage = "https://github.com/py-pdf/pypdf";
|
|
|
|
changelog = "https://github.com/py-pdf/pypdf/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
license = licenses.bsd3;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [ javaes ];
|
2023-03-15 16:39:30 +00:00
|
|
|
};
|
|
|
|
}
|