commit:     f4b265b211168f2e33f3fc49a05b58e89b18744d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 18:44:20 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May 23 04:54:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4b265b2

dev-python/cherrypy: Enable py3.11

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/cherrypy/cherrypy-18.6.1-r1.ebuild      | 14 +++++++++-
 .../cherrypy/files/cherrypy-18.6.1-py311.patch     | 32 ++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/dev-python/cherrypy/cherrypy-18.6.1-r1.ebuild 
b/dev-python/cherrypy/cherrypy-18.6.1-r1.ebuild
index 85965bd7d707..ddcd4181ee8c 100644
--- a/dev-python/cherrypy/cherrypy-18.6.1-r1.ebuild
+++ b/dev-python/cherrypy/cherrypy-18.6.1-r1.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} pypy3 )
+PYTHON_COMPAT=( python3_{8..11} pypy3 )
 
 inherit distutils-r1
 
@@ -52,6 +52,7 @@ python_prepare_all() {
        local PATCHES=(
                # https://github.com/cherrypy/cherrypy/pull/1946
                "${FILESDIR}"/${P}-close-files.patch
+               "${FILESDIR}"/${P}-py311.patch
        )
 
        sed -r -e '/(pytest-sugar|pytest-cov)/ d' \
@@ -64,3 +65,14 @@ python_prepare_all() {
 
        distutils-r1_python_prepare_all
 }
+
+python_test() {
+       local EPYTEST_DESELECT=()
+       [[ ${EPYTHON} == python3.11 ]] && EPYTEST_DESELECT+=(
+               # broken by changes in traceback output
+               
cherrypy/test/test_request_obj.py::RequestObjectTests::testErrorHandling
+               cherrypy/test/test_tools.py::ToolTests::testHookErrors
+       )
+
+       epytest
+}

diff --git a/dev-python/cherrypy/files/cherrypy-18.6.1-py311.patch 
b/dev-python/cherrypy/files/cherrypy-18.6.1-py311.patch
new file mode 100644
index 000000000000..5d629dd8c333
--- /dev/null
+++ b/dev-python/cherrypy/files/cherrypy-18.6.1-py311.patch
@@ -0,0 +1,32 @@
+From 8245a74aa4e090c40445535a9ce3997ed9904798 Mon Sep 17 00:00:00 2001
+From: Dominic Davis-Foster <[email protected]>
+Date: Fri, 28 Jan 2022 23:11:52 +0000
+Subject: [PATCH] Switch from inspect.getargspec to inspect.getfullargspec
+
+inspect.getargspec has been deprecated since 3.0
+---
+ cherrypy/_cpdispatch.py | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/cherrypy/_cpdispatch.py b/cherrypy/_cpdispatch.py
+index 83eb79cb..5c506e99 100644
+--- a/cherrypy/_cpdispatch.py
++++ b/cherrypy/_cpdispatch.py
+@@ -206,12 +206,8 @@ except ImportError:
+     def test_callable_spec(callable, args, kwargs):  # noqa: F811
+         return None
+ else:
+-    getargspec = inspect.getargspec
+-    # Python 3 requires using getfullargspec if
+-    # keyword-only arguments are present
+-    if hasattr(inspect, 'getfullargspec'):
+-        def getargspec(callable):
+-            return inspect.getfullargspec(callable)[:4]
++    def getargspec(callable):
++        return inspect.getfullargspec(callable)[:4]
+ 
+ 
+ class LateParamPageHandler(PageHandler):
+-- 
+2.35.1
+

Reply via email to