commit:     06ff6a9f5b674e2467de74200639fe6dde7f7c74
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 14 14:35:21 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 14 20:01:36 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06ff6a9f

dev-python/botocore: Enable py3.11

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

 dev-python/botocore/botocore-1.26.0.ebuild         |  3 +-
 dev-python/botocore/botocore-9999.ebuild           |  3 +-
 .../botocore/files/botocore-1.26.0-py311.patch     | 54 ++++++++++++++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/dev-python/botocore/botocore-1.26.0.ebuild 
b/dev-python/botocore/botocore-1.26.0.ebuild
index a1a5a4e1ea37..f9d3152de4e1 100644
--- a/dev-python/botocore/botocore-1.26.0.ebuild
+++ b/dev-python/botocore/botocore-1.26.0.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 
 inherit distutils-r1 multiprocessing
 
@@ -39,6 +39,7 @@ BDEPEND="
 
 PATCHES=(
        "${FILESDIR}/1.8.6-tests-pass-all-env-vars-to-cmd-runner.patch"
+       "${FILESDIR}/botocore-1.26.0-py311.patch"
 )
 
 distutils_enable_sphinx docs/source \

diff --git a/dev-python/botocore/botocore-9999.ebuild 
b/dev-python/botocore/botocore-9999.ebuild
index a1a5a4e1ea37..f9d3152de4e1 100644
--- a/dev-python/botocore/botocore-9999.ebuild
+++ b/dev-python/botocore/botocore-9999.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 
 inherit distutils-r1 multiprocessing
 
@@ -39,6 +39,7 @@ BDEPEND="
 
 PATCHES=(
        "${FILESDIR}/1.8.6-tests-pass-all-env-vars-to-cmd-runner.patch"
+       "${FILESDIR}/botocore-1.26.0-py311.patch"
 )
 
 distutils_enable_sphinx docs/source \

diff --git a/dev-python/botocore/files/botocore-1.26.0-py311.patch 
b/dev-python/botocore/files/botocore-1.26.0-py311.patch
new file mode 100644
index 000000000000..8caa8765c008
--- /dev/null
+++ b/dev-python/botocore/files/botocore-1.26.0-py311.patch
@@ -0,0 +1,54 @@
+From 46a3d92e29a03f547d85861bb6e21281b6a42e60 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Sat, 14 May 2022 19:38:23 +0200
+Subject: [PATCH] Replace deprecated inspect.formatargspec() with
+ inspect.signature()
+
+Originally submitted by Hugo van Kemenade as #2507.  Modified by me
+to remove the first positional parameter like the old code did.
+---
+ botocore/docs/method.py | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/botocore/docs/method.py b/botocore/docs/method.py
+index 0f7c60f6c..44c97d6e4 100644
+--- a/botocore/docs/method.py
++++ b/botocore/docs/method.py
+@@ -11,6 +11,7 @@
+ # ANY KIND, either express or implied. See the License for the specific
+ # language governing permissions and limitations under the License.
+ import inspect
++import types
+ 
+ from botocore.docs.example import (
+     RequestExampleDocumenter,
+@@ -101,14 +102,18 @@ def document_custom_signature(
+     :param exclude: The names of the parameters to exclude from
+         documentation.
+     """
+-    argspec = inspect.getfullargspec(method)
+-    signature_params = inspect.formatargspec(
+-        args=argspec.args[1:],
+-        varargs=argspec.varargs,
+-        varkw=argspec.varkw,
+-        defaults=argspec.defaults,
+-    )
+-    signature_params = signature_params.lstrip('(')
++    signature = inspect.signature(method)
++    # "raw" class methods are FunctionType and they include "self" param
++    # object methods are MethodType and they skip the "self" param
++    if isinstance(method, types.FunctionType):
++        self_param = next(iter(signature.parameters))
++        self_kind = signature.parameters[self_param].kind
++        # safety check that we got the right parameter
++        assert self_kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
++        new_params = signature.parameters.copy()
++        del new_params[self_param]
++        signature = signature.replace(parameters=new_params.values())
++    signature_params = str(signature).lstrip('(')
+     signature_params = signature_params.rstrip(')')
+     section.style.start_sphinx_py_method(name, signature_params)
+ 
+-- 
+2.35.1
+

Reply via email to