2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
attrs,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
hypothesis,
|
|
|
|
pythonOlder,
|
|
|
|
jbig2dec,
|
|
|
|
deprecated,
|
|
|
|
lxml,
|
|
|
|
mupdf-headless,
|
|
|
|
numpy,
|
|
|
|
packaging,
|
|
|
|
pillow,
|
|
|
|
psutil,
|
|
|
|
pybind11,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
python-dateutil,
|
|
|
|
python-xmp-toolkit,
|
|
|
|
qpdf,
|
|
|
|
setuptools,
|
|
|
|
substituteAll,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pikepdf";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "9.1.1";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pikepdf";
|
|
|
|
repo = "pikepdf";
|
|
|
|
rev = "v${version}";
|
|
|
|
# The content of .git_archival.txt is substituted upon tarball creation,
|
|
|
|
# which creates indeterminism if master no longer points to the tag.
|
|
|
|
# See https://github.com/jbarlow83/OCRmyPDF/issues/841
|
2022-06-16 17:23:12 +00:00
|
|
|
postFetch = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
rm "$out/.git_archival.txt"
|
|
|
|
'';
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-++je4tKnXr504Yl9VBH9dc9fycDrMstRN5hu4s/oe9w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./paths.patch;
|
2024-01-25 14:12:00 +00:00
|
|
|
jbig2dec = lib.getExe' jbig2dec "jbig2dec";
|
|
|
|
mutool = lib.getExe' mupdf-headless "mutool";
|
2021-09-22 15:38:15 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2024-07-27 06:49:29 +00:00
|
|
|
--replace-fail "shims_enabled = not cflags_defined" "shims_enabled = False"
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ qpdf ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [
|
2023-02-09 11:40:11 +00:00
|
|
|
pybind11
|
|
|
|
setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2020-04-24 23:36:52 +00:00
|
|
|
attrs
|
|
|
|
hypothesis
|
2024-01-13 08:15:51 +00:00
|
|
|
numpy
|
2021-02-13 14:23:35 +00:00
|
|
|
pytest-xdist
|
|
|
|
psutil
|
|
|
|
pytestCheckHook
|
2020-12-07 07:45:13 +00:00
|
|
|
python-dateutil
|
2020-04-24 23:36:52 +00:00
|
|
|
python-xmp-toolkit
|
|
|
|
];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
dependencies = [
|
2024-01-13 08:15:51 +00:00
|
|
|
deprecated
|
2021-02-13 14:23:35 +00:00
|
|
|
lxml
|
2022-01-03 16:56:52 +00:00
|
|
|
packaging
|
2021-02-13 14:23:35 +00:00
|
|
|
pillow
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
pythonImportsCheck = [ "pikepdf" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/pikepdf/pikepdf";
|
|
|
|
description = "Read and write PDFs with Python, powered by qpdf";
|
|
|
|
license = licenses.mpl20;
|
2024-06-24 18:47:55 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
2022-06-16 17:23:12 +00:00
|
|
|
changelog = "https://github.com/pikepdf/pikepdf/blob/${src.rev}/docs/releasenotes/version${lib.versions.major version}.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|