Skip to contentSkip to conversation

package/python-ws4py: add patch to fit Python 3.7 syntax

PATCH New Asaf Kahlon 2 participants 4 messages Oct 13, 2019 – Oct 14, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/python-ws4py: add patch to fit Python 3.7 syntax

Fixes:
- http://autobuild.buildroot.net/results/2999d8de19ed7bf7a5ce148da4b1b98f144bad9b

---
 ...1-Adjust-ws4py-for-Python-3.7-syntax.patch | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +55 -0
new file mode 100644
index 0000000000..07fbb6ccc1
@@ -0,0 +1,55 @@
+From dfe6f65b7078315c32cebb727e9c47ead7603475 Mon Sep 17 00:00:00 2001
+From: Asaf Kahlon <[email protected]>
+Date: Sun, 13 Oct 2019 16:44:44 +0300
+Subject: [PATCH 1/1] Adjust ws4py for Python 3.7 syntax
+
+Since Python 3.7, "async" has become a keyword and cannot be used.
+Thus, instead of asyncio.async we will use asyncio.ensure_future.
+
+There's also a pull request with this change:
+https://github.com/Lawouach/WebSocket-for-Python/pull/245
+
+Signed-off-by: Asaf Kahlon <[email protected]>
+---
+ ws4py/async_websocket.py    | 4 ++--
+ ws4py/server/tulipserver.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ws4py/async_websocket.py b/ws4py/async_websocket.py
+index 9e2a4c7..ea296b4 100644
+--- a/ws4py/async_websocket.py
++++ b/ws4py/async_websocket.py
+@@ -84,7 +84,7 @@ class WebSocket(_WebSocket):
+         def closeit():
+             yield from self.proto.writer.drain()
+             self.proto.writer.close()
+-        asyncio.async(closeit())
++        asyncio.ensure_future(closeit())
+ 
+     def _write(self, data):
+         """
+@@ -94,7 +94,7 @@ class WebSocket(_WebSocket):
+         def sendit(data):
+             self.proto.writer.write(data)
+             yield from self.proto.writer.drain()
+-        asyncio.async(sendit(data))
++        asyncio.ensure_future(sendit(data))
+ 
+     @asyncio.coroutine
+     def run(self):
+diff --git a/ws4py/server/tulipserver.py b/ws4py/server/tulipserver.py
+index 2786c16..85312a2 100644
+--- a/ws4py/server/tulipserver.py
++++ b/ws4py/server/tulipserver.py
+@@ -40,7 +40,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.ensure_future(self.handle_initial_handshake())
+         f.add_done_callback(self.terminated)
+ 
+     @property
+-- 
+2.20.1
+
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/python-ws4py: add patch to fit Python 3.7 syntax

Quoted 15 lines · Asaf Kahlon

Fixes:
- http://autobuild.buildroot.net/results/2999d8de19ed7bf7a5ce148da4b1b98f144bad9b

---
 ...1-Adjust-ws4py-for-Python-3.7-syntax.patch | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +0 -0
new file mode 100644
index 0000000000..07fbb6ccc1

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 10

Quoted 10 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +10 -0
@@ -0,0 +1,55 @@
+From dfe6f65b7078315c32cebb727e9c47ead7603475 Mon Sep 17 00:00:00 2001
+From: Asaf Kahlon <[email protected]>
+Date: Sun, 13 Oct 2019 16:44:44 +0300
+Subject: [PATCH 1/1] Adjust ws4py for Python 3.7 syntax
+
+Since Python 3.7, "async" has become a keyword and cannot be used.
+Thus, instead of asyncio.async we will use asyncio.ensure_future.
+
+There's also a pull request with this change:
+https://github.com/Lawouach/WebSocket-for-Python/pull/245

So why don't you use the commit from that PR? It looks more complete because it
also fixes a test (not really relevant for us, obviously, but we prefer upstream commits or PRs...)

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 12

Quoted 2 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +2 -0
+
+Signed-off-by: Asaf Kahlon <[email protected]>

You would still need your SoB to it of course.

Regards,
Arnout

Quoted 44 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +43 -0
+---
+ ws4py/async_websocket.py    | 4 ++--
+ ws4py/server/tulipserver.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ws4py/async_websocket.py b/ws4py/async_websocket.py
+index 9e2a4c7..ea296b4 100644
+--- a/ws4py/async_websocket.py
++++ b/ws4py/async_websocket.py
+@@ -84,7 +84,7 @@ class WebSocket(_WebSocket):
+         def closeit():
+             yield from self.proto.writer.drain()
+             self.proto.writer.close()
+-        asyncio.async(closeit())
++        asyncio.ensure_future(closeit())
+ 
+     def _write(self, data):
+         """
+@@ -94,7 +94,7 @@ class WebSocket(_WebSocket):
+         def sendit(data):
+             self.proto.writer.write(data)
+             yield from self.proto.writer.drain()
+-        asyncio.async(sendit(data))
++        asyncio.ensure_future(sendit(data))
+ 
+     @asyncio.coroutine
+     def run(self):
+diff --git a/ws4py/server/tulipserver.py b/ws4py/server/tulipserver.py
+index 2786c16..85312a2 100644
+--- a/ws4py/server/tulipserver.py
++++ b/ws4py/server/tulipserver.py
+@@ -40,7 +40,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.ensure_future(self.handle_initial_handshake())
+         f.add_done_callback(self.terminated)
+ 
+     @property
+-- 
+2.20.1
+
#2 lore raw

