about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2023-10-29 00:13:21 -0700
committerRobert Schütz <nix@dotlambda.de>2023-10-29 22:45:17 -0700
commit79cb565399168fa1136efa80579cecbcf2e5c5d8 (patch)
tree8cdc2905d1182dc527b1ed98d9f4be39c314f179
parent63678e9f3d3afecfeafa0acead6239cdb447574c (diff)
python311Packages.img2pdf: 0.4.4 -> 0.5.0
Changelog: https://gitlab.mister-muffin.de/josch/img2pdf/src/tag/0.5.0/CHANGES.rst
-rw-r--r--pkgs/development/python-modules/img2pdf/default-icc-profile.patch20
-rw-r--r--pkgs/development/python-modules/img2pdf/default.nix44
2 files changed, 50 insertions, 14 deletions
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 0000000000000..bf5e1e408614d
--- /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 0450dee30b464..06183b3d53489 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 = [
+    (substituteAll {
+      src = ./default-icc-profile.patch;
+      inherit colord;
+    })
     (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=";
+      # 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 ];
   };
 }