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