1 |
commit: d85f7e4bb1eec740f14e28567e7695adc9df5d6b |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 29 11:02:16 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 29 11:32:11 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/python.git/commit/?id=d85f7e4b |
7 |
|
8 |
dev-lang/python: Bump 3.4.10 to EAPI 7 and redo patchset |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-lang/python/Manifest | 2 +- |
13 |
dev-lang/python/files/3.4-getentropy-linux.patch | 40 - |
14 |
dev-lang/python/files/3.6-disable-nis.patch | 25 - |
15 |
.../python/files/python-3.4.10-openssl11.patch | 894 --------------------- |
16 |
dev-lang/python/files/python-3.4.5-cross.patch | 11 - |
17 |
.../python/files/python-3.5.5-hash-unaligned.patch | 48 -- |
18 |
dev-lang/python/python-3.4.10.ebuild | 173 ++-- |
19 |
7 files changed, 80 insertions(+), 1113 deletions(-) |
20 |
|
21 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
22 |
index 39ffe3c..17ea2a0 100644 |
23 |
--- a/dev-lang/python/Manifest |
24 |
+++ b/dev-lang/python/Manifest |
25 |
@@ -3,5 +3,5 @@ DIST Python-3.2.6.tar.xz 9243292 SHA256 1d12b501819fd26afafbf8459be1aa279b56f032 |
26 |
DIST Python-3.3.5.tar.xz 12116308 SHA256 abe99b484434503d8b23be0f243ec27139e743a4798cd71c1dce3cf40e63b6e5 SHA512 562ebd85291f29ff18d37f05682763fc45aa9d070688006f4ef5c89392a48022357c3ca9ee1d795e9e863bdef413e6bab77b8d65581d374a76dbe7cacec65550 WHIRLPOOL f4b6010d32b28b7bb038cbb7c5f98d325cc4253fd1be9a0a1089ed6fd7dd414c5169931d21ef819137d5c1084517a650828f260cf2a1d8ce871bc67aeef3fff8 |
27 |
DIST Python-3.4.10.tar.xz 14559088 SHA256 d46a8f6fe91679e199c671b1b0a30aaf172d2acb5bcab25beb35f16c3d195b4e SHA512 d5d27d68049b61f135e21b12a800dbd4fc521d6935de178de6e2e88a989cda511d3c8fead90d14e38d2db0e528a74b22674e0da01c51ff4fad7d335ec6c3dbbc WHIRLPOOL 84608931cd785eddd234d207be2caa273575067d7687a0ed05217e2f2ae410da684fcf5ed65cfa17dd8eda082844bb4067cdcb4a277ceb20845ffa9f3baa6f58 |
28 |
DIST Python-3.5.9.tar.xz 15388876 SHA256 c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049 SHA512 58127793adef42ed57ae4d56338268866e14c2d084f09f57f26fc6b1c9454e70cc6d3dffc638f8d56f182acc0884021a4dbb578f312dd6fc01995fa85e31377e WHIRLPOOL 16f4a6938ed1004cbb10a9b60621d70f8e52a36771fbb55cf5fb3211ad98daa2c9cf181789c226d51c4f65cefce056dfff73031f61c1ce35e96e24bd2db186b3 |
29 |
-DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 SHA256 93e7c8487deefc36c612403fb6c82e495c46846a1952f9ed85f82af41840be4a SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab WHIRLPOOL 851945e7ccea985a88bcbd71bc404bc34c27a0e335386e9ed15fa9876aab3285ff559936fb2dcadf7ac0594a7cb03ac3a9e4135b67b350c5fdf33e9a44ca0654 |
30 |
+DIST python-gentoo-patches-3.4.10.tar.xz 21340 SHA256 12d291ac445fe76bcb5e391de7f88308b2509a27e05b7559c6a1a6636b0f74c5 SHA512 27ee476c080a0d1c012ef5d3d8325db6e697e1c3d9611f0337668f3660a50e50e6529bd0fd8b3b5b6030c9be8f8a86d95fa59bc27085ce7d18a7e0b50afe9f4b WHIRLPOOL 81cd55b8696026a8832ae1e89f2ff137ff1b20c5d675a148b4a1e3bd761d938c5a67e36284377cfa4850381f4f3c451f4d7dbc309dbd0390ecdc62c6edcd1f25 |
31 |
DIST python-gentoo-patches-3.5.9.tar.xz 13548 SHA256 97d1252935e398a31ed3634f50b70ed17b38bd8c5ea10fad601912ca58fdee5f SHA512 def5435a315e58d3794d8bce8fb04105a36ff37bd90a437cf7588a0c0ec8d420af5b68009ab153823286e71e52056e12a0eba4dc4d958eeb8d6b914b24f0de81 WHIRLPOOL 139ffbd3aa2ca349f1b8254d7326942111b448d2b2c8649a37550fb1f5095fed488c0a2748120a8b39b514502b25ac9fcc9bf2130da7927e19d11e8fd649ade8 |
32 |
|
33 |
diff --git a/dev-lang/python/files/3.4-getentropy-linux.patch b/dev-lang/python/files/3.4-getentropy-linux.patch |
34 |
deleted file mode 100644 |
35 |
index 9f12389..0000000 |
36 |
--- a/dev-lang/python/files/3.4-getentropy-linux.patch |
37 |
+++ /dev/null |
38 |
@@ -1,40 +0,0 @@ |
39 |
-From 5635d44079e1bbd9c495951ede8d078e7b8d67d5 Mon Sep 17 00:00:00 2001 |
40 |
-From: Victor Stinner <victor.stinner@×××××.com> |
41 |
-Date: Mon, 9 Jan 2017 11:10:41 +0100 |
42 |
-Subject: [PATCH] Don't use getentropy() on Linux |
43 |
- |
44 |
-Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but |
45 |
-read from /dev/urandom to get random bytes, for example in os.urandom(). On |
46 |
-Linux, getentropy() is implemented which getrandom() is blocking mode, whereas |
47 |
-os.urandom() should not block. |
48 |
---- |
49 |
- Python/random.c | 13 ++++++++++--- |
50 |
- 1 file changed, 10 insertions(+), 3 deletions(-) |
51 |
- |
52 |
-diff --git a/Python/random.c b/Python/random.c |
53 |
-index af3d0bd0d5..dc6400d3b8 100644 |
54 |
---- a/Python/random.c |
55 |
-+++ b/Python/random.c |
56 |
-@@ -67,9 +67,16 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) |
57 |
- return 0; |
58 |
- } |
59 |
- |
60 |
--/* Issue #25003: Don' use getentropy() on Solaris (available since |
61 |
-- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ |
62 |
--#elif defined(HAVE_GETENTROPY) && !defined(sun) |
63 |
-+/* Issue #25003: Don't use getentropy() on Solaris (available since |
64 |
-+ Solaris 11.3), it is blocking whereas os.urandom() should not block. |
65 |
-+ |
66 |
-+ Issue #29188: Don't use getentropy() on Linux since the glibc 2.24 |
67 |
-+ implements it with the getrandom() syscall which can fail with ENOSYS, |
68 |
-+ and this error is not supported in py_getentropy() and getrandom() is called |
69 |
-+ with flags=0 which blocks until system urandom is initialized, which is not |
70 |
-+ the desired behaviour to seed the Python hash secret nor for os.urandom(): |
71 |
-+ see the PEP 524 which was only implemented in Python 3.6. */ |
72 |
-+#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux) |
73 |
- #define PY_GETENTROPY 1 |
74 |
- |
75 |
- /* Fill buffer with size pseudo-random bytes generated by getentropy(). |
76 |
--- |
77 |
-2.15.0.rc2 |
78 |
- |
79 |
|
80 |
diff --git a/dev-lang/python/files/3.6-disable-nis.patch b/dev-lang/python/files/3.6-disable-nis.patch |
81 |
deleted file mode 100644 |
82 |
index ccfb890..0000000 |
83 |
--- a/dev-lang/python/files/3.6-disable-nis.patch |
84 |
+++ /dev/null |
85 |
@@ -1,25 +0,0 @@ |
86 |
-From 2ed81ae3d36c2e0dd709240169fdccd6b3cd1a27 Mon Sep 17 00:00:00 2001 |
87 |
-From: Mike Gilbert <floppym@g.o> |
88 |
-Date: Wed, 4 Jul 2018 11:39:21 -0400 |
89 |
-Subject: [PATCH 7/8] Disable nis |
90 |
---- a/setup.py |
91 |
-+++ b/setup.py |
92 |
-@@ -1332,17 +1332,7 @@ class PyBuildExt(build_ext): |
93 |
- # Jeremy Hylton's rlimit interface |
94 |
- exts.append( Extension('resource', ['resource.c']) ) |
95 |
- |
96 |
-- # Sun yellow pages. Some systems have the functions in libc. |
97 |
-- if (host_platform not in ['cygwin', 'qnx6'] and |
98 |
-- find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): |
99 |
-- if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
100 |
-- libs = ['nsl'] |
101 |
-- else: |
102 |
-- libs = [] |
103 |
-- exts.append( Extension('nis', ['nismodule.c'], |
104 |
-- libraries = libs) ) |
105 |
-- else: |
106 |
-- missing.append('nis') |
107 |
-+ missing.append('nis') |
108 |
- else: |
109 |
- missing.extend(['nis', 'resource', 'termios']) |
110 |
- |
111 |
|
112 |
diff --git a/dev-lang/python/files/python-3.4.10-openssl11.patch b/dev-lang/python/files/python-3.4.10-openssl11.patch |
113 |
deleted file mode 100644 |
114 |
index f5fe537..0000000 |
115 |
--- a/dev-lang/python/files/python-3.4.10-openssl11.patch |
116 |
+++ /dev/null |
117 |
@@ -1,894 +0,0 @@ |
118 |
-From 9c7a4d7baebfa84c2fa2deff7417871d96f714f2 Mon Sep 17 00:00:00 2001 |
119 |
-From: Christian Heimes <christian@××××××.org> |
120 |
-Date: Mon, 5 Sep 2016 23:19:05 +0200 |
121 |
-Subject: [PATCH] Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. |
122 |
- |
123 |
-(rebased for 3.4.10) |
124 |
---- |
125 |
- Lib/ssl.py | 15 ++-- |
126 |
- Lib/test/test_ssl.py | 27 +++--- |
127 |
- Modules/_hashopenssl.c | 167 +++++++++++++++++++++++-------------- |
128 |
- Modules/_ssl.c | 184 +++++++++++++++++++++++++++++++---------- |
129 |
- 4 files changed, 271 insertions(+), 122 deletions(-) |
130 |
- |
131 |
-diff --git a/Lib/ssl.py b/Lib/ssl.py |
132 |
-index 873aa4798b..359809a020 100644 |
133 |
---- a/Lib/ssl.py |
134 |
-+++ b/Lib/ssl.py |
135 |
-@@ -51,6 +51,7 @@ The following constants identify various SSL protocol variants: |
136 |
- PROTOCOL_SSLv2 |
137 |
- PROTOCOL_SSLv3 |
138 |
- PROTOCOL_SSLv23 |
139 |
-+PROTOCOL_TLS |
140 |
- PROTOCOL_TLSv1 |
141 |
- PROTOCOL_TLSv1_1 |
142 |
- PROTOCOL_TLSv1_2 |
143 |
-@@ -348,13 +349,13 @@ class SSLContext(_SSLContext): |
144 |
- __slots__ = ('protocol', '__weakref__') |
145 |
- _windows_cert_stores = ("CA", "ROOT") |
146 |
- |
147 |
-- def __new__(cls, protocol, *args, **kwargs): |
148 |
-+ def __new__(cls, protocol=PROTOCOL_TLS, *args, **kwargs): |
149 |
- self = _SSLContext.__new__(cls, protocol) |
150 |
- if protocol != _SSLv2_IF_EXISTS: |
151 |
- self.set_ciphers(_DEFAULT_CIPHERS) |
152 |
- return self |
153 |
- |
154 |
-- def __init__(self, protocol): |
155 |
-+ def __init__(self, protocol=PROTOCOL_TLS): |
156 |
- self.protocol = protocol |
157 |
- |
158 |
- def wrap_socket(self, sock, server_side=False, |
159 |
-@@ -408,7 +409,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, |
160 |
- if not isinstance(purpose, _ASN1Object): |
161 |
- raise TypeError(purpose) |
162 |
- |
163 |
-- context = SSLContext(PROTOCOL_SSLv23) |
164 |
-+ context = SSLContext(PROTOCOL_TLS) |
165 |
- |
166 |
- # SSLv2 considered harmful. |
167 |
- context.options |= OP_NO_SSLv2 |
168 |
-@@ -445,7 +446,7 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None, |
169 |
- context.load_default_certs(purpose) |
170 |
- return context |
171 |
- |
172 |
--def _create_unverified_context(protocol=PROTOCOL_SSLv23, *, cert_reqs=None, |
173 |
-+def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None, |
174 |
- check_hostname=False, purpose=Purpose.SERVER_AUTH, |
175 |
- certfile=None, keyfile=None, |
176 |
- cafile=None, capath=None, cadata=None): |
177 |
-@@ -501,7 +502,7 @@ class SSLSocket(socket): |
178 |
- |
179 |
- def __init__(self, sock=None, keyfile=None, certfile=None, |
180 |
- server_side=False, cert_reqs=CERT_NONE, |
181 |
-- ssl_version=PROTOCOL_SSLv23, ca_certs=None, |
182 |
-+ ssl_version=PROTOCOL_TLS, ca_certs=None, |
183 |
- do_handshake_on_connect=True, |
184 |
- family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, |
185 |
- suppress_ragged_eofs=True, npn_protocols=None, ciphers=None, |
186 |
-@@ -883,7 +884,7 @@ class SSLSocket(socket): |
187 |
- |
188 |
- def wrap_socket(sock, keyfile=None, certfile=None, |
189 |
- server_side=False, cert_reqs=CERT_NONE, |
190 |
-- ssl_version=PROTOCOL_SSLv23, ca_certs=None, |
191 |
-+ ssl_version=PROTOCOL_TLS, ca_certs=None, |
192 |
- do_handshake_on_connect=True, |
193 |
- suppress_ragged_eofs=True, |
194 |
- ciphers=None): |
195 |
-@@ -930,7 +931,7 @@ def PEM_cert_to_DER_cert(pem_cert_string): |
196 |
- d = pem_cert_string.strip()[len(PEM_HEADER):-len(PEM_FOOTER)] |
197 |
- return base64.decodebytes(d.encode('ASCII', 'strict')) |
198 |
- |
199 |
--def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None): |
200 |
-+def get_server_certificate(addr, ssl_version=PROTOCOL_TLS, ca_certs=None): |
201 |
- """Retrieve the certificate from the server at the specified address, |
202 |
- and return it as a PEM-encoded string. |
203 |
- If 'ca_certs' is specified, validate the server cert against it. |
204 |
-diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py |
205 |
-index e36a309bfa..b663a04aa2 100644 |
206 |
---- a/Lib/test/test_ssl.py |
207 |
-+++ b/Lib/test/test_ssl.py |
208 |
-@@ -23,6 +23,9 @@ ssl = support.import_module("ssl") |
209 |
- |
210 |
- PROTOCOLS = sorted(ssl._PROTOCOL_NAMES) |
211 |
- HOST = support.HOST |
212 |
-+IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL') |
213 |
-+IS_OPENSSL_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0) |
214 |
-+ |
215 |
- |
216 |
- def data_file(*name): |
217 |
- return os.path.join(os.path.dirname(__file__), *name) |
218 |
-@@ -318,9 +321,9 @@ class BasicSocketTests(unittest.TestCase): |
219 |
- self.assertGreaterEqual(status, 0) |
220 |
- self.assertLessEqual(status, 15) |
221 |
- # Version string as returned by {Open,Libre}SSL, the format might change |
222 |
-- if "LibreSSL" in s: |
223 |
-- self.assertTrue(s.startswith("LibreSSL {:d}.{:d}".format(major, minor)), |
224 |
-- (s, t)) |
225 |
-+ if IS_LIBRESSL: |
226 |
-+ self.assertTrue(s.startswith("LibreSSL {:d}".format(major)), |
227 |
-+ (s, t, hex(n))) |
228 |
- else: |
229 |
- self.assertTrue(s.startswith("OpenSSL {:d}.{:d}.{:d}".format(major, minor, fix)), |
230 |
- (s, t)) |
231 |
-@@ -677,7 +680,8 @@ class ContextTests(unittest.TestCase): |
232 |
- def test_constructor(self): |
233 |
- for protocol in PROTOCOLS: |
234 |
- ssl.SSLContext(protocol) |
235 |
-- self.assertRaises(TypeError, ssl.SSLContext) |
236 |
-+ ctx = ssl.SSLContext() |
237 |
-+ self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS) |
238 |
- self.assertRaises(ValueError, ssl.SSLContext, -1) |
239 |
- self.assertRaises(ValueError, ssl.SSLContext, 42) |
240 |
- |
241 |
-@@ -698,15 +702,15 @@ class ContextTests(unittest.TestCase): |
242 |
- def test_options(self): |
243 |
- ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) |
244 |
- # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value |
245 |
-- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3, |
246 |
-- ctx.options) |
247 |
-+ default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) |
248 |
-+ if not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0): |
249 |
-+ default |= ssl.OP_NO_COMPRESSION |
250 |
-+ self.assertEqual(default, ctx.options) |
251 |
- ctx.options |= ssl.OP_NO_TLSv1 |
252 |
-- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1, |
253 |
-- ctx.options) |
254 |
-+ self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options) |
255 |
- if can_clear_options(): |
256 |
-- ctx.options = (ctx.options & ~ssl.OP_NO_SSLv2) | ssl.OP_NO_TLSv1 |
257 |
-- self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, |
258 |
-- ctx.options) |
259 |
-+ ctx.options = (ctx.options & ~ssl.OP_NO_TLSv1) |
260 |
-+ self.assertEqual(default, ctx.options) |
261 |
- ctx.options = 0 |
262 |
- # Ubuntu has OP_NO_SSLv3 forced on by default |
263 |
- self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3) |
264 |
-@@ -1042,6 +1046,7 @@ class ContextTests(unittest.TestCase): |
265 |
- self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH') |
266 |
- |
267 |
- @unittest.skipIf(sys.platform == "win32", "not-Windows specific") |
268 |
-+ @unittest.skipIf(IS_LIBRESSL, "LibreSSL doesn't support env vars") |
269 |
- def test_load_default_certs_env(self): |
270 |
- ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) |
271 |
- with support.EnvironmentVarGuard() as env: |
272 |
-diff --git a/Modules/_hashopenssl.c b/Modules/_hashopenssl.c |
273 |
-index 5b0a7be12b..86a8950588 100644 |
274 |
---- a/Modules/_hashopenssl.c |
275 |
-+++ b/Modules/_hashopenssl.c |
276 |
-@@ -20,7 +20,6 @@ |
277 |
- |
278 |
- /* EVP is the preferred interface to hashing in OpenSSL */ |
279 |
- #include <openssl/evp.h> |
280 |
--#include <openssl/hmac.h> |
281 |
- /* We use the object interface to discover what hashes OpenSSL supports. */ |
282 |
- #include <openssl/objects.h> |
283 |
- #include "openssl/err.h" |
284 |
-@@ -31,15 +30,22 @@ |
285 |
- #define HASH_OBJ_CONSTRUCTOR 0 |
286 |
- #endif |
287 |
- |
288 |
--/* Minimum OpenSSL version needed to support sha224 and higher. */ |
289 |
--#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x00908000) |
290 |
--#define _OPENSSL_SUPPORTS_SHA2 |
291 |
-+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER) |
292 |
-+/* OpenSSL < 1.1.0 */ |
293 |
-+#define EVP_MD_CTX_new EVP_MD_CTX_create |
294 |
-+#define EVP_MD_CTX_free EVP_MD_CTX_destroy |
295 |
-+#define HAS_FAST_PKCS5_PBKDF2_HMAC 0 |
296 |
-+#include <openssl/hmac.h> |
297 |
-+#else |
298 |
-+/* OpenSSL >= 1.1.0 */ |
299 |
-+#define HAS_FAST_PKCS5_PBKDF2_HMAC 1 |
300 |
- #endif |
301 |
- |
302 |
-+ |
303 |
- typedef struct { |
304 |
- PyObject_HEAD |
305 |
- PyObject *name; /* name of this hash algorithm */ |
306 |
-- EVP_MD_CTX ctx; /* OpenSSL message digest context */ |
307 |
-+ EVP_MD_CTX *ctx; /* OpenSSL message digest context */ |
308 |
- #ifdef WITH_THREAD |
309 |
- PyThread_type_lock lock; /* OpenSSL context lock */ |
310 |
- #endif |
311 |
-@@ -51,7 +57,6 @@ static PyTypeObject EVPtype; |
312 |
- |
313 |
- #define DEFINE_CONSTS_FOR_NEW(Name) \ |
314 |
- static PyObject *CONST_ ## Name ## _name_obj = NULL; \ |
315 |
-- static EVP_MD_CTX CONST_new_ ## Name ## _ctx; \ |
316 |
- static EVP_MD_CTX *CONST_new_ ## Name ## _ctx_p = NULL; |
317 |
- |
318 |
- DEFINE_CONSTS_FOR_NEW(md5) |
319 |
-@@ -64,19 +69,57 @@ DEFINE_CONSTS_FOR_NEW(sha512) |
320 |
- #endif |
321 |
- |
322 |
- |
323 |
-+/* LCOV_EXCL_START */ |
324 |
-+static PyObject * |
325 |
-+_setException(PyObject *exc) |
326 |
-+{ |
327 |
-+ unsigned long errcode; |
328 |
-+ const char *lib, *func, *reason; |
329 |
-+ |
330 |
-+ errcode = ERR_peek_last_error(); |
331 |
-+ if (!errcode) { |
332 |
-+ PyErr_SetString(exc, "unknown reasons"); |
333 |
-+ return NULL; |
334 |
-+ } |
335 |
-+ ERR_clear_error(); |
336 |
-+ |
337 |
-+ lib = ERR_lib_error_string(errcode); |
338 |
-+ func = ERR_func_error_string(errcode); |
339 |
-+ reason = ERR_reason_error_string(errcode); |
340 |
-+ |
341 |
-+ if (lib && func) { |
342 |
-+ PyErr_Format(exc, "[%s: %s] %s", lib, func, reason); |
343 |
-+ } |
344 |
-+ else if (lib) { |
345 |
-+ PyErr_Format(exc, "[%s] %s", lib, reason); |
346 |
-+ } |
347 |
-+ else { |
348 |
-+ PyErr_SetString(exc, reason); |
349 |
-+ } |
350 |
-+ return NULL; |
351 |
-+} |
352 |
-+/* LCOV_EXCL_STOP */ |
353 |
-+ |
354 |
- static EVPobject * |
355 |
- newEVPobject(PyObject *name) |
356 |
- { |
357 |
- EVPobject *retval = (EVPobject *)PyObject_New(EVPobject, &EVPtype); |
358 |
-+ if (retval == NULL) { |
359 |
-+ return NULL; |
360 |
-+ } |
361 |
-+ |
362 |
-+ retval->ctx = EVP_MD_CTX_new(); |
363 |
-+ if (retval->ctx == NULL) { |
364 |
-+ PyErr_NoMemory(); |
365 |
-+ return NULL; |
366 |
-+ } |
367 |
- |
368 |
- /* save the name for .name to return */ |
369 |
-- if (retval != NULL) { |
370 |
-- Py_INCREF(name); |
371 |
-- retval->name = name; |
372 |
-+ Py_INCREF(name); |
373 |
-+ retval->name = name; |
374 |
- #ifdef WITH_THREAD |
375 |
-- retval->lock = NULL; |
376 |
-+ retval->lock = NULL; |
377 |
- #endif |
378 |
-- } |
379 |
- |
380 |
- return retval; |
381 |
- } |
382 |
-@@ -91,7 +134,7 @@ EVP_hash(EVPobject *self, const void *vp, Py_ssize_t len) |
383 |
- process = MUNCH_SIZE; |
384 |
- else |
385 |
- process = Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int); |
386 |
-- EVP_DigestUpdate(&self->ctx, (const void*)cp, process); |
387 |
-+ EVP_DigestUpdate(self->ctx, (const void*)cp, process); |
388 |
- len -= process; |
389 |
- cp += process; |
390 |
- } |
391 |
-@@ -106,16 +149,19 @@ EVP_dealloc(EVPobject *self) |
392 |
- if (self->lock != NULL) |
393 |
- PyThread_free_lock(self->lock); |
394 |
- #endif |
395 |
-- EVP_MD_CTX_cleanup(&self->ctx); |
396 |
-+ EVP_MD_CTX_free(self->ctx); |
397 |
- Py_XDECREF(self->name); |
398 |
- PyObject_Del(self); |
399 |
- } |
400 |
- |
401 |
--static void locked_EVP_MD_CTX_copy(EVP_MD_CTX *new_ctx_p, EVPobject *self) |
402 |
-+static int |
403 |
-+locked_EVP_MD_CTX_copy(EVP_MD_CTX *new_ctx_p, EVPobject *self) |
404 |
- { |
405 |
-+ int result; |
406 |
- ENTER_HASHLIB(self); |
407 |
-- EVP_MD_CTX_copy(new_ctx_p, &self->ctx); |
408 |
-+ result = EVP_MD_CTX_copy(new_ctx_p, self->ctx); |
409 |
- LEAVE_HASHLIB(self); |
410 |
-+ return result; |
411 |
- } |
412 |
- |
413 |
- /* External methods for a hash object */ |
414 |
-@@ -131,7 +177,9 @@ EVP_copy(EVPobject *self, PyObject *unused) |
415 |
- if ( (newobj = newEVPobject(self->name))==NULL) |
416 |
- return NULL; |
417 |
- |
418 |
-- locked_EVP_MD_CTX_copy(&newobj->ctx, self); |
419 |
-+ if (!locked_EVP_MD_CTX_copy(newobj->ctx, self)) { |
420 |
-+ return _setException(PyExc_ValueError); |
421 |
-+ } |
422 |
- return (PyObject *)newobj; |
423 |
- } |
424 |
- |
425 |
-@@ -142,16 +190,24 @@ static PyObject * |
426 |
- EVP_digest(EVPobject *self, PyObject *unused) |
427 |
- { |
428 |
- unsigned char digest[EVP_MAX_MD_SIZE]; |
429 |
-- EVP_MD_CTX temp_ctx; |
430 |
-+ EVP_MD_CTX *temp_ctx; |
431 |
- PyObject *retval; |
432 |
- unsigned int digest_size; |
433 |
- |
434 |
-- locked_EVP_MD_CTX_copy(&temp_ctx, self); |
435 |
-- digest_size = EVP_MD_CTX_size(&temp_ctx); |
436 |
-- EVP_DigestFinal(&temp_ctx, digest, NULL); |
437 |
-+ temp_ctx = EVP_MD_CTX_new(); |
438 |
-+ if (temp_ctx == NULL) { |
439 |
-+ PyErr_NoMemory(); |
440 |
-+ return NULL; |
441 |
-+ } |
442 |
-+ |
443 |
-+ if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) { |
444 |
-+ return _setException(PyExc_ValueError); |
445 |
-+ } |
446 |
-+ digest_size = EVP_MD_CTX_size(temp_ctx); |
447 |
-+ EVP_DigestFinal(temp_ctx, digest, NULL); |
448 |
- |
449 |
- retval = PyBytes_FromStringAndSize((const char *)digest, digest_size); |
450 |
-- EVP_MD_CTX_cleanup(&temp_ctx); |
451 |
-+ EVP_MD_CTX_free(temp_ctx); |
452 |
- return retval; |
453 |
- } |
454 |
- |
455 |
-@@ -162,17 +218,25 @@ static PyObject * |
456 |
- EVP_hexdigest(EVPobject *self, PyObject *unused) |
457 |
- { |
458 |
- unsigned char digest[EVP_MAX_MD_SIZE]; |
459 |
-- EVP_MD_CTX temp_ctx; |
460 |
-+ EVP_MD_CTX *temp_ctx; |
461 |
- PyObject *retval; |
462 |
- char *hex_digest; |
463 |
- unsigned int i, j, digest_size; |
464 |
- |
465 |
-+ temp_ctx = EVP_MD_CTX_new(); |
466 |
-+ if (temp_ctx == NULL) { |
467 |
-+ PyErr_NoMemory(); |
468 |
-+ return NULL; |
469 |
-+ } |
470 |
-+ |
471 |
- /* Get the raw (binary) digest value */ |
472 |
-- locked_EVP_MD_CTX_copy(&temp_ctx, self); |
473 |
-- digest_size = EVP_MD_CTX_size(&temp_ctx); |
474 |
-- EVP_DigestFinal(&temp_ctx, digest, NULL); |
475 |
-+ if (!locked_EVP_MD_CTX_copy(temp_ctx, self)) { |
476 |
-+ return _setException(PyExc_ValueError); |
477 |
-+ } |
478 |
-+ digest_size = EVP_MD_CTX_size(temp_ctx); |
479 |
-+ EVP_DigestFinal(temp_ctx, digest, NULL); |
480 |
- |
481 |
-- EVP_MD_CTX_cleanup(&temp_ctx); |
482 |
-+ EVP_MD_CTX_free(temp_ctx); |
483 |
- |
484 |
- /* Allocate a new buffer */ |
485 |
- hex_digest = PyMem_Malloc(digest_size * 2 + 1); |
486 |
-@@ -241,7 +305,7 @@ static PyObject * |
487 |
- EVP_get_block_size(EVPobject *self, void *closure) |
488 |
- { |
489 |
- long block_size; |
490 |
-- block_size = EVP_MD_CTX_block_size(&self->ctx); |
491 |
-+ block_size = EVP_MD_CTX_block_size(self->ctx); |
492 |
- return PyLong_FromLong(block_size); |
493 |
- } |
494 |
- |
495 |
-@@ -249,7 +313,7 @@ static PyObject * |
496 |
- EVP_get_digest_size(EVPobject *self, void *closure) |
497 |
- { |
498 |
- long size; |
499 |
-- size = EVP_MD_CTX_size(&self->ctx); |
500 |
-+ size = EVP_MD_CTX_size(self->ctx); |
501 |
- return PyLong_FromLong(size); |
502 |
- } |
503 |
- |
504 |
-@@ -310,7 +374,7 @@ EVP_tp_init(EVPobject *self, PyObject *args, PyObject *kwds) |
505 |
- PyBuffer_Release(&view); |
506 |
- return -1; |
507 |
- } |
508 |
-- EVP_DigestInit(&self->ctx, digest); |
509 |
-+ EVP_DigestInit(self->ctx, digest); |
510 |
- |
511 |
- self->name = name_obj; |
512 |
- Py_INCREF(self->name); |
513 |
-@@ -407,9 +471,9 @@ EVPnew(PyObject *name_obj, |
514 |
- return NULL; |
515 |
- |
516 |
- if (initial_ctx) { |
517 |
-- EVP_MD_CTX_copy(&self->ctx, initial_ctx); |
518 |
-+ EVP_MD_CTX_copy(self->ctx, initial_ctx); |
519 |
- } else { |
520 |
-- EVP_DigestInit(&self->ctx, digest); |
521 |
-+ EVP_DigestInit(self->ctx, digest); |
522 |
- } |
523 |
- |
524 |
- if (cp && len) { |
525 |
-@@ -475,6 +539,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict) |
526 |
- |
527 |
- #define PY_PBKDF2_HMAC 1 |
528 |
- |
529 |
-+#if !HAS_FAST_PKCS5_PBKDF2_HMAC |
530 |
- /* Improved implementation of PKCS5_PBKDF2_HMAC() |
531 |
- * |
532 |
- * PKCS5_PBKDF2_HMAC_fast() hashes the password exactly one time instead of |
533 |
-@@ -556,37 +621,8 @@ PKCS5_PBKDF2_HMAC_fast(const char *pass, int passlen, |
534 |
- HMAC_CTX_cleanup(&hctx_tpl); |
535 |
- return 1; |
536 |
- } |
537 |
-+#endif |
538 |
- |
539 |
--/* LCOV_EXCL_START */ |
540 |
--static PyObject * |
541 |
--_setException(PyObject *exc) |
542 |
--{ |
543 |
-- unsigned long errcode; |
544 |
-- const char *lib, *func, *reason; |
545 |
-- |
546 |
-- errcode = ERR_peek_last_error(); |
547 |
-- if (!errcode) { |
548 |
-- PyErr_SetString(exc, "unknown reasons"); |
549 |
-- return NULL; |
550 |
-- } |
551 |
-- ERR_clear_error(); |
552 |
-- |
553 |
-- lib = ERR_lib_error_string(errcode); |
554 |
-- func = ERR_func_error_string(errcode); |
555 |
-- reason = ERR_reason_error_string(errcode); |
556 |
-- |
557 |
-- if (lib && func) { |
558 |
-- PyErr_Format(exc, "[%s: %s] %s", lib, func, reason); |
559 |
-- } |
560 |
-- else if (lib) { |
561 |
-- PyErr_Format(exc, "[%s] %s", lib, reason); |
562 |
-- } |
563 |
-- else { |
564 |
-- PyErr_SetString(exc, reason); |
565 |
-- } |
566 |
-- return NULL; |
567 |
--} |
568 |
--/* LCOV_EXCL_STOP */ |
569 |
- |
570 |
- PyDoc_STRVAR(pbkdf2_hmac__doc__, |
571 |
- "pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None) -> key\n\ |
572 |
-@@ -668,10 +704,17 @@ pbkdf2_hmac(PyObject *self, PyObject *args, PyObject *kwdict) |
573 |
- key = PyBytes_AS_STRING(key_obj); |
574 |
- |
575 |
- Py_BEGIN_ALLOW_THREADS |
576 |
-+#if HAS_FAST_PKCS5_PBKDF2_HMAC |
577 |
-+ retval = PKCS5_PBKDF2_HMAC((char*)password.buf, (int)password.len, |
578 |
-+ (unsigned char *)salt.buf, (int)salt.len, |
579 |
-+ iterations, digest, dklen, |
580 |
-+ (unsigned char *)key); |
581 |
-+#else |
582 |
- retval = PKCS5_PBKDF2_HMAC_fast((char*)password.buf, (int)password.len, |
583 |
- (unsigned char *)salt.buf, (int)salt.len, |
584 |
- iterations, digest, dklen, |
585 |
- (unsigned char *)key); |
586 |
-+#endif |
587 |
- Py_END_ALLOW_THREADS |
588 |
- |
589 |
- if (!retval) { |
590 |
-@@ -790,7 +833,7 @@ generate_hash_name_list(void) |
591 |
- if (CONST_ ## NAME ## _name_obj == NULL) { \ |
592 |
- CONST_ ## NAME ## _name_obj = PyUnicode_FromString(#NAME); \ |
593 |
- if (EVP_get_digestbyname(#NAME)) { \ |
594 |
-- CONST_new_ ## NAME ## _ctx_p = &CONST_new_ ## NAME ## _ctx; \ |
595 |
-+ CONST_new_ ## NAME ## _ctx_p = EVP_MD_CTX_new(); \ |
596 |
- EVP_DigestInit(CONST_new_ ## NAME ## _ctx_p, EVP_get_digestbyname(#NAME)); \ |
597 |
- } \ |
598 |
- } \ |
599 |
-diff --git a/Modules/_ssl.c b/Modules/_ssl.c |
600 |
-index 0ff9d553e2..512e5f10ce 100644 |
601 |
---- a/Modules/_ssl.c |
602 |
-+++ b/Modules/_ssl.c |
603 |
-@@ -55,6 +55,14 @@ static PySocketModule_APIObject PySocketModule; |
604 |
- #include <sys/poll.h> |
605 |
- #endif |
606 |
- |
607 |
-+/* Don't warn about deprecated functions */ |
608 |
-+#ifdef __GNUC__ |
609 |
-+#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
610 |
-+#endif |
611 |
-+#ifdef __clang__ |
612 |
-+#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
613 |
-+#endif |
614 |
-+ |
615 |
- /* Include OpenSSL header files */ |
616 |
- #include "openssl/rsa.h" |
617 |
- #include "openssl/crypto.h" |
618 |
-@@ -90,6 +98,10 @@ struct py_ssl_library_code { |
619 |
- /* Include generated data (error codes) */ |
620 |
- #include "_ssl_data.h" |
621 |
- |
622 |
-+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) |
623 |
-+# define OPENSSL_VERSION_1_1 1 |
624 |
-+#endif |
625 |
-+ |
626 |
- /* Openssl comes with TLSv1.1 and TLSv1.2 between 1.0.0h and 1.0.1 |
627 |
- http://www.openssl.org/news/changelog.html |
628 |
- */ |
629 |
-@@ -108,6 +120,80 @@ struct py_ssl_library_code { |
630 |
- # define HAVE_SNI 0 |
631 |
- #endif |
632 |
- |
633 |
-+#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation |
634 |
-+# define HAVE_ALPN |
635 |
-+#endif |
636 |
-+ |
637 |
-+#ifndef INVALID_SOCKET /* MS defines this */ |
638 |
-+#define INVALID_SOCKET (-1) |
639 |
-+#endif |
640 |
-+ |
641 |
-+#ifdef OPENSSL_VERSION_1_1 |
642 |
-+/* OpenSSL 1.1.0+ */ |
643 |
-+#ifndef OPENSSL_NO_SSL2 |
644 |
-+#define OPENSSL_NO_SSL2 |
645 |
-+#endif |
646 |
-+#else /* OpenSSL < 1.1.0 */ |
647 |
-+#if defined(WITH_THREAD) |
648 |
-+#define HAVE_OPENSSL_CRYPTO_LOCK |
649 |
-+#endif |
650 |
-+ |
651 |
-+#define TLS_method SSLv23_method |
652 |
-+ |
653 |
-+static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne) |
654 |
-+{ |
655 |
-+ return ne->set; |
656 |
-+} |
657 |
-+ |
658 |
-+#ifndef OPENSSL_NO_COMP |
659 |
-+static int COMP_get_type(const COMP_METHOD *meth) |
660 |
-+{ |
661 |
-+ return meth->type; |
662 |
-+} |
663 |
-+ |
664 |
-+static const char *COMP_get_name(const COMP_METHOD *meth) |
665 |
-+{ |
666 |
-+ return meth->name; |
667 |
-+} |
668 |
-+#endif |
669 |
-+ |
670 |
-+static pem_password_cb *SSL_CTX_get_default_passwd_cb(SSL_CTX *ctx) |
671 |
-+{ |
672 |
-+ return ctx->default_passwd_callback; |
673 |
-+} |
674 |
-+ |
675 |
-+static void *SSL_CTX_get_default_passwd_cb_userdata(SSL_CTX *ctx) |
676 |
-+{ |
677 |
-+ return ctx->default_passwd_callback_userdata; |
678 |
-+} |
679 |
-+ |
680 |
-+static int X509_OBJECT_get_type(X509_OBJECT *x) |
681 |
-+{ |
682 |
-+ return x->type; |
683 |
-+} |
684 |
-+ |
685 |
-+static X509 *X509_OBJECT_get0_X509(X509_OBJECT *x) |
686 |
-+{ |
687 |
-+ return x->data.x509; |
688 |
-+} |
689 |
-+ |
690 |
-+static int BIO_up_ref(BIO *b) |
691 |
-+{ |
692 |
-+ CRYPTO_add(&b->references, 1, CRYPTO_LOCK_BIO); |
693 |
-+ return 1; |
694 |
-+} |
695 |
-+ |
696 |
-+static STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *store) { |
697 |
-+ return store->objs; |
698 |
-+} |
699 |
-+ |
700 |
-+static X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *store) |
701 |
-+{ |
702 |
-+ return store->param; |
703 |
-+} |
704 |
-+#endif /* OpenSSL < 1.1.0 or LibreSSL */ |
705 |
-+ |
706 |
-+ |
707 |
- enum py_ssl_error { |
708 |
- /* these mirror ssl.h */ |
709 |
- PY_SSL_ERROR_NONE, |
710 |
-@@ -138,7 +224,7 @@ enum py_ssl_cert_requirements { |
711 |
- enum py_ssl_version { |
712 |
- PY_SSL_VERSION_SSL2, |
713 |
- PY_SSL_VERSION_SSL3=1, |
714 |
-- PY_SSL_VERSION_SSL23, |
715 |
-+ PY_SSL_VERSION_TLS, |
716 |
- #if HAVE_TLSv1_2 |
717 |
- PY_SSL_VERSION_TLS1, |
718 |
- PY_SSL_VERSION_TLS1_1, |
719 |
-@@ -504,7 +590,7 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, |
720 |
- PySSL_BEGIN_ALLOW_THREADS |
721 |
- self->ssl = SSL_new(ctx); |
722 |
- PySSL_END_ALLOW_THREADS |
723 |
-- SSL_set_app_data(self->ssl,self); |
724 |
-+ SSL_set_app_data(self->ssl, self); |
725 |
- SSL_set_fd(self->ssl, Py_SAFE_DOWNCAST(sock->sock_fd, SOCKET_T, int)); |
726 |
- mode = SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER; |
727 |
- #ifdef SSL_MODE_AUTO_RETRY |
728 |
-@@ -691,7 +777,7 @@ _create_tuple_for_X509_NAME (X509_NAME *xname) |
729 |
- |
730 |
- /* check to see if we've gotten to a new RDN */ |
731 |
- if (rdn_level >= 0) { |
732 |
-- if (rdn_level != entry->set) { |
733 |
-+ if (rdn_level != X509_NAME_ENTRY_set(entry)) { |
734 |
- /* yes, new RDN */ |
735 |
- /* add old RDN to DN */ |
736 |
- rdnt = PyList_AsTuple(rdn); |
737 |
-@@ -708,7 +794,7 @@ _create_tuple_for_X509_NAME (X509_NAME *xname) |
738 |
- goto fail0; |
739 |
- } |
740 |
- } |
741 |
-- rdn_level = entry->set; |
742 |
-+ rdn_level = X509_NAME_ENTRY_set(entry); |
743 |
- |
744 |
- /* now add this attribute to the current RDN */ |
745 |
- name = X509_NAME_ENTRY_get_object(entry); |
746 |
-@@ -811,18 +897,18 @@ _get_peer_alt_names (X509 *certificate) { |
747 |
- goto fail; |
748 |
- } |
749 |
- |
750 |
-- p = ext->value->data; |
751 |
-+ p = X509_EXTENSION_get_data(ext)->data; |
752 |
- if (method->it) |
753 |
- names = (GENERAL_NAMES*) |
754 |
- (ASN1_item_d2i(NULL, |
755 |
- &p, |
756 |
-- ext->value->length, |
757 |
-+ X509_EXTENSION_get_data(ext)->length, |
758 |
- ASN1_ITEM_ptr(method->it))); |
759 |
- else |
760 |
- names = (GENERAL_NAMES*) |
761 |
- (method->d2i(NULL, |
762 |
- &p, |
763 |
-- ext->value->length)); |
764 |
-+ X509_EXTENSION_get_data(ext)->length)); |
765 |
- |
766 |
- for(j = 0; j < sk_GENERAL_NAME_num(names); j++) { |
767 |
- /* get a rendering of each name in the set of names */ |
768 |
-@@ -1033,13 +1119,11 @@ _get_crl_dp(X509 *certificate) { |
769 |
- int i, j; |
770 |
- PyObject *lst, *res = NULL; |
771 |
- |
772 |
--#if OPENSSL_VERSION_NUMBER < 0x10001000L |
773 |
-- dps = X509_get_ext_d2i(certificate, NID_crl_distribution_points, NULL, NULL); |
774 |
--#else |
775 |
-+#if OPENSSL_VERSION_NUMBER >= 0x10001000L |
776 |
- /* Calls x509v3_cache_extensions and sets up crldp */ |
777 |
- X509_check_ca(certificate); |
778 |
-- dps = certificate->crldp; |
779 |
- #endif |
780 |
-+ dps = X509_get_ext_d2i(certificate, NID_crl_distribution_points, NULL, NULL); |
781 |
- |
782 |
- if (dps == NULL) |
783 |
- return Py_None; |
784 |
-@@ -1431,9 +1515,9 @@ static PyObject *PySSL_compression(PySSLSocket *self) { |
785 |
- if (self->ssl == NULL) |
786 |
- Py_RETURN_NONE; |
787 |
- comp_method = SSL_get_current_compression(self->ssl); |
788 |
-- if (comp_method == NULL || comp_method->type == NID_undef) |
789 |
-+ if (comp_method == NULL || COMP_get_type(comp_method) == NID_undef) |
790 |
- Py_RETURN_NONE; |
791 |
-- short_name = OBJ_nid2sn(comp_method->type); |
792 |
-+ short_name = COMP_get_name(comp_method); |
793 |
- if (short_name == NULL) |
794 |
- Py_RETURN_NONE; |
795 |
- return PyUnicode_DecodeFSDefault(short_name); |
796 |
-@@ -1981,7 +2065,7 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
797 |
- { |
798 |
- char *kwlist[] = {"protocol", NULL}; |
799 |
- PySSLContext *self; |
800 |
-- int proto_version = PY_SSL_VERSION_SSL23; |
801 |
-+ int proto_version = PY_SSL_VERSION_TLS; |
802 |
- long options; |
803 |
- SSL_CTX *ctx = NULL; |
804 |
- |
805 |
-@@ -2007,8 +2091,8 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
806 |
- else if (proto_version == PY_SSL_VERSION_SSL2) |
807 |
- ctx = SSL_CTX_new(SSLv2_method()); |
808 |
- #endif |
809 |
-- else if (proto_version == PY_SSL_VERSION_SSL23) |
810 |
-- ctx = SSL_CTX_new(SSLv23_method()); |
811 |
-+ else if (proto_version == PY_SSL_VERSION_TLS) |
812 |
-+ ctx = SSL_CTX_new(TLS_method()); |
813 |
- else |
814 |
- proto_version = -1; |
815 |
- PySSL_END_ALLOW_THREADS |
816 |
-@@ -2051,8 +2135,9 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
817 |
- #ifndef OPENSSL_NO_ECDH |
818 |
- /* Allow automatic ECDH curve selection (on OpenSSL 1.0.2+), or use |
819 |
- prime256v1 by default. This is Apache mod_ssl's initialization |
820 |
-- policy, so we should be safe. */ |
821 |
--#if defined(SSL_CTX_set_ecdh_auto) |
822 |
-+ policy, so we should be safe. OpenSSL 1.1 has it enabled by default. |
823 |
-+ */ |
824 |
-+#if defined(SSL_CTX_set_ecdh_auto) && !defined(OPENSSL_VERSION_1_1) |
825 |
- SSL_CTX_set_ecdh_auto(self->ctx, 1); |
826 |
- #else |
827 |
- { |
828 |
-@@ -2263,10 +2348,12 @@ static PyObject * |
829 |
- get_verify_flags(PySSLContext *self, void *c) |
830 |
- { |
831 |
- X509_STORE *store; |
832 |
-+ X509_VERIFY_PARAM *param; |
833 |
- unsigned long flags; |
834 |
- |
835 |
- store = SSL_CTX_get_cert_store(self->ctx); |
836 |
-- flags = X509_VERIFY_PARAM_get_flags(store->param); |
837 |
-+ param = X509_STORE_get0_param(store); |
838 |
-+ flags = X509_VERIFY_PARAM_get_flags(param); |
839 |
- return PyLong_FromUnsignedLong(flags); |
840 |
- } |
841 |
- |
842 |
-@@ -2274,22 +2361,24 @@ static int |
843 |
- set_verify_flags(PySSLContext *self, PyObject *arg, void *c) |
844 |
- { |
845 |
- X509_STORE *store; |
846 |
-+ X509_VERIFY_PARAM *param; |
847 |
- unsigned long new_flags, flags, set, clear; |
848 |
- |
849 |
- if (!PyArg_Parse(arg, "k", &new_flags)) |
850 |
- return -1; |
851 |
- store = SSL_CTX_get_cert_store(self->ctx); |
852 |
-- flags = X509_VERIFY_PARAM_get_flags(store->param); |
853 |
-+ param = X509_STORE_get0_param(store); |
854 |
-+ flags = X509_VERIFY_PARAM_get_flags(param); |
855 |
- clear = flags & ~new_flags; |
856 |
- set = ~flags & new_flags; |
857 |
- if (clear) { |
858 |
-- if (!X509_VERIFY_PARAM_clear_flags(store->param, clear)) { |
859 |
-+ if (!X509_VERIFY_PARAM_clear_flags(param, clear)) { |
860 |
- _setSSLError(NULL, 0, __FILE__, __LINE__); |
861 |
- return -1; |
862 |
- } |
863 |
- } |
864 |
- if (set) { |
865 |
-- if (!X509_VERIFY_PARAM_set_flags(store->param, set)) { |
866 |
-+ if (!X509_VERIFY_PARAM_set_flags(param, set)) { |
867 |
- _setSSLError(NULL, 0, __FILE__, __LINE__); |
868 |
- return -1; |
869 |
- } |
870 |
-@@ -2459,8 +2548,8 @@ load_cert_chain(PySSLContext *self, PyObject *args, PyObject *kwds) |
871 |
- char *kwlist[] = {"certfile", "keyfile", "password", NULL}; |
872 |
- PyObject *certfile, *keyfile = NULL, *password = NULL; |
873 |
- PyObject *certfile_bytes = NULL, *keyfile_bytes = NULL; |
874 |
-- pem_password_cb *orig_passwd_cb = self->ctx->default_passwd_callback; |
875 |
-- void *orig_passwd_userdata = self->ctx->default_passwd_callback_userdata; |
876 |
-+ pem_password_cb *orig_passwd_cb = SSL_CTX_get_default_passwd_cb(self->ctx); |
877 |
-+ void *orig_passwd_userdata = SSL_CTX_get_default_passwd_cb_userdata(self->ctx); |
878 |
- _PySSLPasswordInfo pw_info = { NULL, NULL, NULL, 0, 0 }; |
879 |
- int r; |
880 |
- |
881 |
-@@ -2591,8 +2680,9 @@ _add_ca_certs(PySSLContext *self, void *data, Py_ssize_t len, |
882 |
- cert = d2i_X509_bio(biobuf, NULL); |
883 |
- } else { |
884 |
- cert = PEM_read_bio_X509(biobuf, NULL, |
885 |
-- self->ctx->default_passwd_callback, |
886 |
-- self->ctx->default_passwd_callback_userdata); |
887 |
-+ SSL_CTX_get_default_passwd_cb(self->ctx), |
888 |
-+ SSL_CTX_get_default_passwd_cb_userdata(self->ctx) |
889 |
-+ ); |
890 |
- } |
891 |
- if (cert == NULL) { |
892 |
- break; |
893 |
-@@ -3040,25 +3130,24 @@ static PyObject * |
894 |
- cert_store_stats(PySSLContext *self) |
895 |
- { |
896 |
- X509_STORE *store; |
897 |
-+ STACK_OF(X509_OBJECT) *objs; |
898 |
- X509_OBJECT *obj; |
899 |
-- int x509 = 0, crl = 0, pkey = 0, ca = 0, i; |
900 |
-+ int x509 = 0, crl = 0, ca = 0, i; |
901 |
- |
902 |
- store = SSL_CTX_get_cert_store(self->ctx); |
903 |
-- for (i = 0; i < sk_X509_OBJECT_num(store->objs); i++) { |
904 |
-- obj = sk_X509_OBJECT_value(store->objs, i); |
905 |
-- switch (obj->type) { |
906 |
-+ objs = X509_STORE_get0_objects(store); |
907 |
-+ for (i = 0; i < sk_X509_OBJECT_num(objs); i++) { |
908 |
-+ obj = sk_X509_OBJECT_value(objs, i); |
909 |
-+ switch (X509_OBJECT_get_type(obj)) { |
910 |
- case X509_LU_X509: |
911 |
- x509++; |
912 |
-- if (X509_check_ca(obj->data.x509)) { |
913 |
-+ if (X509_check_ca(X509_OBJECT_get0_X509(obj))) { |
914 |
- ca++; |
915 |
- } |
916 |
- break; |
917 |
- case X509_LU_CRL: |
918 |
- crl++; |
919 |
- break; |
920 |
-- case X509_LU_PKEY: |
921 |
-- pkey++; |
922 |
-- break; |
923 |
- default: |
924 |
- /* Ignore X509_LU_FAIL, X509_LU_RETRY, X509_LU_PKEY. |
925 |
- * As far as I can tell they are internal states and never |
926 |
-@@ -3083,6 +3172,7 @@ get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwds) |
927 |
- { |
928 |
- char *kwlist[] = {"binary_form", NULL}; |
929 |
- X509_STORE *store; |
930 |
-+ STACK_OF(X509_OBJECT) *objs; |
931 |
- PyObject *ci = NULL, *rlist = NULL; |
932 |
- int i; |
933 |
- int binary_mode = 0; |
934 |
-@@ -3097,17 +3187,18 @@ get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwds) |
935 |
- } |
936 |
- |
937 |
- store = SSL_CTX_get_cert_store(self->ctx); |
938 |
-- for (i = 0; i < sk_X509_OBJECT_num(store->objs); i++) { |
939 |
-+ objs = X509_STORE_get0_objects(store); |
940 |
-+ for (i = 0; i < sk_X509_OBJECT_num(objs); i++) { |
941 |
- X509_OBJECT *obj; |
942 |
- X509 *cert; |
943 |
- |
944 |
-- obj = sk_X509_OBJECT_value(store->objs, i); |
945 |
-- if (obj->type != X509_LU_X509) { |
946 |
-+ obj = sk_X509_OBJECT_value(objs, i); |
947 |
-+ if (X509_OBJECT_get_type(obj) != X509_LU_X509) { |
948 |
- /* not a x509 cert */ |
949 |
- continue; |
950 |
- } |
951 |
- /* CA for any purpose */ |
952 |
-- cert = obj->data.x509; |
953 |
-+ cert = X509_OBJECT_get0_X509(obj); |
954 |
- if (!X509_check_ca(cert)) { |
955 |
- continue; |
956 |
- } |
957 |
-@@ -3780,10 +3871,12 @@ static PyMethodDef PySSL_methods[] = { |
958 |
- }; |
959 |
- |
960 |
- |
961 |
--#ifdef WITH_THREAD |
962 |
-+#ifdef HAVE_OPENSSL_CRYPTO_LOCK |
963 |
- |
964 |
- /* an implementation of OpenSSL threading operations in terms |
965 |
-- of the Python C thread library */ |
966 |
-+ * of the Python C thread library |
967 |
-+ * Only used up to 1.0.2. OpenSSL 1.1.0+ has its own locking code. |
968 |
-+ */ |
969 |
- |
970 |
- static PyThread_type_lock *_ssl_locks = NULL; |
971 |
- |
972 |
-@@ -3864,7 +3957,7 @@ static int _setup_ssl_threads(void) { |
973 |
- return 1; |
974 |
- } |
975 |
- |
976 |
--#endif /* def HAVE_THREAD */ |
977 |
-+#endif /* HAVE_OPENSSL_CRYPTO_LOCK for WITH_THREAD && OpenSSL < 1.1.0 */ |
978 |
- |
979 |
- PyDoc_STRVAR(module_doc, |
980 |
- "Implementation module for SSL socket operations. See the socket module\n\ |
981 |
-@@ -3931,11 +4024,16 @@ PyInit__ssl(void) |
982 |
- SSL_load_error_strings(); |
983 |
- SSL_library_init(); |
984 |
- #ifdef WITH_THREAD |
985 |
-+#ifdef HAVE_OPENSSL_CRYPTO_LOCK |
986 |
- /* note that this will start threading if not already started */ |
987 |
- if (!_setup_ssl_threads()) { |
988 |
- return NULL; |
989 |
- } |
990 |
-+#elif OPENSSL_VERSION_1_1 && defined(OPENSSL_THREADS) |
991 |
-+ /* OpenSSL 1.1.0 builtin thread support is enabled */ |
992 |
-+ _ssl_locks_count++; |
993 |
- #endif |
994 |
-+#endif /* WITH_THREAD */ |
995 |
- OpenSSL_add_all_algorithms(); |
996 |
- |
997 |
- /* Add symbols to module dict */ |
998 |
-@@ -4079,7 +4177,9 @@ PyInit__ssl(void) |
999 |
- PY_SSL_VERSION_SSL3); |
1000 |
- #endif |
1001 |
- PyModule_AddIntConstant(m, "PROTOCOL_SSLv23", |
1002 |
-- PY_SSL_VERSION_SSL23); |
1003 |
-+ PY_SSL_VERSION_TLS); |
1004 |
-+ PyModule_AddIntConstant(m, "PROTOCOL_TLS", |
1005 |
-+ PY_SSL_VERSION_TLS); |
1006 |
- PyModule_AddIntConstant(m, "PROTOCOL_TLSv1", |
1007 |
- PY_SSL_VERSION_TLS1); |
1008 |
- #if HAVE_TLSv1_2 |
1009 |
--- |
1010 |
-2.24.0 |
1011 |
- |
1012 |
|
1013 |
diff --git a/dev-lang/python/files/python-3.4.5-cross.patch b/dev-lang/python/files/python-3.4.5-cross.patch |
1014 |
deleted file mode 100644 |
1015 |
index 7a016ff..0000000 |
1016 |
--- a/dev-lang/python/files/python-3.4.5-cross.patch |
1017 |
+++ /dev/null |
1018 |
@@ -1,11 +0,0 @@ |
1019 |
---- a/Lib/distutils/command/build_ext.py |
1020 |
-+++ b/Lib/distutils/command/build_ext.py |
1021 |
-@@ -729,7 +729,7 @@ |
1022 |
- if sysconfig.get_config_var('Py_ENABLE_SHARED'): |
1023 |
- pythonlib = 'python{}.{}{}'.format( |
1024 |
- sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, |
1025 |
-- sys.abiflags) |
1026 |
-+ sysconfig.get_config_var('ABIFLAGS')) |
1027 |
- return ext.libraries + [pythonlib] |
1028 |
- else: |
1029 |
- return ext.libraries |
1030 |
|
1031 |
diff --git a/dev-lang/python/files/python-3.5.5-hash-unaligned.patch b/dev-lang/python/files/python-3.5.5-hash-unaligned.patch |
1032 |
deleted file mode 100644 |
1033 |
index 7861bfb..0000000 |
1034 |
--- a/dev-lang/python/files/python-3.5.5-hash-unaligned.patch |
1035 |
+++ /dev/null |
1036 |
@@ -1,48 +0,0 @@ |
1037 |
-From 0d17e60b33aca1a4d151a8a2bd6eaa331f0ec658 Mon Sep 17 00:00:00 2001 |
1038 |
-From: Rolf Eike Beer <eike@×××××××.de> |
1039 |
-Date: Sun, 13 May 2018 04:40:03 -0700 |
1040 |
-Subject: [PATCH] bpo-28055: Fix unaligned accesses in siphash24(). (GH-6123) |
1041 |
- |
1042 |
-The hash implementation casts the input pointer to uint64_t* and directly reads |
1043 |
-from this, which may cause unaligned accesses. Use memcpy() instead so this code |
1044 |
-will not crash with SIGBUS on sparc. |
1045 |
- |
1046 |
---- a/Python/pyhash.c 2017-11-29 10:21:20.283094068 +0100 |
1047 |
-+++ b/Python/pyhash.c 2017-11-29 10:24:26.733087813 +0100 |
1048 |
-@@ -372,7 +372,7 @@ siphash24(const void *src, Py_ssize_t sr |
1049 |
- PY_UINT64_T k0 = _le64toh(_Py_HashSecret.siphash.k0); |
1050 |
- PY_UINT64_T k1 = _le64toh(_Py_HashSecret.siphash.k1); |
1051 |
- PY_UINT64_T b = (PY_UINT64_T)src_sz << 56; |
1052 |
-- const PY_UINT64_T *in = (PY_UINT64_T*)src; |
1053 |
-+ const PY_UINT8_T *in = (PY_UINT8_T*)src; |
1054 |
- |
1055 |
- PY_UINT64_T v0 = k0 ^ 0x736f6d6570736575ULL; |
1056 |
- PY_UINT64_T v1 = k1 ^ 0x646f72616e646f6dULL; |
1057 |
-@@ -381,12 +381,14 @@ siphash24(const void *src, Py_ssize_t sr |
1058 |
- |
1059 |
- PY_UINT64_T t; |
1060 |
- PY_UINT8_T *pt; |
1061 |
-- PY_UINT8_T *m; |
1062 |
-+ const PY_UINT8_T *m; |
1063 |
- |
1064 |
- while (src_sz >= 8) { |
1065 |
-- PY_UINT64_T mi = _le64toh(*in); |
1066 |
-- in += 1; |
1067 |
-- src_sz -= 8; |
1068 |
-+ PY_UINT64_T mi; |
1069 |
-+ memcpy(&mi, in, sizeof(mi)); |
1070 |
-+ mi = _le64toh(mi); |
1071 |
-+ in += sizeof(mi); |
1072 |
-+ src_sz -= sizeof(mi); |
1073 |
- v3 ^= mi; |
1074 |
- DOUBLE_ROUND(v0,v1,v2,v3); |
1075 |
- v0 ^= mi; |
1076 |
-@@ -394,7 +396,7 @@ siphash24(const void *src, Py_ssize_t sr |
1077 |
- |
1078 |
- t = 0; |
1079 |
- pt = (PY_UINT8_T *)&t; |
1080 |
-- m = (PY_UINT8_T *)in; |
1081 |
-+ m = in; |
1082 |
- switch (src_sz) { |
1083 |
- case 7: pt[6] = m[6]; |
1084 |
- case 6: pt[5] = m[5]; |
1085 |
|
1086 |
diff --git a/dev-lang/python/python-3.4.10.ebuild b/dev-lang/python/python-3.4.10.ebuild |
1087 |
index 10d6002..69ebe37 100644 |
1088 |
--- a/dev-lang/python/python-3.4.10.ebuild |
1089 |
+++ b/dev-lang/python/python-3.4.10.ebuild |
1090 |
@@ -1,85 +1,72 @@ |
1091 |
# Copyright 1999-2019 Gentoo Authors |
1092 |
# Distributed under the terms of the GNU General Public License v2 |
1093 |
|
1094 |
-EAPI="5" |
1095 |
+EAPI="7" |
1096 |
WANT_LIBTOOL="none" |
1097 |
|
1098 |
-inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing |
1099 |
+inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs |
1100 |
|
1101 |
-MY_P="Python-${PV/_/}" |
1102 |
-PATCHSET_VERSION="3.4.6-0" |
1103 |
+MY_P="Python-${PV}" |
1104 |
+PYVER=$(ver_cut 1-2) |
1105 |
+PATCHSET="python-gentoo-patches-3.4.10" |
1106 |
|
1107 |
DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
1108 |
HOMEPAGE="https://www.python.org/" |
1109 |
-SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
1110 |
- https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
1111 |
+SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz |
1112 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz" |
1113 |
+S="${WORKDIR}/${MY_P}" |
1114 |
|
1115 |
LICENSE="PSF-2" |
1116 |
-SLOT="3.4/3.4m" |
1117 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd" |
1118 |
-IUSE="bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
1119 |
+SLOT="${PYVER}/${PYVER}m" |
1120 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
1121 |
+IUSE="bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
1122 |
|
1123 |
# Do not add a dependency on dev-lang/python to this ebuild. |
1124 |
# If you need to apply a patch which requires python for bootstrapping, please |
1125 |
# run the bootstrap code on your dev box and include the results in the |
1126 |
# patchset. See bug 447752. |
1127 |
|
1128 |
-RDEPEND="app-arch/bzip2:0= |
1129 |
- app-arch/xz-utils:0= |
1130 |
- >=sys-libs/zlib-1.1.3:0= |
1131 |
+RDEPEND="app-arch/bzip2:= |
1132 |
+ app-arch/xz-utils:= |
1133 |
+ >=sys-libs/zlib-1.1.3:= |
1134 |
virtual/libffi:= |
1135 |
virtual/libintl |
1136 |
- gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
1137 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
1138 |
ncurses? ( |
1139 |
- >=sys-libs/ncurses-5.2:0= |
1140 |
- readline? ( >=sys-libs/readline-4.1:0= ) |
1141 |
+ >=sys-libs/ncurses-5.2:= |
1142 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
1143 |
) |
1144 |
sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
1145 |
ssl? ( |
1146 |
- !libressl? ( dev-libs/openssl:0= ) |
1147 |
- libressl? ( dev-libs/libressl:0= ) |
1148 |
+ !libressl? ( dev-libs/openssl:= ) |
1149 |
+ libressl? ( dev-libs/libressl:= ) |
1150 |
) |
1151 |
tk? ( |
1152 |
- >=dev-lang/tcl-8.0:0= |
1153 |
- >=dev-lang/tk-8.0:0= |
1154 |
- dev-tcltk/blt:0= |
1155 |
+ >=dev-lang/tcl-8.0:= |
1156 |
+ >=dev-lang/tk-8.0:= |
1157 |
+ dev-tcltk/blt:= |
1158 |
dev-tcltk/tix |
1159 |
) |
1160 |
- xml? ( >=dev-libs/expat-2.1:0= ) |
1161 |
- !!<sys-apps/sandbox-2.6-r1" |
1162 |
+ xml? ( >=dev-libs/expat-2.1:= )" |
1163 |
# bluetooth requires headers from bluez |
1164 |
DEPEND="${RDEPEND} |
1165 |
bluetooth? ( net-wireless/bluez ) |
1166 |
virtual/pkgconfig |
1167 |
- >=sys-devel/autoconf-2.65 |
1168 |
!sys-devel/gcc[libffi(-)]" |
1169 |
RDEPEND+=" !build? ( app-misc/mime-types )" |
1170 |
PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
1171 |
|
1172 |
-S="${WORKDIR}/${MY_P}" |
1173 |
- |
1174 |
-PYVER=${SLOT%/*} |
1175 |
- |
1176 |
src_prepare() { |
1177 |
# Ensure that internal copies of expat, libffi and zlib are not used. |
1178 |
- rm -fr Modules/expat |
1179 |
- rm -fr Modules/_ctypes/libffi* |
1180 |
- rm -fr Modules/zlib |
1181 |
+ rm -fr Modules/expat || die |
1182 |
+ rm -fr Modules/_ctypes/libffi* || die |
1183 |
+ rm -fr Modules/zlib || die |
1184 |
|
1185 |
- if tc-is-cross-compiler; then |
1186 |
- # Invokes BUILDPYTHON, which is built for the host arch |
1187 |
- local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
1188 |
- fi |
1189 |
- |
1190 |
- EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
1191 |
- epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
1192 |
- epatch "${FILESDIR}/${PN}-3.4.5-cross.patch" |
1193 |
- epatch "${FILESDIR}/3.4-getentropy-linux.patch" |
1194 |
- epatch "${FILESDIR}/3.6-disable-nis.patch" |
1195 |
- epatch "${FILESDIR}/python-3.5.5-hash-unaligned.patch" |
1196 |
- epatch "${FILESDIR}/python-3.4.10-openssl11.patch" |
1197 |
+ local PATCHES=( |
1198 |
+ "${WORKDIR}/${PATCHSET}" |
1199 |
+ ) |
1200 |
|
1201 |
- epatch_user |
1202 |
+ default |
1203 |
|
1204 |
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
1205 |
configure.ac \ |
1206 |
@@ -100,13 +87,13 @@ src_configure() { |
1207 |
local disable |
1208 |
# disable automagic bluetooth headers detection |
1209 |
use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
1210 |
- use gdbm || disable+=" gdbm" |
1211 |
- use ncurses || disable+=" _curses _curses_panel" |
1212 |
- use readline || disable+=" readline" |
1213 |
- use sqlite || disable+=" _sqlite3" |
1214 |
- use ssl || export PYTHON_DISABLE_SSL="1" |
1215 |
- use tk || disable+=" _tkinter" |
1216 |
- use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1217 |
+ use gdbm || disable+=" gdbm" |
1218 |
+ use ncurses || disable+=" _curses _curses_panel" |
1219 |
+ use readline || disable+=" readline" |
1220 |
+ use sqlite || disable+=" _sqlite3" |
1221 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
1222 |
+ use tk || disable+=" _tkinter" |
1223 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1224 |
export PYTHON_DISABLE_MODULES="${disable}" |
1225 |
|
1226 |
if ! use xml; then |
1227 |
@@ -148,25 +135,23 @@ src_configure() { |
1228 |
dbmliborder+="${dbmliborder:+:}gdbm" |
1229 |
fi |
1230 |
|
1231 |
- BUILD_DIR="${WORKDIR}/${CHOST}" |
1232 |
- mkdir -p "${BUILD_DIR}" || die |
1233 |
- cd "${BUILD_DIR}" || die |
1234 |
- |
1235 |
- ECONF_SOURCE="${S}" OPT="" \ |
1236 |
- econf \ |
1237 |
- --with-fpectl \ |
1238 |
- --enable-shared \ |
1239 |
- $(use_enable ipv6) \ |
1240 |
- $(use_with threads) \ |
1241 |
- --infodir='${prefix}/share/info' \ |
1242 |
- --mandir='${prefix}/share/man' \ |
1243 |
- --with-computed-gotos \ |
1244 |
- --with-dbmliborder="${dbmliborder}" \ |
1245 |
- --with-libc="" \ |
1246 |
- --enable-loadable-sqlite-extensions \ |
1247 |
- --with-system-expat \ |
1248 |
- --with-system-ffi \ |
1249 |
+ local myeconfargs=( |
1250 |
+ --with-fpectl |
1251 |
+ --enable-shared |
1252 |
+ $(use_enable ipv6) |
1253 |
+ $(use_with threads) |
1254 |
+ --infodir='${prefix}/share/info' |
1255 |
+ --mandir='${prefix}/share/man' |
1256 |
+ --with-computed-gotos |
1257 |
+ --with-dbmliborder="${dbmliborder}" |
1258 |
+ --with-libc= |
1259 |
+ --enable-loadable-sqlite-extensions |
1260 |
--without-ensurepip |
1261 |
+ --with-system-expat |
1262 |
+ --with-system-ffi |
1263 |
+ ) |
1264 |
+ |
1265 |
+ OPT="" econf "${myeconfargs[@]}" |
1266 |
|
1267 |
if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
1268 |
eerror "configure has detected that the sem_open function is broken." |
1269 |
@@ -180,11 +165,6 @@ src_compile() { |
1270 |
# https://bugs.gentoo.org/594768 |
1271 |
local -x LC_ALL=C |
1272 |
|
1273 |
- # Avoid invoking pgen for cross-compiles. |
1274 |
- touch Include/graminit.h Python/graminit.c || die |
1275 |
- |
1276 |
- cd "${BUILD_DIR}" || die |
1277 |
- |
1278 |
emake CPPFLAGS= CFLAGS= LDFLAGS= |
1279 |
|
1280 |
# Work around bug 329499. See also bug 413751 and 457194. |
1281 |
@@ -202,8 +182,6 @@ src_test() { |
1282 |
return |
1283 |
fi |
1284 |
|
1285 |
- cd "${BUILD_DIR}" || die |
1286 |
- |
1287 |
# Skip failing tests. |
1288 |
local skipped_tests="gdb" |
1289 |
|
1290 |
@@ -211,7 +189,11 @@ src_test() { |
1291 |
mv "${S}"/Lib/test/test_${test}.py "${T}" |
1292 |
done |
1293 |
|
1294 |
+ # bug 660358 |
1295 |
+ local -x COLUMNS=80 |
1296 |
+ |
1297 |
local -x PYTHONDONTWRITEBYTECODE= |
1298 |
+ |
1299 |
emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
1300 |
local result=$? |
1301 |
|
1302 |
@@ -236,23 +218,24 @@ src_test() { |
1303 |
src_install() { |
1304 |
local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
1305 |
|
1306 |
- cd "${BUILD_DIR}" || die |
1307 |
- |
1308 |
emake DESTDIR="${D}" altinstall |
1309 |
|
1310 |
+ # Remove static library |
1311 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
1312 |
+ |
1313 |
sed \ |
1314 |
-e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
1315 |
-e "s/\(PY_LDFLAGS=\).*/\1/" \ |
1316 |
-i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
1317 |
|
1318 |
# Fix collisions between different slots of Python. |
1319 |
- rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
1320 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
1321 |
|
1322 |
# Cheap hack to get version with ABIFLAGS |
1323 |
- local abiver=$(cd "${ED}usr/include"; echo python*) |
1324 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
1325 |
if [[ ${abiver} != python${PYVER} ]]; then |
1326 |
# Replace python3.X with a symlink to python3.Xm |
1327 |
- rm "${ED}usr/bin/python${PYVER}" || die |
1328 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
1329 |
dosym "${abiver}" "/usr/bin/python${PYVER}" |
1330 |
# Create python3.X-config symlink |
1331 |
dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1332 |
@@ -260,19 +243,18 @@ src_install() { |
1333 |
dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1334 |
fi |
1335 |
|
1336 |
- use elibc_uclibc && rm -fr "${libdir}/test" |
1337 |
- use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
1338 |
- use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
1339 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
1340 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
1341 |
|
1342 |
- use threads || rm -fr "${libdir}/multiprocessing" |
1343 |
- use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
1344 |
+ use threads || rm -r "${libdir}/multiprocessing" || die |
1345 |
+ use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die |
1346 |
|
1347 |
- dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
1348 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
1349 |
|
1350 |
if use examples; then |
1351 |
- insinto /usr/share/doc/${PF}/examples |
1352 |
- find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
1353 |
- doins -r "${S}"/Tools |
1354 |
+ docinto examples |
1355 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
1356 |
+ dodoc -r Tools |
1357 |
fi |
1358 |
insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1359 |
local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
1360 |
@@ -284,7 +266,8 @@ src_install() { |
1361 |
sed \ |
1362 |
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1363 |
-e "s:@PYDOC@:pydoc${PYVER}:" \ |
1364 |
- -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1365 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
1366 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1367 |
|
1368 |
# for python-exec |
1369 |
local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
1370 |
@@ -307,8 +290,7 @@ src_install() { |
1371 |
# python and pythonX |
1372 |
ln -s "../../../bin/${abiver}" \ |
1373 |
"${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
1374 |
- ln -s "python${pymajor}" \ |
1375 |
- "${D}${PYTHON_SCRIPTDIR}/python" || die |
1376 |
+ ln -s "python${pymajor}" "${D}${PYTHON_SCRIPTDIR}/python" || die |
1377 |
# python-config and pythonX-config |
1378 |
# note: we need to create a wrapper rather than symlinking it due |
1379 |
# to some random dirname(argv[0]) magic performed by python-config |
1380 |
@@ -340,11 +322,14 @@ pkg_preinst() { |
1381 |
} |
1382 |
|
1383 |
eselect_python_update() { |
1384 |
- if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
1385 |
+ if [[ -z "$(eselect python show)" || \ |
1386 |
+ ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then |
1387 |
eselect python update |
1388 |
fi |
1389 |
|
1390 |
- if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
1391 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || \ |
1392 |
+ ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]] |
1393 |
+ then |
1394 |
eselect python update --python${PV%%.*} |
1395 |
fi |
1396 |
} |