PATCH 1/1 package/python-ws4py: add patch to fit Python 3.7 syntax

Hello,

Quoted 25 lines · Arnout Vandecappelle
Quoted 21 lines · Asaf Kahlon

Fixes:
- http://autobuild.buildroot.net/results/2999d8de19ed7bf7a5ce148da4b1b98f144bad9b

---
 ...1-Adjust-ws4py-for-Python-3.7-syntax.patch | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +6 -0
new file mode 100644
index 0000000000..07fbb6ccc1
@@ -0,0 +1,55 @@
+From dfe6f65b7078315c32cebb727e9c47ead7603475 Mon Sep 17 00:00:00 2001
+From: Asaf Kahlon <[email protected]>
+Date: Sun, 13 Oct 2019 16:44:44 +0300
+Subject: [PATCH 1/1] Adjust ws4py for Python 3.7 syntax
+
+Since Python 3.7, "async" has become a keyword and cannot be used.
Quoted 8 lines

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 10

Quoted 4 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +4 -0
+Thus, instead of asyncio.async we will use asyncio.ensure_future.
+
+There's also a pull request with this change:
+https://github.com/Lawouach/WebSocket-for-Python/pull/245

So why don't you use the commit from that PR? It looks more complete because it
also fixes a test (not really relevant for us, obviously, but we prefer upstream commits or PRs...)

Actually, I tried that, but then I realized that the patch won't apply since the test file is not included on the tarball.

Quoted 6 lines

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 12

Quoted 3 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +2 -0
+
+Signed-off-by: Asaf Kahlon <[email protected]>

You would still need your SoB to it of course.

It probably doesn't matter, but the guy doesn't have his own SoB on the PR...

Anyway, it seems like the original patch can't be taken as-is. Maybe I should amend the commit message to make it clear why a custom patch is needed?

Quoted 39 lines

Regards,
Arnout

Quoted 36 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +36 -0
+---
+ ws4py/async_websocket.py    | 4 ++--
+ ws4py/server/tulipserver.py | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ws4py/async_websocket.py b/ws4py/async_websocket.py
+index 9e2a4c7..ea296b4 100644
+--- a/ws4py/async_websocket.py
++++ b/ws4py/async_websocket.py
+@@ -84,7 +84,7 @@ class WebSocket(_WebSocket):
+         def closeit():
+             yield from self.proto.writer.drain()
+             self.proto.writer.close()
+-        asyncio.async(closeit())
++        asyncio.ensure_future(closeit())
+
+     def _write(self, data):
+         """
+@@ -94,7 +94,7 @@ class WebSocket(_WebSocket):
+         def sendit(data):
+             self.proto.writer.write(data)
+             yield from self.proto.writer.drain()
+-        asyncio.async(sendit(data))
++        asyncio.ensure_future(sendit(data))
+
+     @asyncio.coroutine
+     def run(self):
+diff --git a/ws4py/server/tulipserver.py b/ws4py/server/tulipserver.py
+index 2786c16..85312a2 100644
+--- a/ws4py/server/tulipserver.py
++++ b/ws4py/server/tulipserver.py
+@@ -40,7 +40,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())
Quoted 8 lines

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 55

Quoted 8 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +7 -0
++        f = asyncio.ensure_future(self.handle_initial_handshake())
+         f.add_done_callback(self.terminated)
+
+     @property
+--
+2.20.1
+

Regards,
Asaf.

#3 lore raw

PATCH 1/1 package/python-ws4py: add patch to fit Python 3.7 syntax

Quoted 47 lines · Asaf Kahlon

Hello,

Quoted 25 lines · Arnout Vandecappelle
Quoted 21 lines · Asaf Kahlon

Fixes:
- http://autobuild.buildroot.net/results/2999d8de19ed7bf7a5ce148da4b1b98f144bad9b

---
 ...1-Adjust-ws4py-for-Python-3.7-syntax.patch | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +6 -0
new file mode 100644
index 0000000000..07fbb6ccc1
@@ -0,0 +1,55 @@
+From dfe6f65b7078315c32cebb727e9c47ead7603475 Mon Sep 17 00:00:00 2001
+From: Asaf Kahlon <[email protected]>
+Date: Sun, 13 Oct 2019 16:44:44 +0300
+Subject: [PATCH 1/1] Adjust ws4py for Python 3.7 syntax
+
+Since Python 3.7, "async" has become a keyword and cannot be used.
Quoted 8 lines

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 10

Quoted 4 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +4 -0
+Thus, instead of asyncio.async we will use asyncio.ensure_future.
+
+There's also a pull request with this change:
+https://github.com/Lawouach/WebSocket-for-Python/pull/245

So why don't you use the commit from that PR? It looks more complete because it
also fixes a test (not really relevant for us, obviously, but we prefer upstream commits or PRs...)

Actually, I tried that, but then I realized that the patch won't apply since the test file is not included on the tarball.

Quoted 6 lines

package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch line 12

Quoted 3 lines
package/python-ws4py/0001-Adjust-ws4py-for-Python-3.7-syntax.patch new file +2 -0
+
+Signed-off-by: Asaf Kahlon <[email protected]>

You would still need your SoB to it of course.

Quoted 5 lines

It probably doesn't matter, but the guy doesn't have his own SoB on the PR...

Anyway, it seems like the original patch can't be taken as-is. Maybe I should amend the commit message to make it clear why a custom patch is needed?

Don't bother, I did that and applied to master, thanks.

Regards,
Arnout