nixpkgs/pkgs/development/python-modules/ocrmypdf/default.nix

85 lines
1.7 KiB
Nix
Raw Normal View History

{ lib
, buildPythonPackage
, cffi
, coloredlogs
, fetchFromGitHub
2019-03-14 04:13:25 +01:00
, ghostscript
, img2pdf
, importlib-resources
2019-03-14 04:13:25 +01:00
, jbig2enc
, leptonica
, pdfminer
, pikepdf
, pillow
, pluggy
2019-03-14 04:13:25 +01:00
, pngquant
, pytest-xdist
, pytestCheckHook
, reportlab
, setuptools
, setuptools-scm
, setuptools-scm-git-archive
2021-02-08 16:52:01 +01:00
, stdenv
, substituteAll
2019-03-14 04:13:25 +01:00
, tesseract4
, tqdm
2019-03-14 04:13:25 +01:00
, unpaper
}:
buildPythonPackage rec {
2019-03-14 04:13:25 +01:00
pname = "ocrmypdf";
version = "12.5.0";
2019-03-14 04:13:25 +01:00
src = fetchFromGitHub {
owner = "jbarlow83";
repo = "OCRmyPDF";
rev = "v${version}";
sha256 = "sha256-g80WedX+TGHE9EJ/RSgOc53PM17V3WZslUNaHoqKTo0=";
2019-03-14 04:13:25 +01:00
};
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 = [
2019-03-14 04:13:25 +01:00
setuptools-scm-git-archive
setuptools-scm
2019-03-14 04:13:25 +01:00
];
propagatedBuildInputs = [
2019-03-14 04:13:25 +01:00
cffi
2020-07-09 14:39:31 +02:00
coloredlogs
2019-03-14 04:13:25 +01:00
img2pdf
importlib-resources
2019-03-14 04:13:25 +01:00
pdfminer
pikepdf
pillow
pluggy
2019-03-14 04:13:25 +01:00
reportlab
setuptools
tqdm
2019-03-14 04:13:25 +01:00
];
checkInputs = [
pytest-xdist
2020-07-09 14:39:31 +02:00
pytestCheckHook
2020-01-22 01:14:49 +01:00
];
2019-03-14 04:13:25 +01:00
meta = with lib; {
2019-03-14 04:13:25 +01: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 16:52:01 +01:00
license = with licenses; [ mpl20 mit ];
2019-03-14 04:13:25 +01:00
platforms = platforms.linux;
maintainers = with maintainers; [ kiwi dotlambda ];
changelog = "https://github.com/jbarlow83/OCRmyPDF/blob/v${version}/docs/release_notes.rst";
2019-03-14 04:13:25 +01:00
};
}