nixpkgs/pkgs/tools/text/ocrmypdf/default.nix
Ivan Kozik d56da56bf8 ocrmypdf: 10.3.0 -> 11.0.1
This fixes the build:

```
ERROR: Could not find a version that satisfies the requirement img2pdf<0.4,>=0.3.0 (from ocrmypdf==10.3.0) (from versions: none)
ERROR: No matching distribution found for img2pdf<0.4,>=0.3.0 (from ocrmypdf==10.3.0)
builder for '/nix/store/1ggj5wwl92xickc7w5hfl3zrjfscxnf1-ocrmypdf-10.3.0.drv' failed with exit code 1
error: build of '/nix/store/1ggj5wwl92xickc7w5hfl3zrjfscxnf1-ocrmypdf-10.3.0.drv' failed
```
2020-08-31 16:59:24 -07:00

91 lines
1.7 KiB
Nix

{ fetchFromGitHub
, ghostscript
, img2pdf
, jbig2enc
, leptonica
, pngquant
, python3
, python3Packages
, qpdf
, stdenv
, tesseract4
, unpaper
, substituteAll
}:
let
inherit (python3Packages) buildPythonApplication;
runtimeDeps = with python3Packages; [
ghostscript
jbig2enc
leptonica
pngquant
qpdf
tesseract4
unpaper
pillow
];
in
buildPythonApplication rec {
pname = "ocrmypdf";
version = "11.0.1";
disabled = ! python3Packages.isPy3k;
src = fetchFromGitHub {
owner = "jbarlow83";
repo = "OCRmyPDF";
rev = "v${version}";
sha256 = "194ds9i1zd80ynzwgv7kprax0crh7bbchayawdcvg2lyr64a82xn";
};
nativeBuildInputs = with python3Packages; [
pytestrunner
setuptools
setuptools-scm-git-archive
setuptools_scm
];
propagatedBuildInputs = with python3Packages; [
cffi
chardet
coloredlogs
img2pdf
pdfminer
pluggy
pikepdf
pillow
reportlab
setuptools
tqdm
];
checkInputs = with python3Packages; [
pypdf2
pytest
pytest-helpers-namespace
pytest_xdist
pytestcov
pytestrunner
python-xmp-toolkit
pytestCheckHook
] ++ runtimeDeps;
patches = [
(substituteAll {
src = ./liblept.patch;
liblept = "${stdenv.lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
})
];
makeWrapperArgs = [ "--prefix PATH : ${stdenv.lib.makeBinPath [ ghostscript jbig2enc pngquant qpdf tesseract4 unpaper ]}" ];
meta = with stdenv.lib; {
homepage = "https://github.com/jbarlow83/OCRmyPDF";
description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = [ maintainers.kiwi ];
};
}