git: 909f75fd1228 - main - graphics/py-pytesseract: update to v0.3.10

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Wed, 30 Mar 2022 20:47:44 UTC
The branch main has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=909f75fd1228c514cae8f560f5655e4aabb53127

commit 909f75fd1228c514cae8f560f5655e4aabb53127
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2022-03-30 20:45:37 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2022-03-30 20:47:31 +0000

    graphics/py-pytesseract: update to v0.3.10
    
    * Fix image_to_osd regression (reported by @klavdijS)
    
    Changelog: https://github.com/madmaze/pytesseract/releases/tag/v0.3.10
    
    MFH skipped, we are just two days before 2022Q2 branch.
---
 graphics/py-pytesseract/Makefile              | 13 ++++++++--
 graphics/py-pytesseract/distinfo              |  6 ++---
 graphics/py-pytesseract/files/patch-g06e7f807 | 36 ---------------------------
 3 files changed, 14 insertions(+), 41 deletions(-)

diff --git a/graphics/py-pytesseract/Makefile b/graphics/py-pytesseract/Makefile
index 541f47401242..c3ec6d410828 100644
--- a/graphics/py-pytesseract/Makefile
+++ b/graphics/py-pytesseract/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	pytesseract
-PORTVERSION=	0.3.9
-PORTREVISION=	1
+PORTVERSION=	0.3.10
 DISTVERSIONPREFIX=	v
 CATEGORIES=	graphics python
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -28,6 +27,16 @@ USE_PYTHON=	autoplist concurrent distutils
 NO_ARCH=	yes
 
 do-test:
+		# FIXME hack alert. graphics/leptonica by default does not include
+		# jpeg2000 (openjpeg) support, and the pytesseract self-test is not
+		# smart enough to detect that and skip the test, so let us check
+		# and punch out the jpeg2000 test if it is pointless running it.
+		# https://github.com/madmaze/pytesseract/issues/419
+		@if ${READELF} -d ${LOCALBASE}/lib/liblept.so | ${EGREP} -q '\<NEEDED\>.+\<libopenjp2\.so\.[[:digit:]]' ; then : ; else \
+			if [ $$? -ne 1 ] ; then exit 1 ; fi ; \
+			${ECHO_MSG} >&2 '===>   liblept.so (graphics/leptonica) is linked without libopenjp2, disabling JPEG2000 test' ; \
+			${REINPLACE_CMD} '/jpeg2000/d' ${WRKSRC}/tests/pytesseract_test.py ; \
+		fi
 		cd ${WRKSRC} && ${SETENV} ${TEST_ENV} tox-${PYTHON_VER} -e ${PY_FLAVOR} --sitepackages
 
 .include <bsd.port.pre.mk>
diff --git a/graphics/py-pytesseract/distinfo b/graphics/py-pytesseract/distinfo
index 3995d7d1dcd4..0bea694fe5aa 100644
--- a/graphics/py-pytesseract/distinfo
+++ b/graphics/py-pytesseract/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1643230252
-SHA256 (madmaze-pytesseract-v0.3.9_GH0.tar.gz) = 3dddea670d0338f765b0693eecf5ba88fb268bfe26e0b76bade8b615b1802672
-SIZE (madmaze-pytesseract-v0.3.9_GH0.tar.gz) = 964493
+TIMESTAMP = 1648668468
+SHA256 (madmaze-pytesseract-v0.3.10_GH0.tar.gz) = 1de64cae604fc0b2bc5b185620c612199b01c833c64c2a4a9e8877ace1ed5a92
+SIZE (madmaze-pytesseract-v0.3.10_GH0.tar.gz) = 1098547
diff --git a/graphics/py-pytesseract/files/patch-g06e7f807 b/graphics/py-pytesseract/files/patch-g06e7f807
deleted file mode 100644
index 71ba847a05ff..000000000000
--- a/graphics/py-pytesseract/files/patch-g06e7f807
+++ /dev/null
@@ -1,36 +0,0 @@
-This is obtained from upstream and ADDITIONALLY
-changes the try: val = int(row[i]) in upstream int3l@github's version
-to int(float(row[i])).   -- Matthias Andree, mandree@FreeBSD.org
-
-From 06e7f8077467950d2f4e0f619fb193730c2d2079 Mon Sep 17 00:00:00 2001
-From: int3l <int3l@users.noreply.github.com>
-Date: Thu, 27 Jan 2022 16:09:21 +0200
-Subject: [PATCH] Fix confidence conversion from str to int
-
-Account for negative values. Fixes #406
----
- pytesseract/pytesseract.py | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/pytesseract/pytesseract.py b/pytesseract/pytesseract.py
-index 984b106..e927e80 100644
---- a/pytesseract/pytesseract.py
-+++ b/pytesseract/pytesseract.py
-@@ -313,9 +313,14 @@ def file_to_dict(tsv, cell_delimiter, str_col_idx):
-             if len(row) <= i:
-                 continue
- 
--            val = row[i]
--            if row[i].isdigit() and i != str_col_idx:
--                val = int(row[i])
-+            if i != str_col_idx:
-+                try:
-+                    val = int(float(row[i]))
-+                except ValueError:
-+                    val = row[i]
-+            else:
-+                val = row[i]
-+
-             result[head].append(val)
- 
-     return result