2020-04-24 23:36:52 +00:00
|
|
|
{ fetchFromGitHub
|
|
|
|
, ghostscript
|
|
|
|
, img2pdf
|
|
|
|
, jbig2enc
|
|
|
|
, leptonica
|
|
|
|
, pngquant
|
|
|
|
, python3
|
|
|
|
, python3Packages
|
|
|
|
, qpdf
|
2021-02-13 14:23:35 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, tesseract4
|
|
|
|
, unpaper
|
|
|
|
, substituteAll
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
inherit (python3Packages) buildPythonApplication;
|
|
|
|
|
|
|
|
runtimeDeps = with python3Packages; [
|
|
|
|
ghostscript
|
|
|
|
jbig2enc
|
|
|
|
leptonica
|
|
|
|
pngquant
|
|
|
|
qpdf
|
|
|
|
tesseract4
|
|
|
|
unpaper
|
|
|
|
pillow
|
|
|
|
];
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
in
|
|
|
|
buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "ocrmypdf";
|
2021-07-24 12:14:16 +00:00
|
|
|
version = "12.3.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jbarlow83";
|
|
|
|
repo = "OCRmyPDF";
|
|
|
|
rev = "v${version}";
|
2021-07-24 12:14:16 +00:00
|
|
|
sha256 = "122yv3p0v4fbx30zgppcznwnm7svg97gv0sa103xb6zcld68ggn2";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
|
|
setuptools
|
|
|
|
setuptools-scm-git-archive
|
2021-06-04 09:07:49 +00:00
|
|
|
setuptools-scm
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [
|
|
|
|
cffi
|
|
|
|
chardet
|
2020-07-18 16:06:22 +00:00
|
|
|
coloredlogs
|
2020-04-24 23:36:52 +00:00
|
|
|
img2pdf
|
|
|
|
pdfminer
|
2020-07-18 16:06:22 +00:00
|
|
|
pluggy
|
2020-04-24 23:36:52 +00:00
|
|
|
pikepdf
|
|
|
|
pillow
|
|
|
|
reportlab
|
|
|
|
setuptools
|
|
|
|
tqdm
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = with python3Packages; [
|
|
|
|
pypdf2
|
|
|
|
pytest
|
|
|
|
pytest-helpers-namespace
|
2021-07-24 12:14:16 +00:00
|
|
|
pytest-xdist
|
2021-02-13 14:23:35 +00:00
|
|
|
pytest-cov
|
2020-04-24 23:36:52 +00:00
|
|
|
python-xmp-toolkit
|
2020-07-18 16:06:22 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ runtimeDeps;
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./liblept.patch;
|
2021-01-15 22:18:51 +00:00
|
|
|
liblept = "${lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ghostscript jbig2enc pngquant qpdf tesseract4 unpaper ]}" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/jbarlow83/OCRmyPDF";
|
|
|
|
description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
|
2021-02-13 14:23:35 +00:00
|
|
|
license = with licenses; [ mpl20 mit ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.kiwi ];
|
2021-04-15 00:37:46 +00:00
|
|
|
changelog = "https://github.com/jbarlow83/OCRmyPDF/blob/v${version}/docs/release_notes.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|