Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at lanzaboote 119 lines 4.2 kB view raw
1diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py 2index e28d23e9..183cd918 100644 3--- a/src/ocrmypdf/_exec/ghostscript.py 4+++ b/src/ocrmypdf/_exec/ghostscript.py 5@@ -67,7 +67,7 @@ log.addFilter(DuplicateFilter(log)) 6 7 8 # Ghostscript executable - gswin32c is not supported 9-GS = 'gswin64c' if os.name == 'nt' else 'gs' 10+GS = '@gs@' 11 12 13 def version() -> Version: 14diff --git a/src/ocrmypdf/_exec/jbig2enc.py b/src/ocrmypdf/_exec/jbig2enc.py 15index 28d3dd1c..477a7d6c 100644 16--- a/src/ocrmypdf/_exec/jbig2enc.py 17+++ b/src/ocrmypdf/_exec/jbig2enc.py 18@@ -14,7 +14,7 @@ from ocrmypdf.subprocess import get_version, run 19 20 21 def version() -> Version: 22- return Version(get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*')) 23+ return Version(get_version('@jbig2@', regex=r'jbig2enc (\d+(\.\d+)*).*')) 24 25 26 def available(): 27@@ -27,7 +27,7 @@ def available(): 28 29 def convert_group(*, cwd, infiles, out_prefix, threshold): 30 args = [ 31- 'jbig2', 32+ '@jbig2@', 33 '-b', 34 out_prefix, 35 '--symbol-mode', # symbol mode (lossy) 36@@ -50,7 +50,7 @@ def convert_group_mp(args): 37 38 39 def convert_single(*, cwd, infile, outfile, threshold): 40- args = ['jbig2', '--pdf', '-t', str(threshold), infile] 41+ args = ['@jbig2@', '--pdf', '-t', str(threshold), infile] 42 with open(outfile, 'wb') as fstdout: 43 proc = run(args, cwd=cwd, stdout=fstdout, stderr=PIPE) 44 proc.check_returncode() 45diff --git a/src/ocrmypdf/_exec/pngquant.py b/src/ocrmypdf/_exec/pngquant.py 46index 8425caec..a027f041 100644 47--- a/src/ocrmypdf/_exec/pngquant.py 48+++ b/src/ocrmypdf/_exec/pngquant.py 49@@ -18,7 +18,7 @@ from ocrmypdf.subprocess import get_version, run 50 51 52 def version() -> Version: 53- return Version(get_version('pngquant', regex=r'(\d+(\.\d+)*).*')) 54+ return Version(get_version('@pngquant@', regex=r'(\d+(\.\d+)*).*')) 55 56 57 def available(): 58@@ -45,7 +45,7 @@ def input_as_png(input_file: Path): 59 def quantize(input_file: Path, output_file: Path, quality_min: int, quality_max: int): 60 with input_as_png(input_file) as input_stream: 61 args = [ 62- 'pngquant', 63+ '@pngquant@', 64 '--force', 65 '--skip-if-larger', 66 '--quality', 67diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py 68index 4eac3470..61315d14 100644 69--- a/src/ocrmypdf/_exec/tesseract.py 70+++ b/src/ocrmypdf/_exec/tesseract.py 71@@ -114,7 +114,7 @@ class TesseractVersion(Version): 72 73 74 def version() -> Version: 75- return TesseractVersion(get_version('tesseract', regex=r'tesseract\s(.+)')) 76+ return TesseractVersion(get_version('@tesseract@', regex=r'tesseract\s(.+)')) 77 78 79 def has_thresholding() -> bool: 80@@ -132,7 +132,7 @@ def get_languages() -> set[str]: 81 msg += output 82 return msg 83 84- args_tess = ['tesseract', '--list-langs'] 85+ args_tess = ['@tesseract@', '--list-langs'] 86 try: 87 proc = run( 88 args_tess, 89@@ -154,7 +154,7 @@ def get_languages() -> set[str]: 90 91 92 def tess_base_args(langs: list[str], engine_mode: int | None) -> list[str]: 93- args = ['tesseract'] 94+ args = ['@tesseract@'] 95 if langs: 96 args.extend(['-l', '+'.join(langs)]) 97 if engine_mode is not None: 98diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py 99index 2944b4f4..55a36140 100644 100--- a/src/ocrmypdf/_exec/unpaper.py 101+++ b/src/ocrmypdf/_exec/unpaper.py 102@@ -69,7 +69,7 @@ class UnpaperImageTooLargeError(Exception): 103 104 105 def version() -> Version: 106- return Version(get_version('unpaper')) 107+ return Version(get_version('@unpaper@')) 108 109 110 SUPPORTED_MODES = {'1', 'L', 'RGB'} 111@@ -123,7 +123,7 @@ def _setup_unpaper_io(input_file: Path) -> Iterator[tuple[Path, Path, Path]]: 112 def run_unpaper( 113 input_file: Path, output_file: Path, *, dpi: DecFloat, mode_args: list[str] 114 ) -> None: 115- args_unpaper = ['unpaper', '-v', '--dpi', str(round(dpi, 6))] + mode_args 116+ args_unpaper = ['@unpaper@', '-v', '--dpi', str(round(dpi, 6))] + mode_args 117 118 with _setup_unpaper_io(input_file) as (input_png, output_pnm, tmpdir): 119 # To prevent any shenanigans from accepting arbitrary parameters in