2019-03-14 03:13:25 +00:00
|
|
|
{ fetchFromGitHub
|
|
|
|
, ghostscript
|
|
|
|
, img2pdf
|
|
|
|
, jbig2enc
|
|
|
|
, leptonica
|
|
|
|
, pngquant
|
|
|
|
, python3
|
|
|
|
, python3Packages
|
|
|
|
, qpdf
|
2021-02-08 15:52:01 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2019-03-14 03:13:25 +00:00
|
|
|
, tesseract4
|
|
|
|
, unpaper
|
2020-01-22 00:14:49 +00:00
|
|
|
, substituteAll
|
2019-03-14 03:13:25 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
inherit (python3Packages) buildPythonApplication;
|
|
|
|
|
|
|
|
runtimeDeps = with python3Packages; [
|
|
|
|
ghostscript
|
|
|
|
jbig2enc
|
|
|
|
leptonica
|
|
|
|
pngquant
|
|
|
|
qpdf
|
|
|
|
tesseract4
|
|
|
|
unpaper
|
|
|
|
pillow
|
|
|
|
];
|
|
|
|
|
2020-06-07 01:17:28 +01:00
|
|
|
in
|
|
|
|
buildPythonApplication rec {
|
2019-03-14 03:13:25 +00:00
|
|
|
pname = "ocrmypdf";
|
2021-02-08 15:52:01 +00:00
|
|
|
version = "11.6.0";
|
2019-03-14 03:13:25 +00:00
|
|
|
disabled = ! python3Packages.isPy3k;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jbarlow83";
|
|
|
|
repo = "OCRmyPDF";
|
|
|
|
rev = "v${version}";
|
2021-02-08 15:52:01 +00:00
|
|
|
sha256 = "0inmmpam0vcm5n4sm6lh9p5swk44clknvm1cdwk9cax01mdqljza";
|
2019-03-14 03:13:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
|
|
setuptools
|
|
|
|
setuptools-scm-git-archive
|
|
|
|
setuptools_scm
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = with python3Packages; [
|
|
|
|
cffi
|
|
|
|
chardet
|
2020-07-09 13:39:31 +01:00
|
|
|
coloredlogs
|
2019-03-14 03:13:25 +00:00
|
|
|
img2pdf
|
|
|
|
pdfminer
|
2020-07-09 13:39:31 +01:00
|
|
|
pluggy
|
2019-03-14 03:13:25 +00:00
|
|
|
pikepdf
|
2019-09-13 19:16:51 +01:00
|
|
|
pillow
|
2019-03-14 03:13:25 +00:00
|
|
|
reportlab
|
2019-09-13 19:16:51 +01:00
|
|
|
setuptools
|
|
|
|
tqdm
|
2019-03-14 03:13:25 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = with python3Packages; [
|
|
|
|
pypdf2
|
|
|
|
pytest
|
|
|
|
pytest-helpers-namespace
|
|
|
|
pytest_xdist
|
2021-02-08 15:52:01 +00:00
|
|
|
pytest-cov
|
2019-03-14 03:13:25 +00:00
|
|
|
python-xmp-toolkit
|
2020-07-09 13:39:31 +01:00
|
|
|
pytestCheckHook
|
2019-03-14 03:13:25 +00:00
|
|
|
] ++ runtimeDeps;
|
|
|
|
|
2020-01-22 00:14:49 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./liblept.patch;
|
2021-01-15 09:19:50 +00:00
|
|
|
liblept = "${lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
|
2020-01-22 00:14:49 +00:00
|
|
|
})
|
|
|
|
];
|
2019-03-14 03:13:25 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ghostscript jbig2enc pngquant qpdf tesseract4 unpaper ]}" ];
|
2019-09-13 19:16:51 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-03-14 03:13:25 +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-08 15:52:01 +00:00
|
|
|
license = with licenses; [ mpl20 mit ];
|
2019-03-14 03:13:25 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = [ maintainers.kiwi ];
|
|
|
|
};
|
|
|
|
}
|