Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/botocore/, dev-python/botocore/files/
Date: Sat, 14 May 2022 20:01:47
Message-Id: 1652558496.06ff6a9f5b674e2467de74200639fe6dde7f7c74.mgorny@gentoo
1 commit: 06ff6a9f5b674e2467de74200639fe6dde7f7c74
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 14 14:35:21 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat May 14 20:01:36 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06ff6a9f
7
8 dev-python/botocore: Enable py3.11
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/botocore/botocore-1.26.0.ebuild | 3 +-
13 dev-python/botocore/botocore-9999.ebuild | 3 +-
14 .../botocore/files/botocore-1.26.0-py311.patch | 54 ++++++++++++++++++++++
15 3 files changed, 58 insertions(+), 2 deletions(-)
16
17 diff --git a/dev-python/botocore/botocore-1.26.0.ebuild b/dev-python/botocore/botocore-1.26.0.ebuild
18 index a1a5a4e1ea37..f9d3152de4e1 100644
19 --- a/dev-python/botocore/botocore-1.26.0.ebuild
20 +++ b/dev-python/botocore/botocore-1.26.0.ebuild
21 @@ -4,7 +4,7 @@
22 EAPI=8
23
24 DISTUTILS_USE_PEP517=setuptools
25 -PYTHON_COMPAT=( python3_{8..10} )
26 +PYTHON_COMPAT=( python3_{8..11} )
27
28 inherit distutils-r1 multiprocessing
29
30 @@ -39,6 +39,7 @@ BDEPEND="
31
32 PATCHES=(
33 "${FILESDIR}/1.8.6-tests-pass-all-env-vars-to-cmd-runner.patch"
34 + "${FILESDIR}/botocore-1.26.0-py311.patch"
35 )
36
37 distutils_enable_sphinx docs/source \
38
39 diff --git a/dev-python/botocore/botocore-9999.ebuild b/dev-python/botocore/botocore-9999.ebuild
40 index a1a5a4e1ea37..f9d3152de4e1 100644
41 --- a/dev-python/botocore/botocore-9999.ebuild
42 +++ b/dev-python/botocore/botocore-9999.ebuild
43 @@ -4,7 +4,7 @@
44 EAPI=8
45
46 DISTUTILS_USE_PEP517=setuptools
47 -PYTHON_COMPAT=( python3_{8..10} )
48 +PYTHON_COMPAT=( python3_{8..11} )
49
50 inherit distutils-r1 multiprocessing
51
52 @@ -39,6 +39,7 @@ BDEPEND="
53
54 PATCHES=(
55 "${FILESDIR}/1.8.6-tests-pass-all-env-vars-to-cmd-runner.patch"
56 + "${FILESDIR}/botocore-1.26.0-py311.patch"
57 )
58
59 distutils_enable_sphinx docs/source \
60
61 diff --git a/dev-python/botocore/files/botocore-1.26.0-py311.patch b/dev-python/botocore/files/botocore-1.26.0-py311.patch
62 new file mode 100644
63 index 000000000000..8caa8765c008
64 --- /dev/null
65 +++ b/dev-python/botocore/files/botocore-1.26.0-py311.patch
66 @@ -0,0 +1,54 @@
67 +From 46a3d92e29a03f547d85861bb6e21281b6a42e60 Mon Sep 17 00:00:00 2001
68 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
69 +Date: Sat, 14 May 2022 19:38:23 +0200
70 +Subject: [PATCH] Replace deprecated inspect.formatargspec() with
71 + inspect.signature()
72 +
73 +Originally submitted by Hugo van Kemenade as #2507. Modified by me
74 +to remove the first positional parameter like the old code did.
75 +---
76 + botocore/docs/method.py | 21 +++++++++++++--------
77 + 1 file changed, 13 insertions(+), 8 deletions(-)
78 +
79 +diff --git a/botocore/docs/method.py b/botocore/docs/method.py
80 +index 0f7c60f6c..44c97d6e4 100644
81 +--- a/botocore/docs/method.py
82 ++++ b/botocore/docs/method.py
83 +@@ -11,6 +11,7 @@
84 + # ANY KIND, either express or implied. See the License for the specific
85 + # language governing permissions and limitations under the License.
86 + import inspect
87 ++import types
88 +
89 + from botocore.docs.example import (
90 + RequestExampleDocumenter,
91 +@@ -101,14 +102,18 @@ def document_custom_signature(
92 + :param exclude: The names of the parameters to exclude from
93 + documentation.
94 + """
95 +- argspec = inspect.getfullargspec(method)
96 +- signature_params = inspect.formatargspec(
97 +- args=argspec.args[1:],
98 +- varargs=argspec.varargs,
99 +- varkw=argspec.varkw,
100 +- defaults=argspec.defaults,
101 +- )
102 +- signature_params = signature_params.lstrip('(')
103 ++ signature = inspect.signature(method)
104 ++ # "raw" class methods are FunctionType and they include "self" param
105 ++ # object methods are MethodType and they skip the "self" param
106 ++ if isinstance(method, types.FunctionType):
107 ++ self_param = next(iter(signature.parameters))
108 ++ self_kind = signature.parameters[self_param].kind
109 ++ # safety check that we got the right parameter
110 ++ assert self_kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
111 ++ new_params = signature.parameters.copy()
112 ++ del new_params[self_param]
113 ++ signature = signature.replace(parameters=new_params.values())
114 ++ signature_params = str(signature).lstrip('(')
115 + signature_params = signature_params.rstrip(')')
116 + section.style.start_sphinx_py_method(name, signature_params)
117 +
118 +--
119 +2.35.1
120 +