14
0

Accepting request 1129879 from devel:languages:python

- Add patch support-python3.12.patch:
  * Support Python 3.12 changes.

OBS-URL: https://build.opensuse.org/request/show/1129879
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-eventlet?expand=0&rev=53
This commit is contained in:
2023-12-01 20:24:36 +00:00
committed by Git OBS Bridge
3 changed files with 163 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 30 04:41:02 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python3.12.patch:
* Support Python 3.12 changes.
-------------------------------------------------------------------
Tue Nov 7 06:07:34 UTC 2023 - Jiri Slaby <jslaby@suse.cz>

View File

@@ -33,6 +33,8 @@ Patch0: denose-eventlet.patch
Patch2: python-eventlet-FTBFS2028.patch
# PATCH-FIX-UPSTREAM fix-py3-rlock.patch gh#eventlet/eventlet#754
Patch3: fix-py3-rlock.patch
# PATCH-FIX-OPENSUSE Based on https://src.fedoraproject.org/rpms/python-eventlet/raw/rawhide/f/python3.12.patch
Patch4: support-python3.12.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros

155
support-python3.12.patch Normal file
View File

@@ -0,0 +1,155 @@
Index: eventlet-0.33.3/eventlet/green/http/client.py
===================================================================
--- eventlet-0.33.3.orig/eventlet/green/http/client.py
+++ eventlet-0.33.3/eventlet/green/http/client.py
@@ -52,7 +52,7 @@
# 8. By copying, installing or otherwise using Python, Licensee
# agrees to be bound by the terms and conditions of this License
# Agreement.
-"""HTTP/1.1 client library
+r"""HTTP/1.1 client library
<intro stuff goes here>
<other stuff, too>
@@ -1447,6 +1447,18 @@ try:
except ImportError:
pass
else:
+ def _create_https_context(http_version):
+ # Function also used by urllib.request to be able to set the check_hostname
+ # attribute on a context object.
+ context = ssl._create_default_https_context()
+ # send ALPN extension to indicate HTTP/1.1 protocol
+ if http_version == 11:
+ context.set_alpn_protocols(['http/1.1'])
+ # enable PHA for TLS 1.3 connections if available
+ if context.post_handshake_auth is not None:
+ context.post_handshake_auth = True
+ return context
+
class HTTPSConnection(HTTPConnection):
"This class allows communication via SSL."
@@ -1463,13 +1475,9 @@ else:
self.key_file = key_file
self.cert_file = cert_file
if context is None:
- context = ssl._create_default_https_context()
- will_verify = context.verify_mode != ssl.CERT_NONE
- if check_hostname is None:
- check_hostname = context.check_hostname
- if check_hostname and not will_verify:
- raise ValueError("check_hostname needs a SSL context with "
- "either CERT_OPTIONAL or CERT_REQUIRED")
+ context = _create_https_context(self._http_vsn)
+ if check_hostname is not None:
+ context.check_hostname = check_hostname
if key_file or cert_file:
context.load_cert_chain(cert_file, key_file)
self._context = context
Index: eventlet-0.33.3/eventlet/green/ssl.py
===================================================================
--- eventlet-0.33.3.orig/eventlet/green/ssl.py
+++ eventlet-0.33.3/eventlet/green/ssl.py
@@ -22,21 +22,17 @@ __patched__ = [
'create_default_context', '_create_default_https_context']
_original_sslsocket = __ssl.SSLSocket
-_original_wrap_socket = __ssl.wrap_socket
_original_sslcontext = getattr(__ssl, 'SSLContext', None)
_is_under_py_3_7 = sys.version_info < (3, 7)
@contextmanager
def _original_ssl_context(*args, **kwargs):
- tmp_sslcontext = _original_wrap_socket.__globals__.get('SSLContext', None)
tmp_sslsocket = _original_sslsocket._create.__globals__.get('SSLSocket', None)
_original_sslsocket._create.__globals__['SSLSocket'] = _original_sslsocket
- _original_wrap_socket.__globals__['SSLContext'] = _original_sslcontext
try:
yield
finally:
- _original_wrap_socket.__globals__['SSLContext'] = tmp_sslcontext
_original_sslsocket._create.__globals__['SSLSocket'] = tmp_sslsocket
@@ -76,16 +72,21 @@ class GreenSSLSocket(_original_sslsocket
session=kw.get('session'),
)
else:
- ret = _original_wrap_socket(
+ context = _original_sslcontext(protocol=ssl_version)
+ context.options |= cert_reqs
+ if certfile or keyfile:
+ context.load_cert_chain(
+ certfile=certfile,
+ keyfile=keyfile,
+ )
+ if ca_certs:
+ context.load_verify_locations(ca_certs)
+ if ciphers := kw.get('ciphers'):
+ context.set_ciphers(ciphers)
+ ret = context.wrap_socket(
sock=sock.fd,
- keyfile=keyfile,
- certfile=certfile,
server_side=server_side,
- cert_reqs=cert_reqs,
- ssl_version=ssl_version,
- ca_certs=ca_certs,
do_handshake_on_connect=False,
- ciphers=kw.get('ciphers'),
)
ret.keyfile = keyfile
ret.certfile = certfile
Index: eventlet-0.33.3/eventlet/green/thread.py
===================================================================
--- eventlet-0.33.3.orig/eventlet/green/thread.py
+++ eventlet-0.33.3/eventlet/green/thread.py
@@ -113,3 +113,6 @@ if hasattr(__thread, 'stack_size'):
# this thread will suffer
from eventlet.corolocal import local as _local
+
+if hasattr(__thread, 'daemon_threads_allowed'):
+ daemon_threads_allowed = __thread.daemon_threads_allowed
Index: eventlet-0.33.3/tests/tpool_test.py
===================================================================
--- eventlet-0.33.3.orig/tests/tpool_test.py
+++ eventlet-0.33.3/tests/tpool_test.py
@@ -315,11 +315,11 @@ class TpoolLongTests(tests.LimitedTestCa
@tests.skip_with_pyevent
def test_a_buncha_stuff(self):
- assert_ = self.assert_
+ assertTrue = self.assertTrue
class Dummy(object):
def foo(self, when, token=None):
- assert_(token is not None)
+ assertTrue(token is not None)
time.sleep(random.random() / 200.0)
return token
@@ -359,7 +359,7 @@ class TpoolLongTests(tests.LimitedTestCa
first_created = middle_objs - initial_objs
gc.collect()
second_created = len(gc.get_objects()) - middle_objs
- self.assert_(second_created - first_created < 10,
+ self.assertTrue(second_created - first_created < 10,
"first loop: %s, second loop: %s" % (first_created,
second_created))
tpool.killall()
Index: eventlet-0.33.3/eventlet/debug.py
===================================================================
--- eventlet-0.33.3.orig/eventlet/debug.py
+++ eventlet-0.33.3/eventlet/debug.py
@@ -13,7 +13,7 @@ __all__ = ['spew', 'unspew', 'format_hub
'hub_prevent_multiple_readers', 'hub_timer_stacks',
'hub_blocking_detection']
-_token_splitter = re.compile('\W+')
+_token_splitter = re.compile(r'\W+')
class Spew(object):