summary refs log tree commit diff
path: root/pkgs/development/python-modules/img2pdf/default.nix
blob: 0450dee30b464b79a2dcb604589c1cb9a808d0ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ lib
, buildPythonPackage
, isPy27
, fetchPypi
, fetchpatch
, pikepdf
, pillow
, stdenv
, exiftool
, ghostscript
, imagemagick
, mupdf
, netpbm
, numpy
, poppler_utils
, pytestCheckHook
, scipy
}:

buildPythonPackage rec {
  pname = "img2pdf";
  version = "0.4.4";
  disabled = isPy27;

  src = fetchPypi {
    inherit pname version;
    sha256 = "8ec898a9646523fd3862b154f3f47cd52609c24cc3e2dc1fb5f0168f0cbe793c";
  };

  patches = [
    (fetchpatch {
      # https://gitlab.mister-muffin.de/josch/img2pdf/issues/148
      url = "https://gitlab.mister-muffin.de/josch/img2pdf/commit/57d7e07e6badb252c12015388b58fcb5285d3158.patch";
      hash = "sha256-H/g55spe/oVJRxO2Vh+F+ZgR6aLoRUrNeu5WnuU7k/k=";
    })
  ];

  propagatedBuildInputs = [
    pikepdf
    pillow
  ];

  # https://gitlab.mister-muffin.de/josch/img2pdf/issues/128
  doCheck = !stdenv.isAarch64;

  nativeCheckInputs = [
    exiftool
    ghostscript
    imagemagick
    mupdf
    netpbm
    numpy
    poppler_utils
    pytestCheckHook
    scipy
  ];

  preCheck = ''
    export img2pdfprog="$out/bin/img2pdf"
  '';

  disabledTests = [
    "test_tiff_rgb"
    "test_png_gray1"  # https://gitlab.mister-muffin.de/josch/img2pdf/issues/154
  ];

  pythonImportsCheck = [ "img2pdf" ];

  meta = with lib; {
    description = "Convert images to PDF via direct JPEG inclusion";
    homepage = "https://gitlab.mister-muffin.de/josch/img2pdf";
    license = licenses.lgpl2;
    maintainers = with maintainers; [ veprbl dotlambda ];
  };
}