nixpkgs/pkgs/development/python-modules/ocrmypdf/default.nix
Robert Schütz 4c268ee2cc ocrmypdf: move to python3Packages
According to https://ocrmypdf.readthedocs.io/en/latest/api.html, it also
provides a Python API.
2021-09-18 14:15:36 -07:00

84 lines
1.7 KiB
Nix

{ lib
, buildPythonPackage
, cffi
, coloredlogs
, fetchFromGitHub
, ghostscript
, img2pdf
, importlib-resources
, jbig2enc
, leptonica
, pdfminer
, pikepdf
, pillow
, pluggy
, pngquant
, pytest-xdist
, pytestCheckHook
, reportlab
, setuptools
, setuptools-scm
, setuptools-scm-git-archive
, stdenv
, substituteAll
, tesseract4
, tqdm
, unpaper
}:
buildPythonPackage rec {
pname = "ocrmypdf";
version = "12.5.0";
src = fetchFromGitHub {
owner = "jbarlow83";
repo = "OCRmyPDF";
rev = "v${version}";
sha256 = "sha256-g80WedX+TGHE9EJ/RSgOc53PM17V3WZslUNaHoqKTo0=";
};
patches = [
(substituteAll {
src = ./paths.patch;
gs = "${lib.getBin ghostscript}/bin/gs";
jbig2 = "${lib.getBin jbig2enc}/bin/jbig2";
liblept = "${lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
pngquant = "${lib.getBin pngquant}/bin/pngquant";
tesseract = "${lib.getBin tesseract4}/bin/tesseract";
unpaper = "${lib.getBin unpaper}/bin/unpaper";
})
];
nativeBuildInputs = [
setuptools-scm-git-archive
setuptools-scm
];
propagatedBuildInputs = [
cffi
coloredlogs
img2pdf
importlib-resources
pdfminer
pikepdf
pillow
pluggy
reportlab
setuptools
tqdm
];
checkInputs = [
pytest-xdist
pytestCheckHook
];
meta = with lib; {
homepage = "https://github.com/jbarlow83/OCRmyPDF";
description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
license = with licenses; [ mpl20 mit ];
platforms = platforms.linux;
maintainers = with maintainers; [ kiwi dotlambda ];
changelog = "https://github.com/jbarlow83/OCRmyPDF/blob/v${version}/docs/release_notes.rst";
};
}