at master 4.4 kB view raw
1diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py 2index eaa48117..30201d97 100644 3--- a/src/ocrmypdf/_exec/ghostscript.py 4+++ b/src/ocrmypdf/_exec/ghostscript.py 5@@ -31,7 +31,7 @@ COLOR_CONVERSION_STRATEGIES = frozenset( 6 ] 7 ) 8 # Ghostscript executable - gswin32c is not supported 9-GS = 'gswin64c' if os.name == 'nt' else 'gs' 10+GS = '@gs@' 11 12 13 log = logging.getLogger(__name__) 14diff --git a/src/ocrmypdf/_exec/jbig2enc.py b/src/ocrmypdf/_exec/jbig2enc.py 15index 1c6dd5fe..b689a091 100644 16--- a/src/ocrmypdf/_exec/jbig2enc.py 17+++ b/src/ocrmypdf/_exec/jbig2enc.py 18@@ -15,7 +15,7 @@ from ocrmypdf.subprocess import get_version, run 19 20 def version() -> Version: 21 try: 22- version = get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*') 23+ version = get_version('@jbig2@', regex=r'jbig2enc (\d+(\.\d+)*).*') 24 except CalledProcessError as e: 25 # TeX Live for Windows provides an incompatible jbig2.EXE which may 26 # be on the PATH. 27@@ -33,7 +33,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(cwd, infiles, out_prefix, threshold): 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 5b8600d0..fcad771b 100644 47--- a/src/ocrmypdf/_exec/pngquant.py 48+++ b/src/ocrmypdf/_exec/pngquant.py 49@@ -15,7 +15,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@@ -37,7 +37,7 @@ def quantize(input_file: Path, output_file: Path, quality_min: int, quality_max: 59 """ 60 with open(input_file, 'rb') 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 102bdab8..bfef4400 100644 69--- a/src/ocrmypdf/_exec/tesseract.py 70+++ b/src/ocrmypdf/_exec/tesseract.py 71@@ -95,7 +95,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@@ -113,7 +113,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@@ -135,7 +135,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 a5a92f4c..6cf56eb3 100644 100--- a/src/ocrmypdf/_exec/unpaper.py 101+++ b/src/ocrmypdf/_exec/unpaper.py 102@@ -48,7 +48,7 @@ class UnpaperImageTooLargeError(Exception): 103 104 105 def version() -> Version: 106- return Version(get_version('unpaper', regex=r'(?m).*?(\d+(\.\d+)(\.\d+)?)')) 107+ return Version(get_version('@unpaper@', regex=r'(?m).*?(\d+(\.\d+)(\.\d+)?)')) 108 109 110 @contextmanager 111@@ -70,7 +70,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