1{ lib
2, buildPythonPackage
3, isPy27
4, fetchPypi
5, fetchpatch
6, pikepdf
7, pillow
8, stdenv
9, exiftool
10, ghostscript
11, imagemagick
12, mupdf
13, netpbm
14, numpy
15, poppler_utils
16, pytestCheckHook
17, scipy
18}:
19
20buildPythonPackage rec {
21 pname = "img2pdf";
22 version = "0.4.4";
23 disabled = isPy27;
24
25 src = fetchPypi {
26 inherit pname version;
27 sha256 = "8ec898a9646523fd3862b154f3f47cd52609c24cc3e2dc1fb5f0168f0cbe793c";
28 };
29
30 patches = [
31 (fetchpatch {
32 # https://gitlab.mister-muffin.de/josch/img2pdf/issues/148
33 url = "https://gitlab.mister-muffin.de/josch/img2pdf/commit/57d7e07e6badb252c12015388b58fcb5285d3158.patch";
34 hash = "sha256-H/g55spe/oVJRxO2Vh+F+ZgR6aLoRUrNeu5WnuU7k/k=";
35 })
36 ];
37
38 propagatedBuildInputs = [
39 pikepdf
40 pillow
41 ];
42
43 # https://gitlab.mister-muffin.de/josch/img2pdf/issues/128
44 doCheck = !stdenv.isAarch64;
45
46 checkInputs = [
47 exiftool
48 ghostscript
49 imagemagick
50 mupdf
51 netpbm
52 numpy
53 poppler_utils
54 pytestCheckHook
55 scipy
56 ];
57
58 preCheck = ''
59 export img2pdfprog="$out/bin/img2pdf"
60 '';
61
62 disabledTests = [
63 "test_tiff_rgb"
64 ];
65
66 pythonImportsCheck = [ "img2pdf" ];
67
68 meta = with lib; {
69 description = "Convert images to PDF via direct JPEG inclusion";
70 homepage = "https://gitlab.mister-muffin.de/josch/img2pdf";
71 license = licenses.lgpl2;
72 maintainers = with maintainers; [ veprbl dotlambda ];
73 };
74}