nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 113 lines 2.2 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 deprecation, 5 fetchFromGitHub, 6 fpdf2, 7 ghostscript_headless, 8 hatch-vcs, 9 hatchling, 10 hypothesis, 11 img2pdf, 12 jbig2enc, 13 packaging, 14 pdfminer-six, 15 pillow-heif, 16 pikepdf, 17 pillow, 18 pluggy, 19 pngquant, 20 pydantic, 21 pypdfium2, 22 pytest-xdist, 23 pytestCheckHook, 24 rich, 25 reportlab, 26 replaceVars, 27 tesseract, 28 uharfbuzz, 29 unpaper, 30 installShellFiles, 31}: 32 33buildPythonPackage rec { 34 pname = "ocrmypdf"; 35 version = "17.3.0"; 36 pyproject = true; 37 38 src = fetchFromGitHub { 39 owner = "ocrmypdf"; 40 repo = "OCRmyPDF"; 41 tag = "v${version}"; 42 # The content of .git_archival.txt is substituted upon tarball creation, 43 # which creates indeterminism if master no longer points to the tag. 44 # See https://github.com/ocrmypdf/OCRmyPDF/issues/841 45 postFetch = '' 46 rm "$out/.git_archival.txt" 47 ''; 48 hash = "sha256-/R/W8TMBaFBTjPiOIroZ1CNQAKMTLJH+cQvY2177e0U="; 49 }; 50 51 patches = [ 52 ./use-pillow-heif.patch 53 (replaceVars ./paths.patch { 54 gs = lib.getExe ghostscript_headless; 55 jbig2 = lib.getExe jbig2enc; 56 pngquant = lib.getExe pngquant; 57 tesseract = lib.getExe tesseract; 58 unpaper = lib.getExe unpaper; 59 }) 60 ]; 61 62 build-system = [ 63 hatch-vcs 64 hatchling 65 ]; 66 67 nativeBuildInputs = [ installShellFiles ]; 68 69 dependencies = [ 70 deprecation 71 fpdf2 72 img2pdf 73 packaging 74 pdfminer-six 75 pillow-heif 76 pikepdf 77 pillow 78 pluggy 79 pydantic 80 pypdfium2 81 rich 82 uharfbuzz 83 ]; 84 85 nativeCheckInputs = [ 86 hypothesis 87 pytest-xdist 88 pytestCheckHook 89 reportlab 90 ]; 91 92 pythonImportsCheck = [ "ocrmypdf" ]; 93 94 postInstall = '' 95 installShellCompletion --cmd ocrmypdf \ 96 --bash misc/completion/ocrmypdf.bash \ 97 --fish misc/completion/ocrmypdf.fish 98 ''; 99 100 meta = { 101 homepage = "https://github.com/ocrmypdf/OCRmyPDF"; 102 description = "Adds an OCR text layer to scanned PDF files, allowing them to be searched"; 103 license = with lib.licenses; [ 104 mpl20 105 mit 106 ]; 107 maintainers = with lib.maintainers; [ 108 dotlambda 109 ]; 110 changelog = "https://github.com/ocrmypdf/OCRmyPDF/blob/${src.tag}/docs/release_notes.md"; 111 mainProgram = "ocrmypdf"; 112 }; 113}