2020-04-24 23:36:52 +00:00
|
|
|
{ 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
|
|
|
|
];
|
|
|
|
|
2020-06-18 07:06:33 +00:00
|
|
|
in
|
|
|
|
buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "ocrmypdf";
|
2020-09-25 04:45:31 +00:00
|
|
|
version = "11.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = ! python3Packages.isPy3k;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jbarlow83";
|
|
|
|
repo = "OCRmyPDF";
|
|
|
|
rev = "v${version}";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "194ds9i1zd80ynzwgv7kprax0crh7bbchayawdcvg2lyr64a82xn";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = with python3Packages; [
|
|
|
|
pytestrunner
|
|
|
|
setuptools
|
|
|
|
setuptools-scm-git-archive
|
|
|
|
setuptools_scm
|
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
pytest_xdist
|
|
|
|
pytestcov
|
|
|
|
pytestrunner
|
|
|
|
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;
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|