commit:     5d6ab607b4a4c0c80ebb2be419f76220d539aaf2
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun May 10 12:00:58 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun May 10 13:01:52 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d6ab607

dev-python/ws4py: rev bump for Py3.7/3.8 compatibility

Had to drop keywords because dev-python/cherrypy with
Py3.7/3.8 support isn't ready for arm.

Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 .../ws4py-0.5.1-python3.7+-compatibility.patch     | 93 ++++++++++++++++++++++
 .../{ws4py-9999.ebuild => ws4py-0.5.1-r1.ebuild}   | 16 ++--
 dev-python/ws4py/ws4py-9999.ebuild                 | 16 ++--
 3 files changed, 111 insertions(+), 14 deletions(-)

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 00000000000..12b14111634
--- /dev/null
+++ b/dev-python/ws4py/files/ws4py-0.5.1-python3.7+-compatibility.patch
@@ -0,0 +1,93 @@
+From: Matthias Klose <[email protected]>
+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

diff --git a/dev-python/ws4py/ws4py-9999.ebuild 
b/dev-python/ws4py/ws4py-0.5.1-r1.ebuild
similarity index 82%
copy from dev-python/ws4py/ws4py-9999.ebuild
copy to dev-python/ws4py/ws4py-0.5.1-r1.ebuild
index 461f735ab78..21de5cde42d 100644
--- a/dev-python/ws4py/ws4py-9999.ebuild
+++ b/dev-python/ws4py/ws4py-0.5.1-r1.ebuild
@@ -6,16 +6,15 @@
 # Same for www-servers/tornado and USE=client ... so why not???
 # pypy is viable but better with a cutdown set of deps
 
-EAPI=6
-PYTHON_COMPAT=( python3_6 )
-PYTHON_REQ_USE="threads?"
+EAPI=7
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="threads(+)?"
 
 inherit distutils-r1
 if [[ ${PV} == "9999" ]] ; then
        EGIT_REPO_URI="https://github.com/Lawouach/WebSocket-for-Python.git";
        inherit git-r3
 else
-       inherit vcs-snapshot
        
SRC_URI="https://github.com/Lawouach/WebSocket-for-Python/archive/${PV}.tar.gz 
-> ${P}.tar.gz"
        KEYWORDS="~amd64 ~arm ~x86"
 fi
@@ -30,15 +29,18 @@ RESTRICT="!test? ( test )"
 # doc build requires sphinxcontrib ext packages absent from portage
 
 RDEPEND=">=dev-python/greenlet-0.4.1[${PYTHON_USEDEP}]
-               >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
-               client? ( >=www-servers/tornado-3.1[${PYTHON_USEDEP}] )
-               server? ( >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}] )"
+       >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
+       client? ( >=www-servers/tornado-3.1[${PYTHON_USEDEP}] )
+       server? ( >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}] )"
+
 DEPEND="test? (
                >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}]
                dev-python/unittest2[${PYTHON_USEDEP}]
                >=dev-python/mock-1.0.1[${PYTHON_USEDEP}]
        )"
 
+PATCHES=( "${FILESDIR}"/${PN}-0.5.1-python3.7+-compatibility.patch )
+
 python_test() {
        # testsuite displays an issue with mock under py3 but is non fatal
        "${PYTHON}" -m unittest discover || die "Tests failed under ${EPYTHON}"

diff --git a/dev-python/ws4py/ws4py-9999.ebuild 
b/dev-python/ws4py/ws4py-9999.ebuild
index 461f735ab78..21de5cde42d 100644
--- a/dev-python/ws4py/ws4py-9999.ebuild
+++ b/dev-python/ws4py/ws4py-9999.ebuild
@@ -6,16 +6,15 @@
 # Same for www-servers/tornado and USE=client ... so why not???
 # pypy is viable but better with a cutdown set of deps
 
-EAPI=6
-PYTHON_COMPAT=( python3_6 )
-PYTHON_REQ_USE="threads?"
+EAPI=7
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="threads(+)?"
 
 inherit distutils-r1
 if [[ ${PV} == "9999" ]] ; then
        EGIT_REPO_URI="https://github.com/Lawouach/WebSocket-for-Python.git";
        inherit git-r3
 else
-       inherit vcs-snapshot
        
SRC_URI="https://github.com/Lawouach/WebSocket-for-Python/archive/${PV}.tar.gz 
-> ${P}.tar.gz"
        KEYWORDS="~amd64 ~arm ~x86"
 fi
@@ -30,15 +29,18 @@ RESTRICT="!test? ( test )"
 # doc build requires sphinxcontrib ext packages absent from portage
 
 RDEPEND=">=dev-python/greenlet-0.4.1[${PYTHON_USEDEP}]
-               >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
-               client? ( >=www-servers/tornado-3.1[${PYTHON_USEDEP}] )
-               server? ( >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}] )"
+       >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
+       client? ( >=www-servers/tornado-3.1[${PYTHON_USEDEP}] )
+       server? ( >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}] )"
+
 DEPEND="test? (
                >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}]
                dev-python/unittest2[${PYTHON_USEDEP}]
                >=dev-python/mock-1.0.1[${PYTHON_USEDEP}]
        )"
 
+PATCHES=( "${FILESDIR}"/${PN}-0.5.1-python3.7+-compatibility.patch )
+
 python_test() {
        # testsuite displays an issue with mock under py3 but is non fatal
        "${PYTHON}" -m unittest discover || die "Tests failed under ${EPYTHON}"

Reply via email to