about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ocrmypdf/paths.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/ocrmypdf/paths.patch')
-rw-r--r--pkgs/development/python-modules/ocrmypdf/paths.patch40
1 files changed, 20 insertions, 20 deletions
diff --git a/pkgs/development/python-modules/ocrmypdf/paths.patch b/pkgs/development/python-modules/ocrmypdf/paths.patch
index 47521e1033eb4..9b1eed233cbb2 100644
--- a/pkgs/development/python-modules/ocrmypdf/paths.patch
+++ b/pkgs/development/python-modules/ocrmypdf/paths.patch
@@ -1,20 +1,20 @@
 diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py
-index 1146cc5f..43f3915c 100644
+index 4da65483..af750249 100644
 --- a/src/ocrmypdf/_exec/ghostscript.py
 +++ b/src/ocrmypdf/_exec/ghostscript.py
-@@ -40,15 +40,7 @@ For details see:
+@@ -35,15 +35,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
+ _IS_64BIT = sys.maxsize > 2**32
  
--_gswin = None
+-_GSWIN = None
 -if os.name == 'nt':
--    if _is_64bit:
--        _gswin = 'gswin64c'
+-    if _IS_64BIT:
+-        _GSWIN = 'gswin64c'
 -    else:
--        _gswin = 'gswin32c'
+-        _GSWIN = 'gswin32c'
 -
--GS = _gswin if _gswin else 'gs'
--del _gswin
+-GS = _GSWIN if _GSWIN else 'gs'
+-del _GSWIN
 +GS = '@gs@'
  
  
@@ -73,10 +73,10 @@ index ca8a4542..d0544174 100644
              '--skip-if-larger',
              '--quality',
 diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py
-index a3688f65..61f54465 100644
+index 01177cac..665f1145 100644
 --- a/src/ocrmypdf/_exec/tesseract.py
 +++ b/src/ocrmypdf/_exec/tesseract.py
-@@ -75,7 +75,7 @@ class TesseractVersion(StrictVersion):
+@@ -114,7 +114,7 @@ class TesseractVersion(Version):
  
  
  def version() -> str:
@@ -85,7 +85,7 @@ index a3688f65..61f54465 100644
  
  
  def has_user_words():
-@@ -97,7 +97,7 @@ def get_languages():
+@@ -141,7 +141,7 @@ def get_languages():
          msg += output
          return msg
  
@@ -94,7 +94,7 @@ index a3688f65..61f54465 100644
      try:
          proc = run(
              args_tess,
-@@ -119,7 +119,7 @@ def get_languages():
+@@ -163,7 +163,7 @@ def get_languages():
  
  
  def tess_base_args(langs: List[str], engine_mode: Optional[int]) -> List[str]:
@@ -104,10 +104,10 @@ index a3688f65..61f54465 100644
          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 aec365c2..cc5cb7e4 100644
+index 479959ef..cc15fdec 100644
 --- a/src/ocrmypdf/_exec/unpaper.py
 +++ b/src/ocrmypdf/_exec/unpaper.py
-@@ -31,7 +31,7 @@ log = logging.getLogger(__name__)
+@@ -69,7 +69,7 @@ class UnpaperImageTooLargeError(Exception):
  
  
  def version() -> str:
@@ -115,13 +115,13 @@ index aec365c2..cc5cb7e4 100644
 +    return get_version('@unpaper@')
  
  
- def _setup_unpaper_io(tmpdir: Path, input_file: Path) -> Tuple[Path, Path]:
-@@ -71,7 +71,7 @@ def _setup_unpaper_io(tmpdir: Path, input_file: Path) -> Tuple[Path, Path]:
- def run(
+ SUFFIXES = {'1': '.pbm', 'L': '.pgm', 'RGB': '.ppm'}
+@@ -123,7 +123,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 TemporaryDirectory() as tmpdir:
-         input_pnm, output_pnm = _setup_unpaper_io(Path(tmpdir), input_file)
+     with _setup_unpaper_io(input_file) as (input_pnm, output_pnm, tmpdir):
+         # To prevent any shenanigans from accepting arbitrary parameters in