git: 4b0d2e11183e - main - www/py-readability-lxml: Add new port

From: Joel Bodenmann <jbo_at_FreeBSD.org>
Date: Mon, 11 Sep 2023 15:16:41 UTC
The branch main has been updated by jbo:

URL: https://cgit.FreeBSD.org/ports/commit/?id=4b0d2e11183ec9124b5f36436b2b79491816ff99

commit 4b0d2e11183ec9124b5f36436b2b79491816ff99
Author:     Martin Neubauer <m.ne@gmx.net>
AuthorDate: 2023-09-11 11:49:00 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2023-09-11 14:56:54 +0000

    www/py-readability-lxml: Add new port
    
    Fast HTML to text parser (article readability tool).
    
    PR:                     273553
    Approved by:            zirias (mentor)
    Differential Revision:  https://reviews.freebsd.org/D41813
---
 www/Makefile                                       |  1 +
 www/py-readability-lxml/Makefile                   | 28 ++++++++++++++++++++++
 www/py-readability-lxml/distinfo                   |  3 +++
 .../files/patch-readability_compat_two.py          | 11 +++++++++
 www/py-readability-lxml/pkg-descr                  |  2 ++
 5 files changed, 45 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index e80e38732953..bd973807ceb4 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -1787,6 +1787,7 @@
     SUBDIR += py-qt5-webengine
     SUBDIR += py-qt6-webengine
     SUBDIR += py-quilt3
+    SUBDIR += py-readability-lxml
     SUBDIR += py-recaptcha
     SUBDIR += py-requests
     SUBDIR += py-requests-aws4auth
diff --git a/www/py-readability-lxml/Makefile b/www/py-readability-lxml/Makefile
new file mode 100644
index 000000000000..b81041cc136b
--- /dev/null
+++ b/www/py-readability-lxml/Makefile
@@ -0,0 +1,28 @@
+PORTNAME=	readability-lxml
+PORTVERSION=	0.8.1
+CATEGORIES=	www python
+MASTER_SITES=	CHEESESHOP
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	m.ne@gmx.net
+COMMENT=	Fast HTML to text parser (article readability tool)
+WWW=		https://github.com/buriy/python-readability
+
+LICENSE=	APACHE20
+
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}cssselect>0:www/py-cssselect@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}lxml>0:devel/py-lxml@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}timeout-decorator>0:devel/py-timeout-decorator@${PY_FLAVOR}
+
+USES=		python
+USE_PYTHON=	autoplist distutils
+
+NO_ARCH=	yes
+
+OPTIONS_DEFINE=	CCHARDET
+
+CCHARDET_DESC=			Use cchardet instead of chardet
+CCHARDET_RUN_DEPENDS=		${PYTHON_PKGNAMEPREFIX}cchardet>0:textproc/py-cchardet@${PY_FLAVOR}
+CCHARDET_RUN_DEPENDS_OFF=	${PYTHON_PKGNAMEPREFIX}chardet>0:textproc/py-chardet@${PY_FLAVOR}
+
+.include <bsd.port.mk>
diff --git a/www/py-readability-lxml/distinfo b/www/py-readability-lxml/distinfo
new file mode 100644
index 000000000000..bad18bd38808
--- /dev/null
+++ b/www/py-readability-lxml/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1691368002
+SHA256 (readability-lxml-0.8.1.tar.gz) = e51fea56b5909aaf886d307d48e79e096293255afa567b7d08bca94d25b1a4e1
+SIZE (readability-lxml-0.8.1.tar.gz) = 15878
diff --git a/www/py-readability-lxml/files/patch-readability_compat_two.py b/www/py-readability-lxml/files/patch-readability_compat_two.py
new file mode 100644
index 000000000000..faf554014211
--- /dev/null
+++ b/www/py-readability-lxml/files/patch-readability_compat_two.py
@@ -0,0 +1,11 @@
+Disable some python-2.x code with invalid syntax in python-3.x.
+
+--- readability/compat/two.py.orig	2020-07-03 23:38:42 UTC
++++ readability/compat/two.py
+@@ -2,5 +2,5 @@ def raise_with_traceback(exc_type, traceback, *args, *
+     """
+     Raise a new exception of type `exc_type` with an existing `traceback`. All
+     additional (keyword-)arguments are forwarded to `exc_type`
+-    """
+     raise exc_type(*args, **kwargs), None, traceback
++    """
diff --git a/www/py-readability-lxml/pkg-descr b/www/py-readability-lxml/pkg-descr
new file mode 100644
index 000000000000..e18a1660213f
--- /dev/null
+++ b/www/py-readability-lxml/pkg-descr
@@ -0,0 +1,2 @@
+Fast HTML to text parser (article readability tool).
+Given an HTML document, it pulls out the main body text and cleans it up.