summary refs log tree commit diff
path: root/pkgs/development/python-modules/img2pdf/default.nix
blob: 06183b3d53489cfb7c13032a6c2cd669692064d9 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{ lib
, buildPythonPackage
, isPy27
, fetchFromGitea
, substituteAll
, fetchpatch
, colord
, setuptools
, pikepdf
, pillow
, stdenv
, exiftool
, ghostscript
, imagemagick
, mupdf
, netpbm
, numpy
, poppler_utils
, pytestCheckHook
, scipy
}:

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

  pyproject = true;

  src = fetchFromGitea {
    domain = "gitlab.mister-muffin.de";
    owner = "josch";
    repo = "img2pdf";
    rev = version;
    hash = "sha256-k0GqBTS8PvYDmjzyLCSdQB7oBakrEQYJcQykDNrzgcA=";
  };

  patches = [
    (substituteAll {
      src = ./default-icc-profile.patch;
      inherit colord;
    })
    (fetchpatch {
      # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
      url = "https://salsa.debian.org/debian/img2pdf/-/raw/4a7dbda0f473f7c5ffcaaf68ea4ad3f435e0920d/debian/patches/fix_tests.patch";
      hash = "sha256-A1zK6yINhS+dvyckZjqoSO1XJRTaf4OXFdq5ufUrBs8=";
    })

  ];

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    pikepdf
    pillow
  ];

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

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

  disabledTests = [
    # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
    "test_miff_cmyk16"
  ];

  pythonImportsCheck = [ "img2pdf" ];

  meta = with lib; {
    changelog = "https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/${src.rev}/CHANGES.rst";
    description = "Convert images to PDF via direct JPEG inclusion";
    homepage = "https://gitlab.mister-muffin.de/josch/img2pdf";
    license = licenses.lgpl3Plus;
    mainProgram = "img2pdf";
    maintainers = with maintainers; [ veprbl dotlambda ];
  };
}