1 |
commit: 75de7f050246aaad0bf29cd909fc729b7d8fe417 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 13 13:13:31 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 13 13:14:18 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75de7f05 |
7 |
|
8 |
dev-python/m2crypto: Enable py3.10 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
.../m2crypto/files/m2crypto-0.37.1-py310.patch | 119 +++++++++++++++++++++ |
13 |
dev-python/m2crypto/m2crypto-0.37.1-r1.ebuild | 3 +- |
14 |
2 files changed, 121 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/dev-python/m2crypto/files/m2crypto-0.37.1-py310.patch b/dev-python/m2crypto/files/m2crypto-0.37.1-py310.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..f9be349fc3d |
19 |
--- /dev/null |
20 |
+++ b/dev-python/m2crypto/files/m2crypto-0.37.1-py310.patch |
21 |
@@ -0,0 +1,119 @@ |
22 |
+diff --git a/SWIG/_bio.i b/SWIG/_bio.i |
23 |
+index 84b76b3..6c090a4 100644 |
24 |
+--- a/SWIG/_bio.i |
25 |
++++ b/SWIG/_bio.i |
26 |
+@@ -246,8 +246,8 @@ PyObject *bio_set_cipher(BIO *b, EVP_CIPHER *c, PyObject *key, PyObject *iv, int |
27 |
+ const void *kbuf, *ibuf; |
28 |
+ Py_ssize_t klen, ilen; |
29 |
+ |
30 |
+- if ((PyObject_AsReadBuffer(key, &kbuf, &klen) == -1) |
31 |
+- || (PyObject_AsReadBuffer(iv, &ibuf, &ilen) == -1)) |
32 |
++ if ((m2_PyObject_AsReadBuffer(key, &kbuf, &klen) == -1) |
33 |
++ || (m2_PyObject_AsReadBuffer(iv, &ibuf, &ilen) == -1)) |
34 |
+ return NULL; |
35 |
+ |
36 |
+ BIO_set_cipher(b, (const EVP_CIPHER *)c, |
37 |
+diff --git a/SWIG/_ec.i b/SWIG/_ec.i |
38 |
+index f47d593..a492f6f 100644 |
39 |
+--- a/SWIG/_ec.i |
40 |
++++ b/SWIG/_ec.i |
41 |
+@@ -466,7 +466,7 @@ EC_KEY* ec_key_from_pubkey_der(PyObject *pubkey) { |
42 |
+ const unsigned char *tempBuf; |
43 |
+ EC_KEY *keypair; |
44 |
+ |
45 |
+- if (PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1) |
46 |
++ if (m2_PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1) |
47 |
+ { |
48 |
+ return NULL; |
49 |
+ } |
50 |
+@@ -486,7 +486,7 @@ EC_KEY* ec_key_from_pubkey_params(int nid, PyObject *pubkey) { |
51 |
+ const unsigned char *tempBuf; |
52 |
+ EC_KEY *keypair; |
53 |
+ |
54 |
+- if (PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1) |
55 |
++ if (m2_PyObject_AsReadBuffer(pubkey, &keypairbuf, &keypairbuflen) == -1) |
56 |
+ { |
57 |
+ return NULL; |
58 |
+ } |
59 |
+diff --git a/SWIG/_lib.i b/SWIG/_lib.i |
60 |
+index 954e99b..351134b 100644 |
61 |
+--- a/SWIG/_lib.i |
62 |
++++ b/SWIG/_lib.i |
63 |
+@@ -137,8 +137,8 @@ m2_PyObject_AsReadBuffer(PyObject * obj, const void **buffer, |
64 |
+ len = view.len; |
65 |
+ } |
66 |
+ } else { |
67 |
+- if ((ret = PyObject_AsReadBuffer(obj, buffer, &len)) != 0) |
68 |
+- return ret; |
69 |
++ PyErr_SetString(PyExc_TypeError, "expected a readable buffer object"); |
70 |
++ return -1; |
71 |
+ } |
72 |
+ if (len > INT_MAX) { |
73 |
+ m2_PyBuffer_Release(obj, &view); |
74 |
+@@ -171,11 +171,8 @@ static int m2_PyObject_GetBufferInt(PyObject *obj, Py_buffer *view, int flags) |
75 |
+ if (PyObject_CheckBuffer(obj)) |
76 |
+ ret = PyObject_GetBuffer(obj, view, flags); |
77 |
+ else { |
78 |
+- const void *buf; |
79 |
+- |
80 |
+- ret = PyObject_AsReadBuffer(obj, &buf, &view->len); |
81 |
+- if (ret == 0) |
82 |
+- view->buf = (void *)buf; |
83 |
++ PyErr_SetString(PyExc_TypeError, "expected a readable buffer object"); |
84 |
++ return -1; |
85 |
+ } |
86 |
+ if (ret) |
87 |
+ return ret; |
88 |
+@@ -633,7 +630,7 @@ BIGNUM *hex_to_bn(PyObject *value) { |
89 |
+ } |
90 |
+ } |
91 |
+ else { |
92 |
+- if (PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1) |
93 |
++ if (m2_PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1) |
94 |
+ return NULL; |
95 |
+ } |
96 |
+ |
97 |
+@@ -665,7 +662,7 @@ BIGNUM *dec_to_bn(PyObject *value) { |
98 |
+ } |
99 |
+ } |
100 |
+ else { |
101 |
+- if (PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1) |
102 |
++ if (m2_PyObject_AsReadBuffer(value, &vbuf, &vlen) == -1) |
103 |
+ return NULL; |
104 |
+ } |
105 |
+ |
106 |
+diff --git a/SWIG/_rc4.i b/SWIG/_rc4.i |
107 |
+index eb4747e..6af2dc6 100644 |
108 |
+--- a/SWIG/_rc4.i |
109 |
++++ b/SWIG/_rc4.i |
110 |
+@@ -46,7 +46,7 @@ PyObject *rc4_update(RC4_KEY *key, PyObject *in) { |
111 |
+ Py_ssize_t len; |
112 |
+ void *out; |
113 |
+ |
114 |
+- if (PyObject_AsReadBuffer(in, &buf, &len) == -1) |
115 |
++ if (m2_PyObject_AsReadBuffer(in, &buf, &len) == -1) |
116 |
+ return NULL; |
117 |
+ |
118 |
+ if (!(out = PyMem_Malloc(len))) { |
119 |
+diff --git a/SWIG/_util.i b/SWIG/_util.i |
120 |
+index bc2ee61..18e446a 100644 |
121 |
+--- a/SWIG/_util.i |
122 |
++++ b/SWIG/_util.i |
123 |
+@@ -22,7 +22,7 @@ PyObject *util_hex_to_string(PyObject *blob) { |
124 |
+ char *ret; |
125 |
+ Py_ssize_t len; |
126 |
+ |
127 |
+- if (PyObject_AsReadBuffer(blob, &buf, &len) == -1) |
128 |
++ if (m2_PyObject_AsReadBuffer(blob, &buf, &len) == -1) |
129 |
+ return NULL; |
130 |
+ |
131 |
+ ret = hex_to_string((unsigned char *)buf, len); |
132 |
+@@ -44,7 +44,7 @@ PyObject *util_string_to_hex(PyObject *blob) { |
133 |
+ Py_ssize_t len0; |
134 |
+ long len; |
135 |
+ |
136 |
+- if (PyObject_AsReadBuffer(blob, &buf, &len0) == -1) |
137 |
++ if (m2_PyObject_AsReadBuffer(blob, &buf, &len0) == -1) |
138 |
+ return NULL; |
139 |
+ |
140 |
+ len = len0; |
141 |
|
142 |
diff --git a/dev-python/m2crypto/m2crypto-0.37.1-r1.ebuild b/dev-python/m2crypto/m2crypto-0.37.1-r1.ebuild |
143 |
index b6c17695032..86a23528664 100644 |
144 |
--- a/dev-python/m2crypto/m2crypto-0.37.1-r1.ebuild |
145 |
+++ b/dev-python/m2crypto/m2crypto-0.37.1-r1.ebuild |
146 |
@@ -3,7 +3,7 @@ |
147 |
|
148 |
EAPI=7 |
149 |
|
150 |
-PYTHON_COMPAT=( python3_{7..9} ) |
151 |
+PYTHON_COMPAT=( python3_{8..10} ) |
152 |
PYTHON_REQ_USE="threads(+)" |
153 |
|
154 |
inherit distutils-r1 toolchain-funcs |
155 |
@@ -31,6 +31,7 @@ DEPEND="${RDEPEND}" |
156 |
|
157 |
PATCHES=( |
158 |
"${FILESDIR}/${P}-openssl-fixes.patch" |
159 |
+ "${FILESDIR}/${P}-py310.patch" |
160 |
) |
161 |
|
162 |
swig_define() { |