summary refs log tree commit diff
path: root/pkgs/development/python-modules/ocrmypdf/paths.patch
blob: 71d96c9a98ebb97d1ca8a4f7d6619121da5f303a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py
index 9e21c33c..21f134b3 100644
--- a/src/ocrmypdf/_exec/ghostscript.py
+++ b/src/ocrmypdf/_exec/ghostscript.py
@@ -32,15 +32,7 @@ log = logging.getLogger(__name__)
 # Most reliable what to get the bitness of Python interpreter, according to Python docs
 _IS_64BIT = sys.maxsize > 2**32
 
-_GSWIN = None
-if os.name == 'nt':
-    if _IS_64BIT:
-        _GSWIN = 'gswin64c'
-    else:
-        _GSWIN = 'gswin32c'
-
-GS = _GSWIN if _GSWIN else 'gs'
-del _GSWIN
+GS = '@gs@'
 
 
 def version():
diff --git a/src/ocrmypdf/_exec/jbig2enc.py b/src/ocrmypdf/_exec/jbig2enc.py
index 0f8f7392..db792b10 100644
--- a/src/ocrmypdf/_exec/jbig2enc.py
+++ b/src/ocrmypdf/_exec/jbig2enc.py
@@ -12,7 +12,7 @@ from ocrmypdf.subprocess import get_version, run
 
 
 def version():
-    return get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*')
+    return get_version('@jbig2@', regex=r'jbig2enc (\d+(\.\d+)*).*')
 
 
 def available():
@@ -25,7 +25,7 @@ def available():
 
 def convert_group(*, cwd, infiles, out_prefix):
     args = [
-        'jbig2',
+        '@jbig2@',
         '-b',
         out_prefix,
         '-s',  # symbol mode (lossy)
@@ -44,7 +44,7 @@ def convert_group_mp(args):
 
 
 def convert_single(*, cwd, infile, outfile):
-    args = ['jbig2', '-p', infile]
+    args = ['@jbig2@', '-p', infile]
     with open(outfile, 'wb') as fstdout:
         proc = run(args, cwd=cwd, stdout=fstdout, stderr=PIPE)
     proc.check_returncode()
diff --git a/src/ocrmypdf/_exec/pngquant.py b/src/ocrmypdf/_exec/pngquant.py
index 64e91139..ab5b9c49 100644
--- a/src/ocrmypdf/_exec/pngquant.py
+++ b/src/ocrmypdf/_exec/pngquant.py
@@ -17,7 +17,7 @@ from ocrmypdf.subprocess import get_version, run
 
 
 def version():
-    return get_version('pngquant', regex=r'(\d+(\.\d+)*).*')
+    return get_version('@pngquant@', regex=r'(\d+(\.\d+)*).*')
 
 
 def available():
@@ -44,7 +44,7 @@ def input_as_png(input_file: Path):
 def quantize(input_file: Path, output_file: Path, quality_min: int, quality_max: int):
     with input_as_png(input_file) as input_stream:
         args = [
-            'pngquant',
+            '@pngquant@',
             '--force',
             '--skip-if-larger',
             '--quality',
diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py
index ad98836a..a12d3002 100644
--- a/src/ocrmypdf/_exec/tesseract.py
+++ b/src/ocrmypdf/_exec/tesseract.py
@@ -111,7 +111,7 @@ class TesseractVersion(Version):
 
 
 def version() -> str:
-    return get_version('tesseract', regex=r'tesseract\s(.+)')
+    return get_version('@tesseract@', regex=r'tesseract\s(.+)')
 
 
 def has_user_words() -> bool:
@@ -138,7 +138,7 @@ def get_languages() -> set[str]:
         msg += output
         return msg
 
-    args_tess = ['tesseract', '--list-langs']
+    args_tess = ['@tesseract@', '--list-langs']
     try:
         proc = run(
             args_tess,
@@ -160,7 +160,7 @@ def get_languages() -> set[str]:
 
 
 def tess_base_args(langs: list[str], engine_mode: int | None) -> list[str]:
-    args = ['tesseract']
+    args = ['@tesseract@']
     if langs:
         args.extend(['-l', '+'.join(langs)])
     if engine_mode is not None:
diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py
index d7f24265..d14f85de 100644
--- a/src/ocrmypdf/_exec/unpaper.py
+++ b/src/ocrmypdf/_exec/unpaper.py
@@ -66,7 +66,7 @@ class UnpaperImageTooLargeError(Exception):
 
 
 def version() -> str:
-    return get_version('unpaper')
+    return get_version('@unpaper@')
 
 
 SUPPORTED_MODES = {'1', 'L', 'RGB'}
@@ -120,7 +120,7 @@ def _setup_unpaper_io(input_file: Path) -> Iterator[tuple[Path, Path, Path]]:
 def run_unpaper(
     input_file: Path, output_file: Path, *, dpi: DecFloat, mode_args: list[str]
 ) -> None:
-    args_unpaper = ['unpaper', '-v', '--dpi', str(round(dpi, 6))] + mode_args
+    args_unpaper = ['@unpaper@', '-v', '--dpi', str(round(dpi, 6))] + mode_args
 
     with _setup_unpaper_io(input_file) as (input_png, output_pnm, tmpdir):
         # To prevent any shenanigans from accepting arbitrary parameters in