1{ lib
2, attrs
3, buildPythonPackage
4, defusedxml
5, fetchFromGitHub
6, hypothesis
7, isPy3k
8, jbig2dec
9, lxml
10, mupdf
11, pillow
12, psutil
13, pybind11
14, pytest-xdist
15, pytestCheckHook
16, python-dateutil
17, python-xmp-toolkit
18, qpdf
19, setuptools
20, setuptools-scm
21, setuptools-scm-git-archive
22, substituteAll
23}:
24
25buildPythonPackage rec {
26 pname = "pikepdf";
27 version = "4.0.1.post1";
28 disabled = ! isPy3k;
29
30 src = fetchFromGitHub {
31 owner = "pikepdf";
32 repo = "pikepdf";
33 rev = "v${version}";
34 # The content of .git_archival.txt is substituted upon tarball creation,
35 # which creates indeterminism if master no longer points to the tag.
36 # See https://github.com/jbarlow83/OCRmyPDF/issues/841
37 extraPostFetch = ''
38 rm "$out/.git_archival.txt"
39 '';
40 sha256 = "sha256-s7eS7jYGohYt75/r++4v9K6BRfiQ3drdG5wbIL3WoiU=";
41 };
42
43 patches = [
44 (substituteAll {
45 src = ./paths.patch;
46 jbig2dec = "${lib.getBin jbig2dec}/bin/jbig2dec";
47 mudraw = "${lib.getBin mupdf}/bin/mudraw";
48 })
49 ];
50
51 SETUPTOOLS_SCM_PRETEND_VERSION = version;
52
53 buildInputs = [
54 pybind11
55 qpdf
56 ];
57
58 nativeBuildInputs = [
59 setuptools-scm-git-archive
60 setuptools-scm
61 ];
62
63 checkInputs = [
64 attrs
65 hypothesis
66 pytest-xdist
67 psutil
68 pytestCheckHook
69 python-dateutil
70 python-xmp-toolkit
71 ];
72
73 propagatedBuildInputs = [
74 defusedxml
75 lxml
76 pillow
77 setuptools
78 ];
79
80 pythonImportsCheck = [ "pikepdf" ];
81
82 meta = with lib; {
83 homepage = "https://github.com/pikepdf/pikepdf";
84 description = "Read and write PDFs with Python, powered by qpdf";
85 license = licenses.mpl20;
86 maintainers = with maintainers; [ kiwi dotlambda ];
87 changelog = "https://github.com/pikepdf/pikepdf/blob/${version}/docs/release_notes.rst";
88 };
89}