summary refs log tree commit diff
path: root/pkgs/development/python-modules/ocrmypdf/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/ocrmypdf/default.nix')
-rw-r--r--pkgs/development/python-modules/ocrmypdf/default.nix39
1 files changed, 23 insertions, 16 deletions
diff --git a/pkgs/development/python-modules/ocrmypdf/default.nix b/pkgs/development/python-modules/ocrmypdf/default.nix
index 6700b88479d..c2f7f1c9df1 100644
--- a/pkgs/development/python-modules/ocrmypdf/default.nix
+++ b/pkgs/development/python-modules/ocrmypdf/default.nix
@@ -2,12 +2,13 @@
 , buildPythonPackage
 , coloredlogs
 , fetchFromGitHub
+, fetchpatch
 , ghostscript
 , img2pdf
 , importlib-metadata
 , importlib-resources
 , jbig2enc
-, pdfminer
+, pdfminer-six
 , pikepdf
 , pillow
 , pluggy
@@ -18,28 +19,28 @@
 , reportlab
 , setuptools-scm
 , setuptools-scm-git-archive
-, stdenv
 , substituteAll
 , tesseract4
 , tqdm
 , unpaper
+, installShellFiles
 }:
 
 buildPythonPackage rec {
   pname = "ocrmypdf";
-  version = "13.4.3";
+  version = "13.4.6";
 
   src = fetchFromGitHub {
-    owner = "jbarlow83";
+    owner = "ocrmypdf";
     repo = "OCRmyPDF";
     rev = "v${version}";
     # The content of .git_archival.txt is substituted upon tarball creation,
     # which creates indeterminism if master no longer points to the tag.
-    # See https://github.com/jbarlow83/OCRmyPDF/issues/841
-    extraPostFetch = ''
+    # See https://github.com/ocrmypdf/OCRmyPDF/issues/841
+    postFetch = ''
       rm "$out/.git_archival.txt"
     '';
-    hash = "sha256-kriT3NV9Lj44WjOeK6+pILjfRMt9QMcKU57si394xxI=";
+    hash = "sha256-Hd9vsw+UEpE7juYSCiHhXtxaC58OtS/Uy20Jdp6QXPA=";
   };
 
   SETUPTOOLS_SCM_PRETEND_VERSION = version;
@@ -53,17 +54,23 @@ buildPythonPackage rec {
       tesseract = "${lib.getBin tesseract4}/bin/tesseract";
       unpaper = "${lib.getBin unpaper}/bin/unpaper";
     })
+    # https://github.com/ocrmypdf/OCRmyPDF/pull/973
+    (fetchpatch {
+      url = "https://github.com/ocrmypdf/OCRmyPDF/commit/808b24d59f5b541a335006aa6ea7cdc3c991adc0.patch";
+      hash = "sha256-khsH70fWk5fStf94wcRKKX7cCbgD69LtKkngJIqA3+w=";
+    })
   ];
 
   nativeBuildInputs = [
     setuptools-scm-git-archive
     setuptools-scm
+    installShellFiles
   ];
 
   propagatedBuildInputs = [
     coloredlogs
     img2pdf
-    pdfminer
+    pdfminer-six
     pikepdf
     pillow
     pluggy
@@ -80,21 +87,21 @@ buildPythonPackage rec {
     pytestCheckHook
   ];
 
-  postPatch = ''
-    # https://github.com/ocrmypdf/OCRmyPDF/issues/933
-    substituteInPlace setup.cfg \
-      --replace "pdfminer.six!=20200720,>=20191110,<=20220319" "pdfminer.six!=20200720,>=20191110"
-  '';
-
   pythonImportsCheck = [
     "ocrmypdf"
   ];
 
+  postInstall = ''
+    installShellCompletion --cmd ocrmypdf \
+      --bash misc/completion/ocrmypdf.bash \
+      --fish misc/completion/ocrmypdf.fish
+  '';
+
   meta = with lib; {
-    homepage = "https://github.com/jbarlow83/OCRmyPDF";
+    homepage = "https://github.com/ocrmypdf/OCRmyPDF";
     description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
     license = with licenses; [ mpl20 mit ];
     maintainers = with maintainers; [ kiwi dotlambda ];
-    changelog = "https://github.com/jbarlow83/OCRmyPDF/blob/v${version}/docs/release_notes.rst";
+    changelog = "https://github.com/ocrmypdf/OCRmyPDF/blob/${src.rev}/docs/release_notes.rst";
   };
 }