[packages/python-tesserocr] - updated to 2.6.0

qboosh qboosh at pld-linux.org
Sun Apr 9 17:20:37 CEST 2023


commit 267d33edba3af87c31f4aa015007d6dc19c0cd33
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Apr 9 17:23:13 2023 +0200

    - updated to 2.6.0

 python-tesserocr.spec | 47 +++++++++++++++++++++++++-----------
 tesseract4.patch      | 67 ---------------------------------------------------
 2 files changed, 33 insertions(+), 81 deletions(-)
---
diff --git a/python-tesserocr.spec b/python-tesserocr.spec
index 01b0369..93a6958 100644
--- a/python-tesserocr.spec
+++ b/python-tesserocr.spec
@@ -1,9 +1,7 @@
+# TODO: 2 tests fail (with tesserect 5.3.1)
 #
-# TODO
-# - tests fail: raise RuntimeError('Failed to initialize API')
-
 # Conditional build:
-%bcond_with	tests	# do not perform "make test"
+%bcond_with	tests	# unit tests
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
 
@@ -11,27 +9,30 @@
 %define		egg_name	tesserocr
 %define		pypi_name	tesserocr
 Summary:	A simple, Pillow-friendly, Python wrapper around tesseract-ocr API using Cython
+Summary(pl.UTF-8):	Proste, zgodne z Pillow obudowanie API tesseract-ocr przy użyciu Cythona
 Name:		python-%{pypi_name}
-Version:	2.3.1
-Release:	6
+Version:	2.6.0
+Release:	1
 License:	MIT
 Group:		Libraries/Python
-Source0:	https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
-# Source0-md5:	99e2001affe861ae3a5aa2e9f233e2d7
-Patch0:		tesseract4.patch
+Source0:	https://files.pythonhosted.org/packages/source/t/tesserocr/%{pypi_name}-%{version}.tar.gz
+# Source0-md5:	87582e2fe5d020ebdf0ccd76569c9ed8
 URL:		https://github.com/sirfz/tesserocr
+BuildRequires:	leptonlib-devel >= 1.71
+BuildRequires:	libstdc++-devel >= 6:4.7
+BuildRequires:	pkgconfig
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRequires:	tesseract-devel >= 3.04
 %if %{with python2}
-BuildRequires:	python-Cython
-BuildRequires:	python-devel
+BuildRequires:	python-Cython >= 0.23
+BuildRequires:	python-devel >= 1:2.7
 BuildRequires:	python-pillow
 BuildRequires:	python-setuptools
 %endif
 %if %{with python3}
-BuildRequires:	python3-Cython
-BuildRequires:	python3-devel
+BuildRequires:	python3-Cython >= 0.23
+BuildRequires:	python3-devel >= 1:3.4
 BuildRequires:	python3-pillow
 BuildRequires:	python3-setuptools
 %endif
@@ -46,8 +47,18 @@ module by releasing the GIL while processing an image in tesseract.
 tesserocr is designed to be Pillow-friendly but can also be used with
 image files instead.
 
+%description -l pl.UTF-8
+tesserocr integruje się bezpośrednio z API C++ Tesseracta przy użyciu
+Cythona, który pozwala tworzyć prosty, pythonowy, łatwo czytelny kod.
+W połączeniu z pythonowym modułem threading umożliwia współbieżne
+wykonywanie, zwalniając GIL przy przetwarzaniu obrazu w tesserakcie.
+
+tesserocr jest zaprojektowany jako zgodny z Pillow, ale może być
+używany także z plikami obrazów.
+
 %package -n python3-%{pypi_name}
 Summary:	A simple, Pillow-friendly, Python wrapper around tesseract-ocr API using Cython
+Summary(pl.UTF-8):	Proste, zgodne z Pillow obudowanie API tesseract-ocr przy użyciu Cythona
 Group:		Libraries/Python
 
 %description -n python3-%{pypi_name}
@@ -59,9 +70,17 @@ module by releasing the GIL while processing an image in tesseract.
 tesserocr is designed to be Pillow-friendly but can also be used with
 image files instead.
 
