Loading pkgs/development/python-modules/ocrmypdf/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ buildPythonPackage rec { pname = "ocrmypdf"; version = "13.4.7"; version = "13.5.0"; src = fetchFromGitHub { owner = "ocrmypdf"; Loading @@ -39,7 +39,7 @@ buildPythonPackage rec { postFetch = '' rm "$out/.git_archival.txt" ''; hash = "sha256-jCfMCjh8MdH5K76iyJCgtkgPtpxnCxlXlzttTIzINPk="; hash = "sha256-jGVqH2z8NRnQcm4hv4OufCm26o6Qr8/mBRIScvcUpkE="; }; SETUPTOOLS_SCM_PRETEND_VERSION = version; Loading pkgs/development/python-modules/ocrmypdf/paths.patch +20 −20 Original line number Diff line number Diff line 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@' Loading Loading @@ -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: Loading @@ -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 Loading @@ -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]: Loading @@ -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: Loading @@ -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 Loading
pkgs/development/python-modules/ocrmypdf/default.nix +2 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ buildPythonPackage rec { pname = "ocrmypdf"; version = "13.4.7"; version = "13.5.0"; src = fetchFromGitHub { owner = "ocrmypdf"; Loading @@ -39,7 +39,7 @@ buildPythonPackage rec { postFetch = '' rm "$out/.git_archival.txt" ''; hash = "sha256-jCfMCjh8MdH5K76iyJCgtkgPtpxnCxlXlzttTIzINPk="; hash = "sha256-jGVqH2z8NRnQcm4hv4OufCm26o6Qr8/mBRIScvcUpkE="; }; SETUPTOOLS_SCM_PRETEND_VERSION = version; Loading
pkgs/development/python-modules/ocrmypdf/paths.patch +20 −20 Original line number Diff line number Diff line 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@' Loading Loading @@ -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: Loading @@ -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 Loading @@ -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]: Loading @@ -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: Loading @@ -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