nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hypothesis,
7 jbig2dec,
8 deprecated,
9 lxml,
10 mupdf-headless,
11 numpy,
12 packaging,
13 pillow,
14 psutil,
15 pybind11,
16 pytest-xdist,
17 pytestCheckHook,
18 python-dateutil,
19 python-xmp-toolkit,
20 qpdf,
21 setuptools,
22 replaceVars,
23}:
24
25buildPythonPackage rec {
26 pname = "pikepdf";
27 version = "10.3.0";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "pikepdf";
32 repo = "pikepdf";
33 tag = "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 postFetch = ''
38 rm "$out/.git_archival.txt"
39 '';
40 hash = "sha256-fEIzmC17RYic4CFwBh5FdGbJmaWaiaPBK7eCQ7RCmr0=";
41 };
42
43 patches = [
44 (replaceVars ./paths.patch {
45 jbig2dec = lib.getExe' jbig2dec "jbig2dec";
46 mutool = lib.getExe' mupdf-headless "mutool";
47 })
48 ];
49
50 postPatch = ''
51 substituteInPlace setup.py \
52 --replace-fail "shims_enabled = not cflags_defined" "shims_enabled = False"
53 '';
54
55 buildInputs = [ qpdf ];
56
57 build-system = [
58 pybind11
59 setuptools
60 ];
61
62 nativeCheckInputs = [
63 attrs
64 hypothesis
65 numpy
66 pytest-xdist
67 psutil
68 pytestCheckHook
69 python-dateutil
70 python-xmp-toolkit
71 ];
72
73 dependencies = [
74 deprecated
75 lxml
76 packaging
77 pillow
78 ];
79
80 pythonImportsCheck = [ "pikepdf" ];
81
82 meta = {
83 homepage = "https://github.com/pikepdf/pikepdf";
84 description = "Read and write PDFs with Python, powered by qpdf";
85 license = lib.licenses.mpl20;
86 maintainers = with lib.maintainers; [ dotlambda ];
87 changelog = "https://github.com/pikepdf/pikepdf/blob/${src.tag}/docs/releasenotes/version${lib.versions.major version}.md";
88 };
89}