git: 5389ede7571f - main - devel/py-unittest2: Relax USES=python

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Thu, 07 Jul 2022 12:37:29 UTC
The branch main has been updated by sunpoet:

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

commit 5389ede7571f23a7482356c8ce4f8c637f695e97
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-07-07 12:22:24 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-07-07 12:36:16 +0000

    devel/py-unittest2: Relax USES=python
    
    - Allow build with Python 3.10+
---
 devel/py-unittest2/Makefile                    | 10 ++++++++--
 devel/py-unittest2/files/extra-patch-python310 | 11 +++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/devel/py-unittest2/Makefile b/devel/py-unittest2/Makefile
index 58594eba2fe2..ac6af83a614a 100644
--- a/devel/py-unittest2/Makefile
+++ b/devel/py-unittest2/Makefile
@@ -15,12 +15,18 @@ BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}six>=1.4:devel/py-six@${PY_FLAVOR} \
 RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}six>=1.4:devel/py-six@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}traceback2>=0:devel/py-traceback2@${PY_FLAVOR}
 
-USES=		python:3.7-3.9
+USES=		python:3.7+
 USE_PYTHON=	autoplist concurrent distutils
 
 NO_ARCH=	yes
 
+.include <bsd.port.pre.mk>
+
+.if ${PYTHON_REL} >= 31000
+EXTRA_PATCHES+=	${PATCHDIR}/extra-patch-python310
+.endif
+
 do-test:
 	cd ${WRKSRC} && ${PYTHON_CMD} -m unittest2 -v
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/devel/py-unittest2/files/extra-patch-python310 b/devel/py-unittest2/files/extra-patch-python310
new file mode 100644
index 000000000000..cb6342052da1
--- /dev/null
+++ b/devel/py-unittest2/files/extra-patch-python310
@@ -0,0 +1,11 @@
+--- unittest2/compatibility.py.orig	2014-10-29 10:51:58 UTC
++++ unittest2/compatibility.py
+@@ -140,7 +140,7 @@ except ImportError:
+ ###  ChainMap (helper for configparser and string.Template)
+ ########################################################################
+ 
+-class ChainMap(collections.MutableMapping):
++class ChainMap(collections.abc.MutableMapping):
+     ''' A ChainMap groups multiple dicts (or other mappings) together
+     to create a single, updateable view.
+