diff --git a/pkgs/development/python-modules/img2pdf/default-icc-profile.patch b/pkgs/development/python-modules/img2pdf/default-icc-profile.patch new file mode 100644 index 000000000000..bf5e1e408614 --- /dev/null +++ b/pkgs/development/python-modules/img2pdf/default-icc-profile.patch @@ -0,0 +1,20 @@ +diff --git a/src/img2pdf.py b/src/img2pdf.py +index 036232b..d2e7829 100755 +--- a/src/img2pdf.py ++++ b/src/img2pdf.py +@@ -3815,14 +3815,7 @@ def gui(): + + + def get_default_icc_profile(): +- for profile in [ +- "/usr/share/color/icc/sRGB.icc", +- "/usr/share/color/icc/OpenICC/sRGB.icc", +- "/usr/share/color/icc/colord/sRGB.icc", +- ]: +- if os.path.exists(profile): +- return profile +- return "/usr/share/color/icc/sRGB.icc" ++ return "@colord@/share/color/icc/colord/sRGB.icc" + + + def get_main_parser(): diff --git a/pkgs/development/python-modules/img2pdf/default.nix b/pkgs/development/python-modules/img2pdf/default.nix index 0450dee30b46..06183b3d5348 100644 --- a/pkgs/development/python-modules/img2pdf/default.nix +++ b/pkgs/development/python-modules/img2pdf/default.nix @@ -1,8 +1,11 @@ { lib , buildPythonPackage , isPy27 -, fetchPypi +, fetchFromGitea +, substituteAll , fetchpatch +, colord +, setuptools , pikepdf , pillow , stdenv @@ -19,20 +22,34 @@ buildPythonPackage rec { pname = "img2pdf"; - version = "0.4.4"; + version = "0.5.0"; disabled = isPy27; - src = fetchPypi { - inherit pname version; - sha256 = "8ec898a9646523fd3862b154f3f47cd52609c24cc3e2dc1fb5f0168f0cbe793c"; + pyproject = true; + + src = fetchFromGitea { + domain = "gitlab.mister-muffin.de"; + owner = "josch"; + repo = "img2pdf"; + rev = version; + hash = "sha256-k0GqBTS8PvYDmjzyLCSdQB7oBakrEQYJcQykDNrzgcA="; }; 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="; + (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 = [ @@ -40,9 +57,6 @@ buildPythonPackage rec { pillow ]; - # https://gitlab.mister-muffin.de/josch/img2pdf/issues/128 - doCheck = !stdenv.isAarch64; - nativeCheckInputs = [ exiftool ghostscript @@ -60,16 +74,18 @@ buildPythonPackage rec { ''; disabledTests = [ - "test_tiff_rgb" - "test_png_gray1" # https://gitlab.mister-muffin.de/josch/img2pdf/issues/154 + # 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.lgpl2; + license = licenses.lgpl3Plus; + mainProgram = "img2pdf"; maintainers = with maintainers; [ veprbl dotlambda ]; }; }