From nobody Thu Jan 27 23:50:30 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CB8A4199561C; Thu, 27 Jan 2022 23:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JlHQZ5QRgz4q6y; Thu, 27 Jan 2022 23:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643327430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SPOJWhHJuLgBFuqNm1KnXhR6sebdIJB5rlaubVv6F+M=; b=gGjWflTKHkNLWek2J5/D2rbNAFtyypwEG+FIIJC46InQkyUz7SjpGaJMXw231f3kbXsXLx J58FHMZ6rEeoqt0w9ouSjioTawoUNwQ68JGgqdJQX/cqLxN5ZTX+ynVAtilXcWi8JdifZg UO2V7nwgIQYXwNF4Fkf9ZVMnqhv4cp4T/VWS/LenH9VQKbEZWQzAGHEH8tp+lPgD+4KRTh HmQjOFcLTk5KG3iMyFKYgUTqh9OYlrEfNkOOaWJ1wBDTdAwO7A1FjjD5IfXjCr3AwF1cI9 UGjXeUuuVLkunyHqBhm6a5gcKENT2HvPqAl2zoRMJEw1M/yo/irTTtRwo8k7lQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FD941FB4E; Thu, 27 Jan 2022 23:50:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20RNoUl0000812; Thu, 27 Jan 2022 23:50:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20RNoUPd000811; Thu, 27 Jan 2022 23:50:30 GMT (envelope-from git) Date: Thu, 27 Jan 2022 23:50:30 GMT Message-Id: <202201272350.20RNoUPd000811@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Matthias Andree Subject: git: fb684eef543b - main - graphics/py-pytesseract: fix DICT conversion List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mandree X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fb684eef543b0c451ac9a59e50ee40ee540241f3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643327430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SPOJWhHJuLgBFuqNm1KnXhR6sebdIJB5rlaubVv6F+M=; b=g5Zpch1a6FKOXKiMEaHpPtNQOFxlmf4ck6ZmQ0mYkwi6ZmSn4Do7dvZkYZPMofQP6nkhXQ NxWFYnRcfjLFaVUx6C183Uhli5FTikqoaJ5B7zm1KtVMKORflkmJJZOVrZ0qyqzjMisXRo KW+T+ft7MCQZUa1g/R59XXnQzQpJ3WF1FuszbZ8t2RIeGo6Ky9fZGjCcUWiApgXXTcsahK 9vFLgPeDj1ofpezMGjDpN5xzApOwm0do+Fh6IDkTiNexxBBSfSFzjU+qdfPbTtmj3aKyBq IqDD/3LgJarMceSmYYDuf316WohU2m/2lR2XMAdtqdwHReLHhhwmuKuAQbzo5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643327430; a=rsa-sha256; cv=none; b=Wc6enJh2FWTtfrOcFze1EH1SZEs1I+uhBElTdYtoIDC5DWNRhU1Vse1XUFENYZSEGvGolB HpueRZSGoN+DKattzj2NKl/VRB+eJhP6zaBrgib3ETr075rthXpaxuEPApwspBWNPY8o1B NoG6ZAfsYdNQ0oGSoZ481lNjInaD2rbBEnBmV6NHoe+nPYKT8ZClbnLB3JawNGhgpxWV3g MZ+mr+Sa/lQ4J+Zz6VKlaTry4hgo0Gn5rkuGHrtdNJabHE1tAIC5tStVZ2QEKub5TkR1VG U+0KDCUDVVZSkCt9GyIzea8vjK8u7EbgY8Ev+pZtK2qFXSEbQCiCaN8lPxdX1A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mandree: URL: https://cgit.FreeBSD.org/ports/commit/?id=fb684eef543b0c451ac9a59e50ee40ee540241f3 commit fb684eef543b0c451ac9a59e50ee40ee540241f3 Author: Matthias Andree AuthorDate: 2022-01-27 23:48:12 +0000 Commit: Matthias Andree CommitDate: 2022-01-27 23:50:17 +0000 graphics/py-pytesseract: fix DICT conversion ...via tsv file; this was the one failing self-test, now passes. https://github.com/madmaze/pytesseract/issues/406 --- graphics/py-pytesseract/Makefile | 5 +++- graphics/py-pytesseract/files/patch-g06e7f807 | 36 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/graphics/py-pytesseract/Makefile b/graphics/py-pytesseract/Makefile index 969145cc2539..541f47401242 100644 --- a/graphics/py-pytesseract/Makefile +++ b/graphics/py-pytesseract/Makefile @@ -1,5 +1,6 @@ PORTNAME= pytesseract PORTVERSION= 0.3.9 +PORTREVISION= 1 DISTVERSIONPREFIX= v CATEGORIES= graphics python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -7,6 +8,8 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= mandree@FreeBSD.org COMMENT= wrapper for Google's Tesseract OCR engine +PATCH_STRIP= -p1 + LICENSE= BSD2CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE @@ -25,7 +28,7 @@ USE_PYTHON= autoplist concurrent distutils NO_ARCH= yes do-test: - cd ${WRKSRC} && ${SETENV} ${TEST_ENV} tox -e ${PY_FLAVOR} --sitepackages + cd ${WRKSRC} && ${SETENV} ${TEST_ENV} tox-${PYTHON_VER} -e ${PY_FLAVOR} --sitepackages .include diff --git a/graphics/py-pytesseract/files/patch-g06e7f807 b/graphics/py-pytesseract/files/patch-g06e7f807 new file mode 100644 index 000000000000..71ba847a05ff --- /dev/null +++ b/graphics/py-pytesseract/files/patch-g06e7f807 @@ -0,0 +1,36 @@ +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 +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