summaryrefslogtreecommitdiff
path: root/dev-python/ws4py/files
diff options
context:
space:
mode:
authorPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
committerPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
commitecdac123787b96ce6649f0f91da12ea6458cc2b1 (patch)
treeb89c74d9e6fe6e8aebc4c77bcbeb4ab73214127d /dev-python/ws4py/files
parent1be72aa41cf41dedadeecf59dca9f01de6381f5e (diff)
downloadbaldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.gz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.xz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.zip
Updating liguros repo
Diffstat (limited to 'dev-python/ws4py/files')
-rw-r--r--dev-python/ws4py/files/ws4py-0.3.4-tests.patch67
-rw-r--r--dev-python/ws4py/files/ws4py-0.5.1-python3.7+-compatibility.patch93
2 files changed, 160 insertions, 0 deletions
diff --git a/dev-python/ws4py/files/ws4py-0.3.4-tests.patch b/dev-python/ws4py/files/ws4py-0.3.4-tests.patch
new file mode 100644
index 000000000000..dde60f2ed04d
--- /dev/null
+++ b/dev-python/ws4py/files/ws4py-0.3.4-tests.patch
@@ -0,0 +1,67 @@
+From 185c88cb6779b3b15a5c14047bb62b8fcb8d2e57 Mon Sep 17 00:00:00 2001
+From: Sebastian Pipping <sebastian@pipping.org>
+Date: Sat, 10 Mar 2018 00:33:37 +0100
+Subject: [PATCH] Fix AttributeErrors from mistaken Mock.assert_call_once_with
+
+This commit is a backport/subset of:
+https://github.com/Lawouach/WebSocket-for-Python/commit/b5d47f7b3497f1b713a20fe6306b7d9afdd8c408
+---
+ test/test_manager.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/test/test_manager.py b/test/test_manager.py
+index 8c229b0..aacc162 100644
+--- a/test/test_manager.py
++++ b/test/test_manager.py
+@@ -16,10 +16,10 @@ class WSManagerTest(unittest.TestCase):
+ ws.sock.fileno.return_value = 1
+
+ m.add(ws)
+- m.poller.register.assert_call_once_with(ws)
++ m.poller.register.assert_called_once_with(1)
+
+ m.remove(ws)
+- m.poller.unregister.assert_call_once_with(ws)
++ m.poller.unregister.assert_called_once_with(1)
+
+ @patch('ws4py.manager.SelectPoller')
+ def test_cannot_add_websocket_more_than_once(self, MockSelectPoller):
+@@ -49,7 +49,7 @@ class WSManagerTest(unittest.TestCase):
+ self.assertEqual(len(m), 1)
+ m.remove(ws)
+ self.assertEqual(len(m), 0)
+- m.poller.unregister.assert_call_once_with(ws)
++ m.poller.unregister.assert_called_once_with(1)
+ m.poller.reset_mock()
+
+ m.remove(ws)
+@@ -98,7 +98,7 @@ class WSManagerTest(unittest.TestCase):
+ m.add(ws)
+ m.start()
+
+- ws.terminate.assert_call_once_with()
++ ws.terminate.assert_called_once_with()
+
+ m.stop()
+
+@@ -109,7 +109,7 @@ class WSManagerTest(unittest.TestCase):
+ ws = MagicMock()
+ m.add(ws)
+ m.close_all()
+- ws.terminate.assert_call_once_with(1001, 'Server is shutting down')
++ ws.close.assert_called_once_with(code=1001, reason='Server is shutting down')
+
+ @patch('ws4py.manager.SelectPoller')
+ def test_broadcast(self, MockSelectPoller):
+@@ -120,7 +120,7 @@ class WSManagerTest(unittest.TestCase):
+ m.add(ws)
+
+ m.broadcast(b'hello there')
+- ws.send.assert_call_once_with(b'hello there')
++ ws.send.assert_called_once_with(b'hello there', False)
+
+ @patch('ws4py.manager.SelectPoller')
+ def test_broadcast_failure_must_not_break_caller(self, MockSelectPoller):
+--
+2.16.2
+
diff --git a/dev-python/ws4py/files/ws4py-0.5.1-python3.7+-compatibility.patch b/dev-python/ws4py/files/ws4py-0.5.1-python3.7+-compatibility.patch
new file mode 100644
index 000000000000..12b14111634a
--- /dev/null
+++ b/dev-python/ws4py/files/ws4py-0.5.1-python3.7+-compatibility.patch
@@ -0,0 +1,93 @@
+From: Matthias Klose <doko@ubuntu.com>
+Date: Sun, 29 Jul 2018 09:01:36 +0200
+Subject: Fix compatibility with Python 3.7.
+Origin: http://launchpadlibrarian.net/380629852/python-ws4py_0.4.2+dfsg1-2_0.4.2+dfsg1-2ubuntu1.diff.gz
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903529
+
+---
+ test/autobahn_test_servers.py | 4 ++--
+ ws4py/async_websocket.py | 9 +++++++--
+ ws4py/server/tulipserver.py | 7 ++++++-
+ 3 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/test/autobahn_test_servers.py b/test/autobahn_test_servers.py
+index 3e33f82..8b77954 100644
+--- a/test/autobahn_test_servers.py
++++ b/test/autobahn_test_servers.py
+@@ -142,7 +142,7 @@ def run_python_wsgi(host="127.0.0.1", port=9002):
+ """
+ run_python_wsgi_async(host, port, False)
+
+-def run_python_wsgi_async(host="127.0.0.1", port=9010, async=True):
++def run_python_wsgi_async(host="127.0.0.1", port=9010, async_=True):
+ """
+ Runs wsgi server on python 2.x with async middleware"
+ """
+@@ -153,7 +153,7 @@ def run_python_wsgi_async(host="127.0.0.1", port=9010, async=True):
+ from ws4py.server.wsgiutils import WebSocketWSGIApplication
+
+ app = WebSocketWSGIApplication(handler_cls=EchoWebSocket)
+- if async:
++ if async_:
+ def middleware(app):
+ def later(environ, start_response):
+ for part in app(environ, start_response):
+diff --git a/ws4py/async_websocket.py b/ws4py/async_websocket.py
+index 9e2a4c7..096763d 100644
+--- a/ws4py/async_websocket.py
++++ b/ws4py/async_websocket.py
+@@ -18,6 +18,11 @@ delegated_generator_websocket_on_top_of_asyncio.py
+ import asyncio
+ import types
+
++try: # pragma: no cover
++ asyncio_ensure_future = asyncio.ensure_future # Python >= 3.5
++except AttributeError: # pragma: no cover
++ asyncio_ensure_future = getattr(asyncio, 'async') # Python < 3.5
++
+ from ws4py.websocket import WebSocket as _WebSocket
+ from ws4py.messaging import Message
+
+@@ -84,7 +89,7 @@ class WebSocket(_WebSocket):
+ def closeit():
+ yield from self.proto.writer.drain()
+ self.proto.writer.close()
+- asyncio.async(closeit())
++ asyncio.asyncio_ensure_future(closeit())
+
+ def _write(self, data):
+ """
+@@ -94,7 +99,7 @@ class WebSocket(_WebSocket):
+ def sendit(data):
+ self.proto.writer.write(data)
+ yield from self.proto.writer.drain()
+- asyncio.async(sendit(data))
++ asyncio.asyncio_ensure_future(sendit(data))
+
+ @asyncio.coroutine
+ def run(self):
+diff --git a/ws4py/server/tulipserver.py b/ws4py/server/tulipserver.py
+index 2786c16..ce2e9fb 100644
+--- a/ws4py/server/tulipserver.py
++++ b/ws4py/server/tulipserver.py
+@@ -6,6 +6,11 @@ import io
+
+ import asyncio
+
++try: # pragma: no cover
++ asyncio_ensure_future = asyncio.ensure_future # Python >= 3.5
++except AttributeError: # pragma: no cover
++ asyncio_ensure_future = getattr(asyncio, 'async') # Python < 3.5
++
+ from ws4py import WS_KEY, WS_VERSION
+ from ws4py.exc import HandshakeError
+ from ws4py.websocket import WebSocket
+@@ -40,7 +45,7 @@ class WebSocketProtocol(asyncio.StreamReaderProtocol):
+ #self.stream.set_transport(transport)
+ asyncio.StreamReaderProtocol.connection_made(self, transport)
+ # Let make it concurrent for others to tag along
+- f = asyncio.async(self.handle_initial_handshake())
++ f = asyncio.asyncio_ensure_future(self.handle_initial_handshake())
+ f.add_done_callback(self.terminated)
+
+ @property