git: b68611e8582f - main - net/py-urllib31: Add py-urllib31 1.26.20 (copied from py-urllib3)

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Tue, 02 Sep 2025 18:13:20 UTC
The branch main has been updated by sunpoet:

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

commit b68611e8582f587ff6c40aeb6c7d53fed3317a66
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2025-09-02 17:58:13 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2025-09-02 17:58:13 +0000

    net/py-urllib31: Add py-urllib31 1.26.20 (copied from py-urllib3)
    
    - Add PORTSCOUT
---
 net/Makefile                          |  1 +
 net/py-urllib31/Makefile              | 50 +++++++++++++++++++++++++++++++++++
 net/py-urllib31/distinfo              |  3 +++
 net/py-urllib31/files/patch-setup.cfg | 11 ++++++++
 net/py-urllib31/files/pkg-message.in  | 21 +++++++++++++++
 net/py-urllib31/pkg-descr             | 11 ++++++++
 6 files changed, 97 insertions(+)

diff --git a/net/Makefile b/net/Makefile
index 4b809548529a..9d9795a651ce 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -1194,6 +1194,7 @@
     SUBDIR += py-urlextract
     SUBDIR += py-urllib3
     SUBDIR += py-urllib3-future
+    SUBDIR += py-urllib31
     SUBDIR += py-whois
     SUBDIR += py-wmi-query
     SUBDIR += py-wsdd
diff --git a/net/py-urllib31/Makefile b/net/py-urllib31/Makefile
new file mode 100644
index 000000000000..c452313a1952
--- /dev/null
+++ b/net/py-urllib31/Makefile
@@ -0,0 +1,50 @@
+PORTNAME=	urllib3
+PORTVERSION=	1.26.20
+CATEGORIES=	net python
+MASTER_SITES=	PYPI \
+		https://github.com/urllib3/urllib3/releases/download/${PORTVERSION}/
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+PKGNAMESUFFIX=	1
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	HTTP library with thread-safe connection pooling, file post, and more
+WWW=		https://urllib3.readthedocs.io/en/stable/ \
+		https://github.com/urllib3/urllib3
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}flaky>=3.6.1:devel/py-flaky@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}mock>=0:devel/py-mock@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pysocks>=1.5.6:net/py-pysocks@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-timeout>=0:devel/py-pytest-timeout@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}python-dateutil>=2.8.1:devel/py-python-dateutil@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tornado>=0:www/py-tornado@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}trustme>=0.6.0:security/py-trustme@${PY_FLAVOR}
+
+USES=		cpe python
+USE_PYTHON=	autoplist concurrent cryptography_test pep517 pytest
+
+NO_ARCH=	yes
+PYTEST_IGNORED_TESTS=	test_ssl_read_timeout
+TEST_ENV=	LC_ALL=en_US.UTF-8 PYTHONPATH=${WRKSRC}/src
+
+SUB_FILES=	pkg-message
+
+CPE_VENDOR=	python
+
+PORTSCOUT=	limit:^1\.
+
+OPTIONS_DEFINE=	BROTLI SOCKS SSL
+OPTIONS_DEFAULT=SOCKS
+
+BROTLI_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}brotli>=1.0.9:archivers/py-brotli@${PY_FLAVOR}
+SOCKS_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pysocks>=1.5.6<2.0:net/py-pysocks@${PY_FLAVOR}
+SSL_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}certifi>=0:security/py-certifi@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}idna>=2.0.0:dns/py-idna@${PY_FLAVOR} \
+			${PYTHON_PKGNAMEPREFIX}openssl>=0.14:security/py-openssl@${PY_FLAVOR}
+SSL_USE=		PYTHON=cryptography
+
+.include <bsd.port.mk>
diff --git a/net/py-urllib31/distinfo b/net/py-urllib31/distinfo
new file mode 100644
index 000000000000..5db8b2278da2
--- /dev/null
+++ b/net/py-urllib31/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1725560881
+SHA256 (urllib3-1.26.20.tar.gz) = 40c2dc0c681e47eb8f90e7e27bf6ff7df2e677421fd46756da1161c39ca70d32
+SIZE (urllib3-1.26.20.tar.gz) = 307380
diff --git a/net/py-urllib31/files/patch-setup.cfg b/net/py-urllib31/files/patch-setup.cfg
new file mode 100644
index 000000000000..8e92a5d7e5b8
--- /dev/null
+++ b/net/py-urllib31/files/patch-setup.cfg
@@ -0,0 +1,11 @@
+--- setup.cfg.orig	2024-08-29 15:36:43 UTC
++++ setup.cfg
+@@ -7,7 +7,7 @@ universal = 1
+ universal = 1
+ 
+ [metadata]
+-license_file = LICENSE.txt
++license_files = LICENSE.txt
+ provides_extra = 
+ 	secure
+ 	socks
diff --git a/net/py-urllib31/files/pkg-message.in b/net/py-urllib31/files/pkg-message.in
new file mode 100644
index 000000000000..4aa5b9e1f1d9
--- /dev/null
+++ b/net/py-urllib31/files/pkg-message.in
@@ -0,0 +1,21 @@
+[
+{ 
+  message: <<EOM
+Since version 1.25 HTTPS connections are now verified by default which is done
+via "cert_reqs = 'CERT_REQUIRED'".  While certificate verification can be
+disabled via "cert_reqs = 'CERT_NONE'", it's highly recommended to leave it on.
+
+Various consumers of net/py-urllib3 already have implemented routines that
+either explicitly enable or disable HTTPS certificate verification (e.g. via
+configuration settings, CLI arguments, etc.).
+
+Yet it may happen that there are still some consumers which don't explicitly
+enable/disable certificate verification for HTTPS connections which could then
+lead to errors (as is often the case with self-signed certificates).
+
+In case of an error one should try first to temporarily disable certificate
+verification of the problematic urllib3 consumer to see if that approach will
+remedy the issue.
+EOM
+}
+]
diff --git a/net/py-urllib31/pkg-descr b/net/py-urllib31/pkg-descr
new file mode 100644
index 000000000000..c6003d7494ba
--- /dev/null
+++ b/net/py-urllib31/pkg-descr
@@ -0,0 +1,11 @@
+urllib3 is a powerful, sanity-friendly HTTP client for Python. Much of the
+Python ecosystem already uses urllib3 and you should too. urllib3 brings many
+critical features that are missing from the Python standard libraries:
+- Thread safety.
+- Connection pooling.
+- Client-side SSL/TLS verification.
+- File uploads with multipart encoding.
+- Helpers for retrying requests and dealing with HTTP redirects.
+- Support for gzip and deflate encoding.
+- Proxy support for HTTP and SOCKS.
+- 100% test coverage.