+%description -n python3-%{pypi_name} -l pl.UTF-8
+tesserocr integruje się bezpośrednio z API C++ Tesseracta przy użyciu
+Cythona, który pozwala tworzyć prosty, pythonowy, łatwo czytelny kod.
+W połączeniu z pythonowym modułem threading umożliwia współbieżne
+wykonywanie, zwalniając GIL przy przetwarzaniu obrazu w tesserakcie.
+
+tesserocr jest zaprojektowany jako zgodny z Pillow, ale może być
+używany także z plikami obrazów.
+
 %prep
 %setup -q -n %{pypi_name}-%{version}
-%patch0 -p1
 
 # Remove bundled egg-info
 %{__rm} -r %{egg_name}.egg-info
diff --git a/tesseract4.patch b/tesseract4.patch
deleted file mode 100644
index 5813085..0000000
--- a/tesseract4.patch
+++ /dev/null
@@ -1,67 +0,0 @@
---- tesserocr-2.3.1/tesseract.pxd~	2018-02-04 20:28:35.000000000 +0100
-+++ tesserocr-2.3.1/tesseract.pxd	2018-08-16 22:58:33.358727376 +0200
-@@ -198,19 +198,6 @@
-         cdef cppclass TessOsdRenderer(TessResultRenderer):
-             TessOsdRenderer(cchar_t *) except +
- 
--cdef extern from "tesseract/osdetect.h" nogil:
--    struct OSBestResult:
--        int orientation_id
--        int script_id
--        float sconfidence
--        float oconfidence
--
--    ctypedef int (*get_best_script)(int)
--
--    struct OSResults:
--        get_best_script get_best_script
--        OSBestResult best_result
--
- cdef extern from "tesseract/baseapi.h" namespace "tesseract" nogil:
- 
-     IF TESSERACT_VERSION >= 0x040000:
-@@ -312,7 +312,6 @@
-             int IsValidWord(cchar_t *)
-             bool IsValidCharacter(cchar_t *)
-             bool GetTextDirection(int *, float *)
--            bool DetectOS(OSResults *);
-             cchar_t *GetUnichar(int)
-             const OcrEngineMode oem() const
-             void set_min_orientation_margin(double)
-@@ -386,7 +385,6 @@
-             int IsValidWord(cchar_t *)
-             bool IsValidCharacter(cchar_t *)
-             bool GetTextDirection(int *, float *)
--            bool DetectOS(OSResults *);
-             cchar_t *GetUnichar(int)
-             const OcrEngineMode oem() const
-             void set_min_orientation_margin(double)
---- tesserocr-2.3.1/tesserocr.pyx~	2018-08-13 19:35:16.000000000 +0200
-+++ tesserocr-2.3.1/tesserocr.pyx	2018-08-16 23:00:17.290796571 +0200
-@@ -2292,26 +2292,6 @@
-         self._baseapi.GetTextDirection(&out_offset, &out_slope)
-         return out_offset, out_slope
- 
--    def DetectOS(self):
--        """Estimate the Orientation and Script of the image.
--
--        Returns:
--            `dict` or `None` if image was not successfully processed. dict contains:
--                - orientation: Orientation ids [0..3] map to [0, 270, 180, 90] degree orientations of the
--                  page respectively, where the values refer to the amount of clockwise
--                  rotation to be applied to the page for the text to be upright and readable.
--                - oconfidence: Orientation confidence.
--                - script: Index of the script with the highest score for this orientation.
--                - sconfidence: script confidence.
--        """
--        cdef OSResults results
--        if self._baseapi.DetectOS(&results):
--            return {'orientation': results.best_result.orientation_id,
--                    'oconfidence': results.best_result.oconfidence,
--                    'script': results.get_best_script(results.best_result.orientation_id),
--                    'sconfidence': results.best_result.sconfidence}
--        return None
--
-     def GetUnichar(self, int unichar_id):
-         """Return the string form of the specified unichar.
- 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-tesserocr.git/commitdiff/267d33edba3af87c31f4aa015007d6dc19c0cd33



More information about the pld-cvs-commit mailing list