3a4df29a92
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
97 lines
2 KiB
Nix
97 lines
2 KiB
Nix
{ lib
|
|
, attrs
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, hypothesis
|
|
, pythonOlder
|
|
, importlib-metadata
|
|
, jbig2dec
|
|
, lxml
|
|
, mupdf
|
|
, packaging
|
|
, pillow
|
|
, psutil
|
|
, pybind11
|
|
, pytest-xdist
|
|
, pytestCheckHook
|
|
, python-dateutil
|
|
, python-xmp-toolkit
|
|
, qpdf
|
|
, setuptools-scm
|
|
, substituteAll
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "pikepdf";
|
|
version = "5.1.5";
|
|
format = "setuptools";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
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
|
|
postFetch = ''
|
|
rm "$out/.git_archival.txt"
|
|
'';
|
|
hash = "sha256-DEgxdMVX5gQOsV9EyJtO/MO7padYMZrekanpp+nNvek=";
|
|
};
|
|
|
|
patches = [
|
|
(substituteAll {
|
|
src = ./paths.patch;
|
|
jbig2dec = "${lib.getBin jbig2dec}/bin/jbig2dec";
|
|
mudraw = "${lib.getBin mupdf}/bin/mudraw";
|
|
})
|
|
];
|
|
|
|
postPatch = ''
|
|
sed -i 's|\S*/opt/homebrew.*|pass|' setup.py
|
|
|
|
substituteInPlace setup.py \
|
|
--replace setuptools_scm_git_archive ""
|
|
'';
|
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
|
|
|
buildInputs = [
|
|
pybind11
|
|
qpdf
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
setuptools-scm
|
|
];
|
|
|
|
checkInputs = [
|
|
attrs
|
|
hypothesis
|
|
pytest-xdist
|
|
psutil
|
|
pytestCheckHook
|
|
python-dateutil
|
|
python-xmp-toolkit
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
lxml
|
|
packaging
|
|
pillow
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
|
importlib-metadata
|
|
];
|
|
|
|
pythonImportsCheck = [ "pikepdf" ];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/pikepdf/pikepdf";
|
|
description = "Read and write PDFs with Python, powered by qpdf";
|
|
license = licenses.mpl20;
|
|
maintainers = with maintainers; [ kiwi dotlambda ];
|
|
changelog = "https://github.com/pikepdf/pikepdf/blob/${src.rev}/docs/releasenotes/version${lib.versions.major version}.rst";
|
|
};
|
|
}
|