Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / ocrmypdf / paths.patch
bloba1db7c690bcfa31a7f92510bf138eea47c3aab0d
1 diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py
2 index 92b73a0a..9f04555c 100644
3 --- a/src/ocrmypdf/_exec/ghostscript.py
4 +++ b/src/ocrmypdf/_exec/ghostscript.py
5 @@ -58,7 +58,7 @@ log.addFilter(DuplicateFilter(log))
8 # Ghostscript executable - gswin32c is not supported
9 -GS = 'gswin64c' if os.name == 'nt' else 'gs'
10 +GS = '@gs@'
13 def version() -> Version:
14 diff --git a/src/ocrmypdf/_exec/jbig2enc.py b/src/ocrmypdf/_exec/jbig2enc.py
15 index 5a34a95a..5ee1b333 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
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+)*).*'))
26 def available():
27 @@ -27,7 +27,7 @@ def available():
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 @@ -44,7 +44,7 @@ def convert_group(cwd, infiles, out_prefix, threshold):
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()
45 diff --git a/src/ocrmypdf/_exec/pngquant.py b/src/ocrmypdf/_exec/pngquant.py
46 index 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
52 def version() -> Version:
53 - return Version(get_version('pngquant', regex=r'(\d+(\.\d+)*).*'))
54 + return Version(get_version('@pngquant@', regex=r'(\d+(\.\d+)*).*'))
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',
67 diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py
68 index fab92bb1..78b634a7 100644
69 --- a/src/ocrmypdf/_exec/tesseract.py
70 +++ b/src/ocrmypdf/_exec/tesseract.py
71 @@ -95,7 +95,7 @@ class TesseractVersion(Version):
74 def version() -> Version:
75 - return TesseractVersion(get_version('tesseract', regex=r'tesseract\s(.+)'))
76 + return TesseractVersion(get_version('@tesseract@', regex=r'tesseract\s(.+)'))
79 def has_thresholding() -> bool:
80 @@ -113,7 +113,7 @@ def get_languages() -> set[str]:
81 msg += output
82 return msg
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]:
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:
98 diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py
99 index 493d9b3a..578c2dda 100644
100 --- a/src/ocrmypdf/_exec/unpaper.py
101 +++ b/src/ocrmypdf/_exec/unpaper.py
102 @@ -70,7 +70,7 @@ class UnpaperImageTooLargeError(Exception):
105 def version() -> Version:
106 - return Version(get_version('unpaper'))
107 + return Version(get_version('@unpaper@'))
110 @contextmanager
111 @@ -92,7 +92,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
118 with _setup_unpaper_io(input_file) as (input_png, output_pnm, tmpdir):
119 # To prevent any shenanigans from accepting arbitrary parameters in