nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 110 lines 4.1 kB view raw
1diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py 2index ec9017ca..0986641d 100644 3--- a/src/ocrmypdf/_exec/ghostscript.py 4+++ b/src/ocrmypdf/_exec/ghostscript.py 5@@ -35,7 +35,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 736de67e..d8c24ebd 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@@ -32,7 +32,7 @@ def available(): 28 29 30 def convert_single(cwd, infile, outfile, threshold): 31- args = ['jbig2', '--pdf', '-t', str(threshold), infile] 32+ args = ['@jbig2@', '--pdf', '-t', str(threshold), infile] 33 with open(outfile, 'wb') as fstdout: 34 proc = run(args, cwd=cwd, stdout=fstdout, stderr=PIPE) 35 proc.check_returncode() 36diff --git a/src/ocrmypdf/_exec/pngquant.py b/src/ocrmypdf/_exec/pngquant.py 37index 5b8600d0..fcad771b 100644 38--- a/src/ocrmypdf/_exec/pngquant.py 39+++ b/src/ocrmypdf/_exec/pngquant.py 40@@ -15,7 +15,7 @@ from ocrmypdf.subprocess import get_version, run 41 42 43 def version() -> Version: 44- return Version(get_version('pngquant', regex=r'(\d+(\.\d+)*).*')) 45+ return Version(get_version('@pngquant@', regex=r'(\d+(\.\d+)*).*')) 46 47 48 def available(): 49@@ -37,7 +37,7 @@ def quantize(input_file: Path, output_file: Path, quality_min: int, quality_max: 50 """ 51 with open(input_file, 'rb') as input_stream: 52 args = [ 53- 'pngquant', 54+ '@pngquant@', 55 '--force', 56 '--skip-if-larger', 57 '--quality', 58diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py 59index d41a0af7..b189b0de 100644 60--- a/src/ocrmypdf/_exec/tesseract.py 61+++ b/src/ocrmypdf/_exec/tesseract.py 62@@ -116,7 +116,7 @@ class TesseractVersion(Version): 63 64 65 def version() -> Version: 66- return TesseractVersion(get_version('tesseract', regex=r'tesseract\s(.+)')) 67+ return TesseractVersion(get_version('@tesseract@', regex=r'tesseract\s(.+)')) 68 69 70 def has_thresholding() -> bool: 71@@ -134,7 +134,7 @@ def get_languages() -> set[str]: 72 msg += output 73 return msg 74 75- args_tess = ['tesseract', '--list-langs'] 76+ args_tess = ['@tesseract@', '--list-langs'] 77 try: 78 proc = run( 79 args_tess, 80@@ -156,7 +156,7 @@ def get_languages() -> set[str]: 81 82 83 def tess_base_args(langs: list[str], engine_mode: int | None) -> list[str]: 84- args = ['tesseract'] 85+ args = ['@tesseract@'] 86 if langs: 87 args.extend(['-l', '+'.join(langs)]) 88 if engine_mode is not None: 89diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py 90index 065fc9ef..4fab9313 100644 91--- a/src/ocrmypdf/_exec/unpaper.py 92+++ b/src/ocrmypdf/_exec/unpaper.py 93@@ -47,7 +47,7 @@ class UnpaperImageTooLargeError(Exception): 94 95 96 def version() -> Version: 97- return Version(get_version('unpaper', regex=r'(?m).*?(\d+(\.\d+)(\.\d+)?)')) 98+ return Version(get_version('@unpaper@', regex=r'(?m).*?(\d+(\.\d+)(\.\d+)?)')) 99 100 101 @contextmanager 102@@ -69,7 +69,7 @@ def _setup_unpaper_io(input_file: Path) -> Iterator[tuple[Path, Path, Path]]: 103 def run_unpaper( 104 input_file: Path, output_file: Path, *, dpi: DecFloat, mode_args: list[str] 105 ) -> None: 106- args_unpaper = ['unpaper', '-v', '--dpi', str(round(dpi, 6))] + mode_args 107+ args_unpaper = ['@unpaper@', '-v', '--dpi', str(round(dpi, 6))] + mode_args 108 109 with _setup_unpaper_io(input_file) as (input_png, output_pnm, tmpdir): 110 # To prevent any shenanigans from accepting arbitrary parameters in