2021-09-22 15:38:15 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2022-11-21 17:40:18 +00:00
|
|
|
, deprecation
|
2021-09-22 15:38:15 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, ghostscript
|
2023-05-24 13:37:59 +00:00
|
|
|
, hypothesis
|
2021-09-22 15:38:15 +00:00
|
|
|
, img2pdf
|
|
|
|
, importlib-resources
|
|
|
|
, jbig2enc
|
2022-11-21 17:40:18 +00:00
|
|
|
, packaging
|
2022-06-16 17:23:12 +00:00
|
|
|
, pdfminer-six
|
2021-09-22 15:38:15 +00:00
|
|
|
, pikepdf
|
|
|
|
, pillow
|
|
|
|
, pluggy
|
|
|
|
, pngquant
|
|
|
|
, pytest-xdist
|
|
|
|
, pytestCheckHook
|
2021-12-06 16:07:01 +00:00
|
|
|
, pythonOlder
|
2023-08-22 20:05:09 +00:00
|
|
|
, rich
|
2021-09-22 15:38:15 +00:00
|
|
|
, reportlab
|
2022-11-21 17:40:18 +00:00
|
|
|
, setuptools
|
2021-09-22 15:38:15 +00:00
|
|
|
, setuptools-scm
|
|
|
|
, substituteAll
|
2022-09-30 11:47:45 +00:00
|
|
|
, tesseract
|
2021-09-22 15:38:15 +00:00
|
|
|
, tqdm
|
2022-11-21 17:40:18 +00:00
|
|
|
, typing-extensions
|
2021-09-22 15:38:15 +00:00
|
|
|
, unpaper
|
2023-10-09 19:29:22 +00:00
|
|
|
, wheel
|
2022-06-16 17:23:12 +00:00
|
|
|
, installShellFiles
|
2021-09-22 15:38:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ocrmypdf";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "15.4.4";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
disabled = pythonOlder "3.9";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2021-09-22 15:38:15 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-06-16 17:23:12 +00:00
|
|
|
owner = "ocrmypdf";
|
2021-09-22 15:38:15 +00:00
|
|
|
repo = "OCRmyPDF";
|
|
|
|
rev = "v${version}";
|
2021-10-07 14:46:35 +00:00
|
|
|
# The content of .git_archival.txt is substituted upon tarball creation,
|
|
|
|
# which creates indeterminism if master no longer points to the tag.
|
2022-06-16 17:23:12 +00:00
|
|
|
# See https://github.com/ocrmypdf/OCRmyPDF/issues/841
|
|
|
|
postFetch = ''
|
2021-10-07 14:46:35 +00:00
|
|
|
rm "$out/.git_archival.txt"
|
|
|
|
'';
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-Ff0OrSJFglVPpSNB0KvDMnatj+P57zWdcVAFaM+Sg0s=";
|
2021-09-22 15:38:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./paths.patch;
|
2023-10-09 19:29:22 +00:00
|
|
|
gs = lib.getExe ghostscript;
|
|
|
|
jbig2 = lib.getExe jbig2enc;
|
|
|
|
pngquant = lib.getExe pngquant;
|
|
|
|
tesseract = lib.getExe tesseract;
|
|
|
|
unpaper = lib.getExe unpaper;
|
2021-09-22 15:38:15 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
setuptools
|
2021-09-22 15:38:15 +00:00
|
|
|
setuptools-scm
|
2023-10-09 19:29:22 +00:00
|
|
|
wheel
|
2022-06-16 17:23:12 +00:00
|
|
|
installShellFiles
|
2021-09-22 15:38:15 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
deprecation
|
2021-09-22 15:38:15 +00:00
|
|
|
img2pdf
|
2022-11-21 17:40:18 +00:00
|
|
|
packaging
|
2022-06-16 17:23:12 +00:00
|
|
|
pdfminer-six
|
2021-09-22 15:38:15 +00:00
|
|
|
pikepdf
|
|
|
|
pillow
|
|
|
|
pluggy
|
|
|
|
reportlab
|
2023-08-22 20:05:09 +00:00
|
|
|
rich
|
2022-11-21 17:40:18 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.10") [
|
|
|
|
typing-extensions
|
|
|
|
];
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
hypothesis
|
2021-09-22 15:38:15 +00:00
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-10-04 12:37:57 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"ocrmypdf"
|
|
|
|
];
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
postInstall = ''
|
|
|
|
installShellCompletion --cmd ocrmypdf \
|
|
|
|
--bash misc/completion/ocrmypdf.bash \
|
|
|
|
--fish misc/completion/ocrmypdf.fish
|
|
|
|
'';
|
|
|
|
|
2021-09-22 15:38:15 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "https://github.com/ocrmypdf/OCRmyPDF";
|
2021-09-22 15:38:15 +00:00
|
|
|
description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched";
|
|
|
|
license = with licenses; [ mpl20 mit ];
|
|
|
|
maintainers = with maintainers; [ kiwi dotlambda ];
|
2022-06-16 17:23:12 +00:00
|
|
|
changelog = "https://github.com/ocrmypdf/OCRmyPDF/blob/${src.rev}/docs/release_notes.rst";
|
2024-01-13 08:15:51 +00:00
|
|
|
mainProgram = "ocrmypdf";
|
2021-09-22 15:38:15 +00:00
|
|
|
};
|
|
|
|
}
|