Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / img2pdf / default.nix
bloba94681ada0f149e1c7c7980665c9405481d15910
1 { lib
2 , buildPythonPackage
3 , isPy27
4 , fetchFromGitea
5 , substituteAll
6 , fetchpatch
7 , colord
8 , setuptools
9 , pikepdf
10 , pillow
11 , stdenv
12 , exiftool
13 , ghostscript
14 , imagemagick
15 , mupdf
16 , netpbm
17 , numpy
18 , poppler_utils
19 , pytestCheckHook
20 , scipy
23 buildPythonPackage rec {
24   pname = "img2pdf";
25   version = "0.5.0";
26   disabled = isPy27;
28   pyproject = true;
30   src = fetchFromGitea {
31     domain = "gitlab.mister-muffin.de";
32     owner = "josch";
33     repo = "img2pdf";
34     rev = version;
35     hash = "sha256-k0GqBTS8PvYDmjzyLCSdQB7oBakrEQYJcQykDNrzgcA=";
36   };
38   patches = [
39     (substituteAll {
40       src = ./default-icc-profile.patch;
41       srgbProfile = if stdenv.isDarwin then
42         "/System/Library/ColorSync/Profiles/sRGB Profile.icc"
43       else
44         "${colord}/share/color/icc/colord/sRGB.icc";
45     })
46     (fetchpatch {
47       # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
48       url = "https://salsa.debian.org/debian/img2pdf/-/raw/4a7dbda0f473f7c5ffcaaf68ea4ad3f435e0920d/debian/patches/fix_tests.patch";
49       hash = "sha256-A1zK6yINhS+dvyckZjqoSO1XJRTaf4OXFdq5ufUrBs8=";
50     })
52   ];
54   nativeBuildInputs = [
55     setuptools
56   ];
58   propagatedBuildInputs = [
59     pikepdf
60     pillow
61   ];
63   # FIXME: Only add "sRGB Profile.icc" to __impureHostDeps once
64   # https://github.com/NixOS/nix/issues/9301 is fixed.
65   __impureHostDeps = lib.optionals stdenv.isDarwin [
66     "/System/Library/ColorSync/Profiles"
67   ];
69   nativeCheckInputs = [
70     exiftool
71     ghostscript
72     imagemagick
73     mupdf
74     netpbm
75     numpy
76     poppler_utils
77     pytestCheckHook
78     scipy
79   ];
81   preCheck = ''
82     export img2pdfprog="$out/bin/img2pdf"
83   '';
85   disabledTests = [
86     # https://gitlab.mister-muffin.de/josch/img2pdf/issues/178
87     "test_miff_cmyk16"
88   ];
90   pythonImportsCheck = [ "img2pdf" ];
92   meta = with lib; {
93     changelog = "https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/${src.rev}/CHANGES.rst";
94     description = "Convert images to PDF via direct JPEG inclusion";
95     homepage = "https://gitlab.mister-muffin.de/josch/img2pdf";
96     license = licenses.lgpl3Plus;
97     mainProgram = "img2pdf";
98     maintainers = with maintainers; [ veprbl dotlambda ];
99   };