about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pyocr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pyocr/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pyocr/default.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pyocr/default.nix b/nixpkgs/pkgs/development/python-modules/pyocr/default.nix
index 407166e98c90..0d87538a1ce4 100644
--- a/nixpkgs/pkgs/development/python-modules/pyocr/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/pyocr/default.nix
@@ -1,4 +1,5 @@
 { lib
+, stdenv
 , fetchFromGitLab
 , buildPythonPackage
 , pillow
@@ -9,6 +10,8 @@
 , pytestCheckHook
 , setuptools
 , setuptools-scm
+, withTesseractSupport ? true
+, withCuneiformSupport ? stdenv.hostPlatform.isLinux
 }:
 
 buildPythonPackage rec {
@@ -27,12 +30,14 @@ buildPythonPackage rec {
     hash = "sha256-gE0+qbHCwpDdxXFY+4rjVU2FbUSfSVrvrVMcWUk+9FU=";
   };
 
-  patches = [
-    (substituteAll {
-      src = ./paths.patch;
-      inherit cuneiform tesseract;
-    })
-  ];
+  patches = [] ++ (lib.optional withTesseractSupport (substituteAll {
+      src = ./paths-tesseract.patch;
+      inherit tesseract;
+      tesseractLibraryLocation = "${tesseract}/lib/libtesseract${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })) ++ (lib.optional stdenv.hostPlatform.isLinux (substituteAll {
+      src = ./paths-cuneiform.patch;
+      inherit cuneiform;
+    }));
 
   propagatedBuildInputs = [ pillow ];
 
@@ -45,6 +50,6 @@ buildPythonPackage rec {
     changelog = "https://gitlab.gnome.org/World/OpenPaperwork/pyocr/-/blob/${version}/ChangeLog";
     description = "A Python wrapper for Tesseract and Cuneiform";
     license = licenses.gpl3Plus;
-    maintainers = with maintainers; [ symphorien ];
+    maintainers = with maintainers; [ symphorien tomodachi94 ];
   };
 }