mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-13 15:43:39 +00:00
Merge pull request #148634 from dotlambda/ocrmypdf-13.0.0
This commit is contained in:
commit
970c9fd8eb
@ -8,7 +8,6 @@
|
|||||||
, importlib-metadata
|
, importlib-metadata
|
||||||
, importlib-resources
|
, importlib-resources
|
||||||
, jbig2enc
|
, jbig2enc
|
||||||
, leptonica
|
|
||||||
, pdfminer
|
, pdfminer
|
||||||
, pikepdf
|
, pikepdf
|
||||||
, pillow
|
, pillow
|
||||||
@ -30,7 +29,7 @@
|
|||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "ocrmypdf";
|
pname = "ocrmypdf";
|
||||||
version = "12.7.2";
|
version = "13.0.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "jbarlow83";
|
owner = "jbarlow83";
|
||||||
@ -42,7 +41,7 @@ buildPythonPackage rec {
|
|||||||
extraPostFetch = ''
|
extraPostFetch = ''
|
||||||
rm "$out/.git_archival.txt"
|
rm "$out/.git_archival.txt"
|
||||||
'';
|
'';
|
||||||
sha256 = "sha256-+mh7NgAk7R/94FXjRV+SLy478pZwYLLS8HwCazEbMf4=";
|
sha256 = "sha256-W5RFCWKDIRrsgHZL8uSOQWvEltLbqYAweZkgIZZrSIo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
||||||
@ -52,7 +51,6 @@ buildPythonPackage rec {
|
|||||||
src = ./paths.patch;
|
src = ./paths.patch;
|
||||||
gs = "${lib.getBin ghostscript}/bin/gs";
|
gs = "${lib.getBin ghostscript}/bin/gs";
|
||||||
jbig2 = "${lib.getBin jbig2enc}/bin/jbig2";
|
jbig2 = "${lib.getBin jbig2enc}/bin/jbig2";
|
||||||
liblept = "${lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
||||||
pngquant = "${lib.getBin pngquant}/bin/pngquant";
|
pngquant = "${lib.getBin pngquant}/bin/pngquant";
|
||||||
tesseract = "${lib.getBin tesseract4}/bin/tesseract";
|
tesseract = "${lib.getBin tesseract4}/bin/tesseract";
|
||||||
unpaper = "${lib.getBin unpaper}/bin/unpaper";
|
unpaper = "${lib.getBin unpaper}/bin/unpaper";
|
||||||
|
@ -1,30 +1,17 @@
|
|||||||
diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py
|
diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py
|
||||||
index 5c357f1b..f459763a 100644
|
index 1146cc5f..43f3915c 100644
|
||||||
--- a/src/ocrmypdf/_exec/ghostscript.py
|
--- a/src/ocrmypdf/_exec/ghostscript.py
|
||||||
+++ b/src/ocrmypdf/_exec/ghostscript.py
|
+++ b/src/ocrmypdf/_exec/ghostscript.py
|
||||||
@@ -25,28 +25,7 @@ from ocrmypdf.subprocess import get_version, run, run_polling_stderr
|
@@ -40,15 +40,7 @@ For details see:
|
||||||
|
# Most reliable what to get the bitness of Python interpreter, according to Python docs
|
||||||
|
_is_64bit = sys.maxsize > 2 ** 32
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
-missing_gs_error = """
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
-This error normally occurs when ocrmypdf find can't Ghostscript.
|
|
||||||
-Please ensure Ghostscript is installed and its location is added to
|
|
||||||
-the system PATH environment variable.
|
|
||||||
-
|
|
||||||
-For details see:
|
|
||||||
- https://ocrmypdf.readthedocs.io/en/latest/installation.html
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
-"""
|
|
||||||
-
|
|
||||||
-_gswin = None
|
-_gswin = None
|
||||||
-if os.name == 'nt':
|
-if os.name == 'nt':
|
||||||
- _gswin = which('gswin64c')
|
- if _is_64bit:
|
||||||
- if not _gswin:
|
- _gswin = 'gswin64c'
|
||||||
- _gswin = which('gswin32c')
|
- else:
|
||||||
- if not _gswin:
|
- _gswin = 'gswin32c'
|
||||||
- raise MissingDependencyError(missing_gs_error)
|
|
||||||
- _gswin = Path(_gswin).stem
|
|
||||||
-
|
-
|
||||||
-GS = _gswin if _gswin else 'gs'
|
-GS = _gswin if _gswin else 'gs'
|
||||||
-del _gswin
|
-del _gswin
|
||||||
@ -86,19 +73,19 @@ index ca8a4542..d0544174 100644
|
|||||||
'--skip-if-larger',
|
'--skip-if-larger',
|
||||||
'--quality',
|
'--quality',
|
||||||
diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py
|
diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py
|
||||||
index 33ead41e..5840f7c1 100644
|
index a3688f65..61f54465 100644
|
||||||
--- a/src/ocrmypdf/_exec/tesseract.py
|
--- a/src/ocrmypdf/_exec/tesseract.py
|
||||||
+++ b/src/ocrmypdf/_exec/tesseract.py
|
+++ b/src/ocrmypdf/_exec/tesseract.py
|
||||||
@@ -78,7 +78,7 @@ class TesseractVersion(StrictVersion):
|
@@ -75,7 +75,7 @@ class TesseractVersion(StrictVersion):
|
||||||
|
|
||||||
|
|
||||||
def version():
|
def version() -> str:
|
||||||
- return get_version('tesseract', regex=r'tesseract\s(.+)')
|
- return get_version('tesseract', regex=r'tesseract\s(.+)')
|
||||||
+ return get_version('@tesseract@', regex=r'tesseract\s(.+)')
|
+ return get_version('@tesseract@', regex=r'tesseract\s(.+)')
|
||||||
|
|
||||||
|
|
||||||
def has_user_words():
|
def has_user_words():
|
||||||
@@ -100,7 +100,7 @@ def get_languages():
|
@@ -97,7 +97,7 @@ def get_languages():
|
||||||
msg += output
|
msg += output
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
@ -107,7 +94,7 @@ index 33ead41e..5840f7c1 100644
|
|||||||
try:
|
try:
|
||||||
proc = run(
|
proc = run(
|
||||||
args_tess,
|
args_tess,
|
||||||
@@ -122,7 +122,7 @@ def get_languages():
|
@@ -119,7 +119,7 @@ def get_languages():
|
||||||
|
|
||||||
|
|
||||||
def tess_base_args(langs: List[str], engine_mode: Optional[int]) -> List[str]:
|
def tess_base_args(langs: List[str], engine_mode: Optional[int]) -> List[str]:
|
||||||
@ -117,7 +104,7 @@ index 33ead41e..5840f7c1 100644
|
|||||||
args.extend(['-l', '+'.join(langs)])
|
args.extend(['-l', '+'.join(langs)])
|
||||||
if engine_mode is not None:
|
if engine_mode is not None:
|
||||||
diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py
|
diff --git a/src/ocrmypdf/_exec/unpaper.py b/src/ocrmypdf/_exec/unpaper.py
|
||||||
index 3c3ae72c..d269966a 100644
|
index aec365c2..cc5cb7e4 100644
|
||||||
--- a/src/ocrmypdf/_exec/unpaper.py
|
--- a/src/ocrmypdf/_exec/unpaper.py
|
||||||
+++ b/src/ocrmypdf/_exec/unpaper.py
|
+++ b/src/ocrmypdf/_exec/unpaper.py
|
||||||
@@ -31,7 +31,7 @@ log = logging.getLogger(__name__)
|
@@ -31,7 +31,7 @@ log = logging.getLogger(__name__)
|
||||||
@ -138,23 +125,3 @@ index 3c3ae72c..d269966a 100644
|
|||||||
|
|
||||||
with TemporaryDirectory() as tmpdir:
|
with TemporaryDirectory() as tmpdir:
|
||||||
input_pnm, output_pnm = _setup_unpaper_io(Path(tmpdir), input_file)
|
input_pnm, output_pnm = _setup_unpaper_io(Path(tmpdir), input_file)
|
||||||
diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py
|
|
||||||
index e4814f1a..fdaf7ea4 100644
|
|
||||||
--- a/src/ocrmypdf/leptonica.py
|
|
||||||
+++ b/src/ocrmypdf/leptonica.py
|
|
||||||
@@ -33,14 +33,7 @@ from ocrmypdf.lib._leptonica import ffi
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
-if os.name == 'nt':
|
|
||||||
- from ocrmypdf.subprocess._windows import shim_env_path
|
|
||||||
-
|
|
||||||
- libname = 'liblept-5'
|
|
||||||
- os.environ['PATH'] = shim_env_path()
|
|
||||||
-else:
|
|
||||||
- libname = 'lept'
|
|
||||||
-_libpath = find_library(libname)
|
|
||||||
+_libpath = '@liblept@'
|
|
||||||
if not _libpath:
|
|
||||||
raise MissingDependencyError(
|
|
||||||
"""
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "pikepdf";
|
pname = "pikepdf";
|
||||||
version = "4.0.2";
|
version = "4.1.0";
|
||||||
disabled = ! isPy3k;
|
disabled = ! isPy3k;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
@ -37,7 +37,7 @@ buildPythonPackage rec {
|
|||||||
extraPostFetch = ''
|
extraPostFetch = ''
|
||||||
rm "$out/.git_archival.txt"
|
rm "$out/.git_archival.txt"
|
||||||
'';
|
'';
|
||||||
sha256 = "sha256-bUf9fef/YQsSj78kwoKl5a3zOjpeKWla9YY0azk0lIQ=";
|
sha256 = "sha256-8l3IDC2EhoNTImaTTjkBYhwbSBDC3PVLbdgs4txZOKc=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
|
Loading…
Reference in New Issue
Block a user