2021-02-13 14:23:35 +00:00
|
|
|
{ lib
|
|
|
|
, attrs
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, hypothesis
|
2022-04-15 01:41:22 +00:00
|
|
|
, pythonOlder
|
2022-06-16 17:23:12 +00:00
|
|
|
, importlib-metadata
|
2021-09-22 15:38:15 +00:00
|
|
|
, jbig2dec
|
2022-07-14 12:49:19 +00:00
|
|
|
, deprecation
|
2020-04-24 23:36:52 +00:00
|
|
|
, lxml
|
2021-09-22 15:38:15 +00:00
|
|
|
, mupdf
|
2022-01-03 16:56:52 +00:00
|
|
|
, packaging
|
2020-04-24 23:36:52 +00:00
|
|
|
, pillow
|
2021-02-13 14:23:35 +00:00
|
|
|
, psutil
|
2020-04-24 23:36:52 +00:00
|
|
|
, pybind11
|
2021-02-13 14:23:35 +00:00
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2020-12-07 07:45:13 +00:00
|
|
|
, python-dateutil
|
2020-04-24 23:36:52 +00:00
|
|
|
, python-xmp-toolkit
|
|
|
|
, qpdf
|
2021-02-13 14:23:35 +00:00
|
|
|
, setuptools-scm
|
2021-09-22 15:38:15 +00:00
|
|
|
, substituteAll
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pikepdf";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "6.2.6";
|
2022-04-15 01:41:22 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
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"
|
|
|
|
'';
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-SqGWXuRwz79ZoDFL6sU9hX3FG/VLwLhQYzZOtT3tqvE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./paths.patch;
|
|
|
|
jbig2dec = "${lib.getBin jbig2dec}/bin/jbig2dec";
|
|
|
|
mudraw = "${lib.getBin mupdf}/bin/mudraw";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2022-09-30 11:47:45 +00:00
|
|
|
--replace "shims_enabled = not cflags_defined" "shims_enabled = False"
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
pybind11
|
|
|
|
qpdf
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-13 14:23:35 +00:00
|
|
|
setuptools-scm
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
attrs
|
|
|
|
hypothesis
|
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
|
|
|
|
];
|
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
propagatedBuildInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
deprecation
|
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
|
2022-06-16 17:23:12 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
|
|
|
importlib-metadata
|
2021-02-13 14:23:35 +00:00
|
|
|
];
|
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;
|
2021-09-22 15:38:15 +00:00
|
|
|
maintainers = with maintainers; [ kiwi 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
|
|
|
};
|
|
|
|
}
|