2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
deprecation,
|
|
|
|
fetchFromGitHub,
|
|
|
|
ghostscript,
|
2024-09-19 14:19:46 +00:00
|
|
|
hatch-vcs,
|
|
|
|
hatchling,
|
2024-06-05 15:53:02 +00:00
|
|
|
hypothesis,
|
|
|
|
img2pdf,
|
|
|
|
jbig2enc,
|
|
|
|
packaging,
|
|
|
|
pdfminer-six,
|
|
|
|
pillow-heif,
|
|
|
|
pikepdf,
|
|
|
|
pillow,
|
|
|
|
pluggy,
|
|
|
|
pngquant,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
rich,
|
|
|
|
reportlab,
|
|
|
|
substituteAll,
|
|
|
|
tesseract,
|
|
|
|
unpaper,
|
|
|
|
installShellFiles,
|
2021-09-22 15:38:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "ocrmypdf";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "16.5.0";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
disabled = pythonOlder "3.10";
|
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-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-jqe4BRW0U7gqcf+FtDWjDDvRStAqaEPTuU+B+BrFR5Y=";
|
2021-09-22 15:38:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2024-05-15 15:35:15 +00:00
|
|
|
./use-pillow-heif.patch
|
2021-09-22 15:38:15 +00:00
|
|
|
(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
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
build-system = [
|
|
|
|
hatch-vcs
|
|
|
|
hatchling
|
|
|
|
];
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
2021-09-22 15:38:15 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
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
|
2024-05-15 15:35:15 +00:00
|
|
|
pillow-heif
|
2021-09-22 15:38:15 +00:00
|
|
|
pikepdf
|
|
|
|
pillow
|
|
|
|
pluggy
|
2023-08-22 20:05:09 +00:00
|
|
|
rich
|
2022-11-21 17:40:18 +00:00
|
|
|
];
|
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
|
2024-05-15 15:35:15 +00:00
|
|
|
reportlab
|
2021-09-22 15:38:15 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "ocrmypdf" ];
|
2021-10-04 12:37:57 +00:00
|
|
|
|
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";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = with licenses; [
|
|
|
|
mpl20
|
|
|
|
mit
|
|
|
|
];
|
|
|
|
maintainers = with maintainers; [
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|