public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/websockify/, dev-python/websockify/files/
@ 2020-09-29 12:13 Louis Sautier
  0 siblings, 0 replies; 3+ messages in thread
From: Louis Sautier @ 2020-09-29 12:13 UTC (permalink / raw
  To: gentoo-commits

commit:     2f08b0dbe5e632631acd5a426b523455c0654524
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 29 12:12:03 2020 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Tue Sep 29 12:12:03 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f08b0db

dev-python/websockify: add Python 3.{8,9} support, tests, manpage

Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 .../files/websockify-0.9.0-mock-tests.patch        | 392 +++++++++++++++++++++
 dev-python/websockify/websockify-0.9.0-r1.ebuild   |  31 ++
 2 files changed, 423 insertions(+)

diff --git a/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch b/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch
new file mode 100644
index 00000000000..a6af9508e07
--- /dev/null
+++ b/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch
@@ -0,0 +1,392 @@
+From 992e09eac484f25871b7fcfc6d11b8e5beac9edb Mon Sep 17 00:00:00 2001
+From: Pierre Ossman <ossman@cendio.se>
+Date: Fri, 21 Aug 2020 10:50:11 +0200
+Subject: [PATCH] Convert tests from mox to mock
+
+mox is deprecated upstream in favour of mock
+---
+ test-requirements.txt          |   2 +-
+ tests/test_websocketproxy.py   |  34 ++++------
+ tests/test_websockifyserver.py | 111 +++++++++++++--------------------
+ 3 files changed, 58 insertions(+), 89 deletions(-)
+
+diff --git a/test-requirements.txt b/test-requirements.txt
+index a63a15e..8e01437 100644
+--- a/test-requirements.txt
++++ b/test-requirements.txt
+@@ -1,4 +1,4 @@
+-mox3
++mock
+ nose
+ jwcrypto;python_version>="2.7"
+ redis;python_version>="2.7"
+diff --git a/tests/test_websocketproxy.py b/tests/test_websocketproxy.py
+index c0a8d93..d8a4916 100644
+--- a/tests/test_websocketproxy.py
++++ b/tests/test_websocketproxy.py
+@@ -20,10 +20,11 @@
+ import unittest
+ import unittest
+ import socket
++try:
++    from mock import patch
++except ImportError:
++    from unittest.mock import patch
+ 
+-from mox3 import stubout
+-
+-from websockify import websockifyserver
+ from websockify import websocketproxy
+ from websockify import token_plugins
+ from websockify import auth_plugins
+@@ -74,16 +75,14 @@ def __init__(self):
+ class ProxyRequestHandlerTestCase(unittest.TestCase):
+     def setUp(self):
+         super(ProxyRequestHandlerTestCase, self).setUp()
+-        self.stubs = stubout.StubOutForTesting()
+         self.handler = websocketproxy.ProxyRequestHandler(
+             FakeSocket(''), "127.0.0.1", FakeServer())
+         self.handler.path = "https://localhost:6080/websockify?token=blah"
+         self.handler.headers = None
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
+-                       staticmethod(lambda *args, **kwargs: None))
++        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
+ 
+     def tearDown(self):
+-        self.stubs.UnsetAll()
++        patch.stopall()
+         super(ProxyRequestHandlerTestCase, self).tearDown()
+ 
+     def test_get_target(self):
+@@ -120,8 +119,7 @@ class TestPlugin(token_plugins.BasePlugin):
+             def lookup(self, token):
+                 return (self.source + token).split(',')
+ 
+-        self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                       staticmethod(lambda *args, **kwargs: None))
++        patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+         self.handler.server.token_plugin = TestPlugin("somehost,")
+         self.handler.validate_connection()
+@@ -138,8 +136,7 @@ def test_asymmetric_jws_token_plugin(self):
+             jwt_token.make_signed_token(key)
+             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
+ 
+-            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                        staticmethod(lambda *args, **kwargs: None))
++            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/public.pem")
+             self.handler.validate_connection()
+@@ -155,8 +152,7 @@ def test_asymmetric_jws_token_plugin_with_illigal_key_exception(self):
+             jwt_token.make_signed_token(key)
+             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
+ 
+-            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                        staticmethod(lambda *args, **kwargs: None))
++            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+             self.handler.server.token_plugin = token_plugins.JWTTokenApi("wrong.pub")
+             self.assertRaises(self.handler.server.EClose, 
+@@ -171,8 +167,7 @@ def test_symmetric_jws_token_plugin(self):
+             jwt_token.make_signed_token(key)
+             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
+ 
+-            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                        staticmethod(lambda *args, **kwargs: None))
++            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/symmetric.key")
+             self.handler.validate_connection()
+@@ -188,8 +183,7 @@ def test_symmetric_jws_token_plugin_with_illigal_key_exception(self):
+             jwt_token.make_signed_token(key)
+             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
+ 
+-            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                        staticmethod(lambda *args, **kwargs: None))
++            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+             self.handler.server.token_plugin = token_plugins.JWTTokenApi("wrong_sauce")
+             self.assertRaises(self.handler.server.EClose, 
+@@ -210,8 +204,7 @@ def test_asymmetric_jwe_token_plugin(self):
+ 
+             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwe_token.serialize())
+ 
+-            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                        staticmethod(lambda *args, **kwargs: None))
++            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/private.pem")
+             self.handler.validate_connection()
+@@ -225,8 +218,7 @@ def authenticate(self, headers, target_host, target_port):
+                 if target_host == self.source:
+                     raise auth_plugins.AuthenticationError(response_msg="some_error")
+ 
+-        self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
+-                       staticmethod(lambda *args, **kwargs: None))
++        patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
+ 
+         self.handler.server.auth_plugin = TestPlugin("somehost")
+         self.handler.server.target_host = "somehost"
+diff --git a/tests/test_websockifyserver.py b/tests/test_websockifyserver.py
+index b9312dc..a089f55 100644
+--- a/tests/test_websockifyserver.py
++++ b/tests/test_websockifyserver.py
+@@ -22,7 +22,10 @@
+ import shutil
+ import socket
+ import ssl
+-from mox3 import stubout
++try:
++    from mock import patch, MagicMock, ANY
++except ImportError:
++    from unittest.mock import patch, MagicMock, ANY
+ import sys
+ import tempfile
+ import unittest
+@@ -73,22 +76,13 @@ def makefile(self, mode='r', buffsize=None):
+ class WebSockifyRequestHandlerTestCase(unittest.TestCase):
+     def setUp(self):
+         super(WebSockifyRequestHandlerTestCase, self).setUp()
+-        self.stubs = stubout.StubOutForTesting()
+         self.tmpdir = tempfile.mkdtemp('-websockify-tests')
+         # Mock this out cause it screws tests up
+-        self.stubs.Set(os, 'chdir', lambda *args, **kwargs: None)
+-        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
+-                       lambda *args, **kwargs: None)
+-
+-        def fake_send_error(self, code, message=None, explain=None):
+-            self.last_code = code
+-
+-        self.stubs.Set(BaseHTTPRequestHandler, 'send_error',
+-                       fake_send_error)
++        patch('os.chdir').start()
+ 
+     def tearDown(self):
+         """Called automatically after each test."""
+-        self.stubs.UnsetAll()
++        patch.stopall()
+         os.rmdir(self.tmpdir)
+         super(WebSockifyRequestHandlerTestCase, self).tearDown()
+ 
+@@ -101,47 +95,36 @@ def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
+             record=self.tmpdir, daemon=False, ssl_only=0, idle_timeout=1,
+             **kwargs)
+ 
+-    def test_normal_get_with_only_upgrade_returns_error(self):
++    @patch('websockify.websockifyserver.WebSockifyRequestHandler.send_error')
++    def test_normal_get_with_only_upgrade_returns_error(self, send_error):
+         server = self._get_server(web=None)
+         handler = websockifyserver.WebSockifyRequestHandler(
+             FakeSocket('GET /tmp.txt HTTP/1.1'), '127.0.0.1', server)
+ 
+-        def fake_send_response(self, code, message=None):
+-            self.last_code = code
+-
+-        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
+-                       fake_send_response)
+-
+         handler.do_GET()
+-        self.assertEqual(handler.last_code, 405)
++        send_error.assert_called_with(405, ANY)
+ 
+-    def test_list_dir_with_file_only_returns_error(self):
++    @patch('websockify.websockifyserver.WebSockifyRequestHandler.send_error')
++    def test_list_dir_with_file_only_returns_error(self, send_error):
+         server = self._get_server(file_only=True)
+         handler = websockifyserver.WebSockifyRequestHandler(
+             FakeSocket('GET / HTTP/1.1'), '127.0.0.1', server)
+ 
+-        def fake_send_response(self, code, message=None):
+-            self.last_code = code
+-
+-        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
+-                       fake_send_response)
+-
+         handler.path = '/'
+         handler.do_GET()
+-        self.assertEqual(handler.last_code, 404)
++        send_error.assert_called_with(404, ANY)
+ 
+ 
+ class WebSockifyServerTestCase(unittest.TestCase):
+     def setUp(self):
+         super(WebSockifyServerTestCase, self).setUp()
+-        self.stubs = stubout.StubOutForTesting()
+         self.tmpdir = tempfile.mkdtemp('-websockify-tests')
+         # Mock this out cause it screws tests up
+-        self.stubs.Set(os, 'chdir', lambda *args, **kwargs: None)
++        patch('os.chdir').start()
+ 
+     def tearDown(self):
+         """Called automatically after each test."""
+-        self.stubs.UnsetAll()
++        patch.stopall()
+         os.rmdir(self.tmpdir)
+         super(WebSockifyServerTestCase, self).tearDown()
+ 
+@@ -154,10 +137,10 @@ def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
+ 
+     def test_daemonize_raises_error_while_closing_fds(self):
+         server = self._get_server(daemon=True, ssl_only=1, idle_timeout=1)
+-        self.stubs.Set(os, 'fork', lambda *args: 0)
+-        self.stubs.Set(signal, 'signal', lambda *args: None)
+-        self.stubs.Set(os, 'setsid', lambda *args: None)
+-        self.stubs.Set(os, 'close', raise_oserror)
++        patch('os.fork').start().return_value = 0
++        patch('signal.signal').start()
++        patch('os.setsid').start()
++        patch('os.close').start().side_effect = raise_oserror
+         self.assertRaises(OSError, server.daemonize, keepfd=None, chdir='./')
+ 
+     def test_daemonize_ignores_ebadf_error_while_closing_fds(self):
+@@ -165,11 +148,11 @@ def raise_oserror_ebadf(fd):
+             raise OSError(errno.EBADF, 'fake error')
+ 
+         server = self._get_server(daemon=True, ssl_only=1, idle_timeout=1)
+-        self.stubs.Set(os, 'fork', lambda *args: 0)
+-        self.stubs.Set(os, 'setsid', lambda *args: None)
+-        self.stubs.Set(signal, 'signal', lambda *args: None)
+-        self.stubs.Set(os, 'close', raise_oserror_ebadf)
+-        self.stubs.Set(os, 'open', raise_oserror)
++        patch('os.fork').start().return_value = 0
++        patch('signal.signal').start()
++        patch('os.setsid').start()
++        patch('os.close').start().side_effect = raise_oserror_ebadf
++        patch('os.open').start().side_effect = raise_oserror
+         self.assertRaises(OSError, server.daemonize, keepfd=None, chdir='./')
+ 
+     def test_handshake_fails_on_not_ready(self):
+@@ -178,7 +161,7 @@ def test_handshake_fails_on_not_ready(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             return ([], [], [])
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         self.assertRaises(
+             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
+             FakeSocket(), '127.0.0.1')
+@@ -191,7 +174,7 @@ def test_empty_handshake_fails(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             return ([sock], [], [])
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         self.assertRaises(
+             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
+             sock, '127.0.0.1')
+@@ -208,7 +191,7 @@ def test_handshake_ssl_only_without_ssl_raises_error(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             return ([sock], [], [])
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         self.assertRaises(
+             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
+             sock, '127.0.0.1')
+@@ -230,7 +213,7 @@ def __init__(self, *args, **kwargs):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             return ([sock], [], [])
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         self.assertEqual(server.do_handshake(sock, '127.0.0.1'), sock)
+         self.assertTrue(FakeHandler.CALLED, True)
+ 
+@@ -251,7 +234,7 @@ def test_do_handshake_ssl_without_cert_raises_error(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             return ([sock], [], [])
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         self.assertRaises(
+             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
+             sock, '127.0.0.1')
+@@ -280,13 +263,13 @@ def load_verify_locations(self, cafile):
+             def wrap_socket(self, *args, **kwargs):
+                 raise ssl.SSLError(ssl.SSL_ERROR_EOF)
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         if (hasattr(ssl, 'create_default_context')):
+             # for recent versions of python
+-            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
++            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
+         else:
+             # for fallback for old versions of python
+-            self.stubs.Set(ssl, 'wrap_socket', fake_wrap_socket)
++            patch('ssl.warp_socket').start().side_effect = fake_wrap_socket
+         self.assertRaises(
+             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
+             sock, '127.0.0.1')
+@@ -321,10 +304,10 @@ def wrap_socket(self, *args, **kwargs):
+             def set_ciphers(self, ciphers_to_set):
+                 fake_create_default_context.CIPHERS = ciphers_to_set
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         if (hasattr(ssl, 'create_default_context')):
+             # for recent versions of python
+-            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
++            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
+             server.do_handshake(sock, '127.0.0.1')
+             self.assertEqual(fake_create_default_context.CIPHERS, test_ciphers)
+         else:
+@@ -365,10 +348,10 @@ def set_options(self, val):
+                 fake_create_default_context.OPTIONS = val
+             options = property(get_options, set_options)
+ 
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('select.select').start().side_effect = fake_select
+         if (hasattr(ssl, 'create_default_context')):
+             # for recent versions of python
+-            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
++            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
+             server.do_handshake(sock, '127.0.0.1')
+             self.assertEqual(fake_create_default_context.OPTIONS, test_options)
+         else:
+@@ -387,11 +370,9 @@ def test_start_server_error(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             raise Exception("fake error")
+ 
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
+-                       lambda *args, **kwargs: sock)
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
+-                       lambda *args, **kwargs: None)
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
++        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
++        patch('select.select').start().side_effect = fake_select
+         server.start_server()
+ 
+     def test_start_server_keyboardinterrupt(self):
+@@ -401,11 +382,9 @@ def test_start_server_keyboardinterrupt(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             raise KeyboardInterrupt
+ 
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
+-                       lambda *args, **kwargs: sock)
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
+-                       lambda *args, **kwargs: None)
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
++        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
++        patch('select.select').start().side_effect = fake_select
+         server.start_server()
+ 
+     def test_start_server_systemexit(self):
+@@ -415,11 +394,9 @@ def test_start_server_systemexit(self):
+         def fake_select(rlist, wlist, xlist, timeout=None):
+             sys.exit()
+ 
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
+-                       lambda *args, **kwargs: sock)
+-        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
+-                       lambda *args, **kwargs: None)
+-        self.stubs.Set(select, 'select', fake_select)
++        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
++        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
++        patch('select.select').start().side_effect = fake_select
+         server.start_server()
+ 
+     def test_socket_set_keepalive_options(self):

diff --git a/dev-python/websockify/websockify-0.9.0-r1.ebuild b/dev-python/websockify/websockify-0.9.0-r1.ebuild
new file mode 100644
index 00000000000..9e822032c71
--- /dev/null
+++ b/dev-python/websockify/websockify-0.9.0-r1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} )
+# entry_points is used
+DISTUTILS_USE_SETUPTOOLS=rdepend
+
+inherit distutils-r1
+
+SRC_URI="https://github.com/kanaka/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+DESCRIPTION="WebSockets support for any application/server"
+HOMEPAGE="https://github.com/kanaka/websockify"
+
+LICENSE="LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-python/numpy[${PYTHON_USEDEP}]"
+BDEPEND="test? ( dev-python/jwcrypto[${PYTHON_USEDEP}] )"
+
+# Backport a patch removing the need for mox3
+PATCHES=( "${FILESDIR}/${P}-mock-tests.patch" )
+
+distutils_enable_tests nose
+
+python_install_all() {
+	doman docs/${PN}.1
+	distutils-r1_python_install_all
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/websockify/, dev-python/websockify/files/
@ 2021-08-26  8:24 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2021-08-26  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     794cb7556be246c9c745b5b8b4a44b471963978d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 26 08:18:43 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug 26 08:18:43 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=794cb755

dev-python/websockify: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/websockify/Manifest                     |   1 -
 .../files/websockify-0.9.0-mock-tests.patch        | 392 ---------------------
 dev-python/websockify/websockify-0.9.0-r1.ebuild   |  31 --
 3 files changed, 424 deletions(-)

diff --git a/dev-python/websockify/Manifest b/dev-python/websockify/Manifest
index 4c95a1a0c84..4d6225762a7 100644
--- a/dev-python/websockify/Manifest
+++ b/dev-python/websockify/Manifest
@@ -1,2 +1 @@
 DIST websockify-0.10.0.gh.tar.gz 53402 BLAKE2B e909dc316d6dd0ee03ee23b07ca2d78cc60994a8f361b3968759c382c704637357848e903fb12af002b5d5b2bec957f9a4c2b0ddb0e6d008ff9b4a462f3e8871 SHA512 262071f4858e5e3b6471c6f3731d8715c5c13fcc5f43738a330323958a8f0cbe7797847bdc676f1c6c34055c6f8afb949d005a5607d6b220b893910ff973ddc5
-DIST websockify-0.9.0.tar.gz 58493 BLAKE2B 622a36979ec083dd3ea747b43cd8fec0916f9eb6f1a2b8f9b7acabd38f41aec839b2101c5261fdf2474bc40ebbbef61c9ba51d2e57f749f1e1a1c46879fb5d65 SHA512 d2251f653a40dc6dca0e5541845565d968c60be96a20a9b70b0305c4b7578f7fe205d4b98a94bb77d7c9383a396833af90fe92a6ade7e1a6f2d9bf8513d372c8

diff --git a/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch b/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch
deleted file mode 100644
index a6af9508e07..00000000000
--- a/dev-python/websockify/files/websockify-0.9.0-mock-tests.patch
+++ /dev/null
@@ -1,392 +0,0 @@
-From 992e09eac484f25871b7fcfc6d11b8e5beac9edb Mon Sep 17 00:00:00 2001
-From: Pierre Ossman <ossman@cendio.se>
-Date: Fri, 21 Aug 2020 10:50:11 +0200
-Subject: [PATCH] Convert tests from mox to mock
-
-mox is deprecated upstream in favour of mock
----
- test-requirements.txt          |   2 +-
- tests/test_websocketproxy.py   |  34 ++++------
- tests/test_websockifyserver.py | 111 +++++++++++++--------------------
- 3 files changed, 58 insertions(+), 89 deletions(-)
-
-diff --git a/test-requirements.txt b/test-requirements.txt
-index a63a15e..8e01437 100644
---- a/test-requirements.txt
-+++ b/test-requirements.txt
-@@ -1,4 +1,4 @@
--mox3
-+mock
- nose
- jwcrypto;python_version>="2.7"
- redis;python_version>="2.7"
-diff --git a/tests/test_websocketproxy.py b/tests/test_websocketproxy.py
-index c0a8d93..d8a4916 100644
---- a/tests/test_websocketproxy.py
-+++ b/tests/test_websocketproxy.py
-@@ -20,10 +20,11 @@
- import unittest
- import unittest
- import socket
-+try:
-+    from mock import patch
-+except ImportError:
-+    from unittest.mock import patch
- 
--from mox3 import stubout
--
--from websockify import websockifyserver
- from websockify import websocketproxy
- from websockify import token_plugins
- from websockify import auth_plugins
-@@ -74,16 +75,14 @@ def __init__(self):
- class ProxyRequestHandlerTestCase(unittest.TestCase):
-     def setUp(self):
-         super(ProxyRequestHandlerTestCase, self).setUp()
--        self.stubs = stubout.StubOutForTesting()
-         self.handler = websocketproxy.ProxyRequestHandler(
-             FakeSocket(''), "127.0.0.1", FakeServer())
-         self.handler.path = "https://localhost:6080/websockify?token=blah"
-         self.handler.headers = None
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
--                       staticmethod(lambda *args, **kwargs: None))
-+        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
- 
-     def tearDown(self):
--        self.stubs.UnsetAll()
-+        patch.stopall()
-         super(ProxyRequestHandlerTestCase, self).tearDown()
- 
-     def test_get_target(self):
-@@ -120,8 +119,7 @@ class TestPlugin(token_plugins.BasePlugin):
-             def lookup(self, token):
-                 return (self.source + token).split(',')
- 
--        self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                       staticmethod(lambda *args, **kwargs: None))
-+        patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-         self.handler.server.token_plugin = TestPlugin("somehost,")
-         self.handler.validate_connection()
-@@ -138,8 +136,7 @@ def test_asymmetric_jws_token_plugin(self):
-             jwt_token.make_signed_token(key)
-             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
- 
--            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                        staticmethod(lambda *args, **kwargs: None))
-+            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/public.pem")
-             self.handler.validate_connection()
-@@ -155,8 +152,7 @@ def test_asymmetric_jws_token_plugin_with_illigal_key_exception(self):
-             jwt_token.make_signed_token(key)
-             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
- 
--            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                        staticmethod(lambda *args, **kwargs: None))
-+            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-             self.handler.server.token_plugin = token_plugins.JWTTokenApi("wrong.pub")
-             self.assertRaises(self.handler.server.EClose, 
-@@ -171,8 +167,7 @@ def test_symmetric_jws_token_plugin(self):
-             jwt_token.make_signed_token(key)
-             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
- 
--            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                        staticmethod(lambda *args, **kwargs: None))
-+            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/symmetric.key")
-             self.handler.validate_connection()
-@@ -188,8 +183,7 @@ def test_symmetric_jws_token_plugin_with_illigal_key_exception(self):
-             jwt_token.make_signed_token(key)
-             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwt_token.serialize())
- 
--            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                        staticmethod(lambda *args, **kwargs: None))
-+            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-             self.handler.server.token_plugin = token_plugins.JWTTokenApi("wrong_sauce")
-             self.assertRaises(self.handler.server.EClose, 
-@@ -210,8 +204,7 @@ def test_asymmetric_jwe_token_plugin(self):
- 
-             self.handler.path = "https://localhost:6080/websockify?token={jwt_token}".format(jwt_token=jwe_token.serialize())
- 
--            self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                        staticmethod(lambda *args, **kwargs: None))
-+            patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-             self.handler.server.token_plugin = token_plugins.JWTTokenApi("./tests/fixtures/private.pem")
-             self.handler.validate_connection()
-@@ -225,8 +218,7 @@ def authenticate(self, headers, target_host, target_port):
-                 if target_host == self.source:
-                     raise auth_plugins.AuthenticationError(response_msg="some_error")
- 
--        self.stubs.Set(websocketproxy.ProxyRequestHandler, 'send_auth_error',
--                       staticmethod(lambda *args, **kwargs: None))
-+        patcher = patch('websockify.websocketproxy.ProxyRequestHandler.send_auth_error').start()
- 
-         self.handler.server.auth_plugin = TestPlugin("somehost")
-         self.handler.server.target_host = "somehost"
-diff --git a/tests/test_websockifyserver.py b/tests/test_websockifyserver.py
-index b9312dc..a089f55 100644
---- a/tests/test_websockifyserver.py
-+++ b/tests/test_websockifyserver.py
-@@ -22,7 +22,10 @@
- import shutil
- import socket
- import ssl
--from mox3 import stubout
-+try:
-+    from mock import patch, MagicMock, ANY
-+except ImportError:
-+    from unittest.mock import patch, MagicMock, ANY
- import sys
- import tempfile
- import unittest
-@@ -73,22 +76,13 @@ def makefile(self, mode='r', buffsize=None):
- class WebSockifyRequestHandlerTestCase(unittest.TestCase):
-     def setUp(self):
-         super(WebSockifyRequestHandlerTestCase, self).setUp()
--        self.stubs = stubout.StubOutForTesting()
-         self.tmpdir = tempfile.mkdtemp('-websockify-tests')
-         # Mock this out cause it screws tests up
--        self.stubs.Set(os, 'chdir', lambda *args, **kwargs: None)
--        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
--                       lambda *args, **kwargs: None)
--
--        def fake_send_error(self, code, message=None, explain=None):
--            self.last_code = code
--
--        self.stubs.Set(BaseHTTPRequestHandler, 'send_error',
--                       fake_send_error)
-+        patch('os.chdir').start()
- 
-     def tearDown(self):
-         """Called automatically after each test."""
--        self.stubs.UnsetAll()
-+        patch.stopall()
-         os.rmdir(self.tmpdir)
-         super(WebSockifyRequestHandlerTestCase, self).tearDown()
- 
-@@ -101,47 +95,36 @@ def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
-             record=self.tmpdir, daemon=False, ssl_only=0, idle_timeout=1,
-             **kwargs)
- 
--    def test_normal_get_with_only_upgrade_returns_error(self):
-+    @patch('websockify.websockifyserver.WebSockifyRequestHandler.send_error')
-+    def test_normal_get_with_only_upgrade_returns_error(self, send_error):
-         server = self._get_server(web=None)
-         handler = websockifyserver.WebSockifyRequestHandler(
-             FakeSocket('GET /tmp.txt HTTP/1.1'), '127.0.0.1', server)
- 
--        def fake_send_response(self, code, message=None):
--            self.last_code = code
--
--        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
--                       fake_send_response)
--
-         handler.do_GET()
--        self.assertEqual(handler.last_code, 405)
-+        send_error.assert_called_with(405, ANY)
- 
--    def test_list_dir_with_file_only_returns_error(self):
-+    @patch('websockify.websockifyserver.WebSockifyRequestHandler.send_error')
-+    def test_list_dir_with_file_only_returns_error(self, send_error):
-         server = self._get_server(file_only=True)
-         handler = websockifyserver.WebSockifyRequestHandler(
-             FakeSocket('GET / HTTP/1.1'), '127.0.0.1', server)
- 
--        def fake_send_response(self, code, message=None):
--            self.last_code = code
--
--        self.stubs.Set(BaseHTTPRequestHandler, 'send_response',
--                       fake_send_response)
--
-         handler.path = '/'
-         handler.do_GET()
--        self.assertEqual(handler.last_code, 404)
-+        send_error.assert_called_with(404, ANY)
- 
- 
- class WebSockifyServerTestCase(unittest.TestCase):
-     def setUp(self):
-         super(WebSockifyServerTestCase, self).setUp()
--        self.stubs = stubout.StubOutForTesting()
-         self.tmpdir = tempfile.mkdtemp('-websockify-tests')
-         # Mock this out cause it screws tests up
--        self.stubs.Set(os, 'chdir', lambda *args, **kwargs: None)
-+        patch('os.chdir').start()
- 
-     def tearDown(self):
-         """Called automatically after each test."""
--        self.stubs.UnsetAll()
-+        patch.stopall()
-         os.rmdir(self.tmpdir)
-         super(WebSockifyServerTestCase, self).tearDown()
- 
-@@ -154,10 +137,10 @@ def _get_server(self, handler_class=websockifyserver.WebSockifyRequestHandler,
- 
-     def test_daemonize_raises_error_while_closing_fds(self):
-         server = self._get_server(daemon=True, ssl_only=1, idle_timeout=1)
--        self.stubs.Set(os, 'fork', lambda *args: 0)
--        self.stubs.Set(signal, 'signal', lambda *args: None)
--        self.stubs.Set(os, 'setsid', lambda *args: None)
--        self.stubs.Set(os, 'close', raise_oserror)
-+        patch('os.fork').start().return_value = 0
-+        patch('signal.signal').start()
-+        patch('os.setsid').start()
-+        patch('os.close').start().side_effect = raise_oserror
-         self.assertRaises(OSError, server.daemonize, keepfd=None, chdir='./')
- 
-     def test_daemonize_ignores_ebadf_error_while_closing_fds(self):
-@@ -165,11 +148,11 @@ def raise_oserror_ebadf(fd):
-             raise OSError(errno.EBADF, 'fake error')
- 
-         server = self._get_server(daemon=True, ssl_only=1, idle_timeout=1)
--        self.stubs.Set(os, 'fork', lambda *args: 0)
--        self.stubs.Set(os, 'setsid', lambda *args: None)
--        self.stubs.Set(signal, 'signal', lambda *args: None)
--        self.stubs.Set(os, 'close', raise_oserror_ebadf)
--        self.stubs.Set(os, 'open', raise_oserror)
-+        patch('os.fork').start().return_value = 0
-+        patch('signal.signal').start()
-+        patch('os.setsid').start()
-+        patch('os.close').start().side_effect = raise_oserror_ebadf
-+        patch('os.open').start().side_effect = raise_oserror
-         self.assertRaises(OSError, server.daemonize, keepfd=None, chdir='./')
- 
-     def test_handshake_fails_on_not_ready(self):
-@@ -178,7 +161,7 @@ def test_handshake_fails_on_not_ready(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             return ([], [], [])
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         self.assertRaises(
-             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
-             FakeSocket(), '127.0.0.1')
-@@ -191,7 +174,7 @@ def test_empty_handshake_fails(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             return ([sock], [], [])
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         self.assertRaises(
-             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
-             sock, '127.0.0.1')
-@@ -208,7 +191,7 @@ def test_handshake_ssl_only_without_ssl_raises_error(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             return ([sock], [], [])
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         self.assertRaises(
-             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
-             sock, '127.0.0.1')
-@@ -230,7 +213,7 @@ def __init__(self, *args, **kwargs):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             return ([sock], [], [])
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         self.assertEqual(server.do_handshake(sock, '127.0.0.1'), sock)
-         self.assertTrue(FakeHandler.CALLED, True)
- 
-@@ -251,7 +234,7 @@ def test_do_handshake_ssl_without_cert_raises_error(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             return ([sock], [], [])
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         self.assertRaises(
-             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
-             sock, '127.0.0.1')
-@@ -280,13 +263,13 @@ def load_verify_locations(self, cafile):
-             def wrap_socket(self, *args, **kwargs):
-                 raise ssl.SSLError(ssl.SSL_ERROR_EOF)
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         if (hasattr(ssl, 'create_default_context')):
-             # for recent versions of python
--            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
-+            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
-         else:
-             # for fallback for old versions of python
--            self.stubs.Set(ssl, 'wrap_socket', fake_wrap_socket)
-+            patch('ssl.warp_socket').start().side_effect = fake_wrap_socket
-         self.assertRaises(
-             websockifyserver.WebSockifyServer.EClose, server.do_handshake,
-             sock, '127.0.0.1')
-@@ -321,10 +304,10 @@ def wrap_socket(self, *args, **kwargs):
-             def set_ciphers(self, ciphers_to_set):
-                 fake_create_default_context.CIPHERS = ciphers_to_set
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         if (hasattr(ssl, 'create_default_context')):
-             # for recent versions of python
--            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
-+            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
-             server.do_handshake(sock, '127.0.0.1')
-             self.assertEqual(fake_create_default_context.CIPHERS, test_ciphers)
-         else:
-@@ -365,10 +348,10 @@ def set_options(self, val):
-                 fake_create_default_context.OPTIONS = val
-             options = property(get_options, set_options)
- 
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('select.select').start().side_effect = fake_select
-         if (hasattr(ssl, 'create_default_context')):
-             # for recent versions of python
--            self.stubs.Set(ssl, 'create_default_context', fake_create_default_context)
-+            patch('ssl.create_default_context').start().side_effect = fake_create_default_context
-             server.do_handshake(sock, '127.0.0.1')
-             self.assertEqual(fake_create_default_context.OPTIONS, test_options)
-         else:
-@@ -387,11 +370,9 @@ def test_start_server_error(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             raise Exception("fake error")
- 
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
--                       lambda *args, **kwargs: sock)
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
--                       lambda *args, **kwargs: None)
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
-+        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
-+        patch('select.select').start().side_effect = fake_select
-         server.start_server()
- 
-     def test_start_server_keyboardinterrupt(self):
-@@ -401,11 +382,9 @@ def test_start_server_keyboardinterrupt(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             raise KeyboardInterrupt
- 
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
--                       lambda *args, **kwargs: sock)
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
--                       lambda *args, **kwargs: None)
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
-+        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
-+        patch('select.select').start().side_effect = fake_select
-         server.start_server()
- 
-     def test_start_server_systemexit(self):
-@@ -415,11 +394,9 @@ def test_start_server_systemexit(self):
-         def fake_select(rlist, wlist, xlist, timeout=None):
-             sys.exit()
- 
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'socket',
--                       lambda *args, **kwargs: sock)
--        self.stubs.Set(websockifyserver.WebSockifyServer, 'daemonize',
--                       lambda *args, **kwargs: None)
--        self.stubs.Set(select, 'select', fake_select)
-+        patch('websockify.websockifyserver.WebSockifyServer.socket').start()
-+        patch('websockify.websockifyserver.WebSockifyServer.daemonize').start()
-+        patch('select.select').start().side_effect = fake_select
-         server.start_server()
- 
-     def test_socket_set_keepalive_options(self):

diff --git a/dev-python/websockify/websockify-0.9.0-r1.ebuild b/dev-python/websockify/websockify-0.9.0-r1.ebuild
deleted file mode 100644
index 09e246f3ba5..00000000000
--- a/dev-python/websockify/websockify-0.9.0-r1.ebuild
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python3_{7..9} )
-# entry_points is used
-DISTUTILS_USE_SETUPTOOLS=rdepend
-
-inherit distutils-r1
-
-SRC_URI="https://github.com/novnc/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
-DESCRIPTION="WebSockets support for any application/server"
-HOMEPAGE="https://github.com/novnc/websockify"
-
-LICENSE="LGPL-3"
-SLOT="0"
-KEYWORDS="amd64 ~arm64 x86"
-
-RDEPEND="dev-python/numpy[${PYTHON_USEDEP}]"
-BDEPEND="test? ( dev-python/jwcrypto[${PYTHON_USEDEP}] )"
-
-# Backport a patch removing the need for mox3
-PATCHES=( "${FILESDIR}/${P}-mock-tests.patch" )
-
-distutils_enable_tests nose
-
-python_install_all() {
-	doman docs/${PN}.1
-	distutils-r1_python_install_all
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-python/websockify/, dev-python/websockify/files/
@ 2023-09-25 18:52 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2023-09-25 18:52 UTC (permalink / raw
  To: gentoo-commits

commit:     0d6aae0932544a1b8586b96a0310fe0c5c101c59
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 25 18:51:42 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 18:51:42 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d6aae09

dev-python/websockify: Remove old

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/websockify/Manifest                     |   1 -
 .../files/websockify-0.10.0-fix-jwcrypto-1.3.patch | 114 ---------------------
 dev-python/websockify/websockify-0.10.0-r2.ebuild  |  48 ---------
 3 files changed, 163 deletions(-)

diff --git a/dev-python/websockify/Manifest b/dev-python/websockify/Manifest
index 4234752f0452..e92af3c83f31 100644
--- a/dev-python/websockify/Manifest
+++ b/dev-python/websockify/Manifest
@@ -1,2 +1 @@
-DIST websockify-0.10.0.gh.tar.gz 53402 BLAKE2B e909dc316d6dd0ee03ee23b07ca2d78cc60994a8f361b3968759c382c704637357848e903fb12af002b5d5b2bec957f9a4c2b0ddb0e6d008ff9b4a462f3e8871 SHA512 262071f4858e5e3b6471c6f3731d8715c5c13fcc5f43738a330323958a8f0cbe7797847bdc676f1c6c34055c6f8afb949d005a5607d6b220b893910ff973ddc5
 DIST websockify-0.11.0.gh.tar.gz 55126 BLAKE2B df49e8025ea0341b7f8d329a3b3dcddc08df3d0b42bbcb33d25726df8fee1f0a8791d552c9019a3ae514549619a0f3cc9c7861ff4f30017f27498f7465fd5d11 SHA512 cbae6abdee3c9ba6e78c2245fa7ebc4bd6aa96a534b8577da1ae9acd316dd146cece6ceb6f6cdca9c1ddcb3cbaff69e0fc3c3d6048b9374b0937abb91843bf72

diff --git a/dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch b/dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch
deleted file mode 100644
index 9da2cfe093dc..000000000000
--- a/dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From 0f175003480b666fba78a5eda8dbc1dee07917dd Mon Sep 17 00:00:00 2001
-From: Javier Cacheiro <javier.cacheiro.lopez@cesga.es>
-Date: Wed, 25 May 2022 12:40:29 +0200
-Subject: [PATCH] Support for jwcrypto>=1.3
-
----
- tests/test_token_plugins.py | 20 ++++++++++----------
- websockify/token_plugins.py |  4 ++--
- 2 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git a/tests/test_token_plugins.py b/tests/test_token_plugins.py
-index 00078c7..3e1fd19 100644
---- a/tests/test_token_plugins.py
-+++ b/tests/test_token_plugins.py
-@@ -4,7 +4,7 @@
- 
- import unittest
- from unittest.mock import patch, mock_open, MagicMock
--from jwcrypto import jwt
-+from jwcrypto import jwt, jwk
- 
- from websockify.token_plugins import ReadOnlyTokenFile, JWTTokenApi, TokenRedis
- 
-@@ -56,7 +56,7 @@ class JWSTokenTestCase(unittest.TestCase):
-     def test_asymmetric_jws_token_plugin(self):
-         plugin = JWTTokenApi("./tests/fixtures/public.pem")
- 
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         private_key = open("./tests/fixtures/private.pem", "rb").read()
-         key.import_from_pem(private_key)
-         jwt_token = jwt.JWT({"alg": "RS256"}, {'host': "remote_host", 'port': "remote_port"})
-@@ -71,7 +71,7 @@ def test_asymmetric_jws_token_plugin(self):
-     def test_asymmetric_jws_token_plugin_with_illigal_key_exception(self):
-         plugin = JWTTokenApi("wrong.pub")
- 
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         private_key = open("./tests/fixtures/private.pem", "rb").read()
-         key.import_from_pem(private_key)
-         jwt_token = jwt.JWT({"alg": "RS256"}, {'host': "remote_host", 'port': "remote_port"})
-@@ -85,7 +85,7 @@ def test_asymmetric_jws_token_plugin_with_illigal_key_exception(self):
-     def test_jwt_valid_time(self, mock_time):
-         plugin = JWTTokenApi("./tests/fixtures/public.pem")
- 
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         private_key = open("./tests/fixtures/private.pem", "rb").read()
-         key.import_from_pem(private_key)
-         jwt_token = jwt.JWT({"alg": "RS256"}, {'host': "remote_host", 'port': "remote_port", 'nbf': 100, 'exp': 200 })
-@@ -102,7 +102,7 @@ def test_jwt_valid_time(self, mock_time):
-     def test_jwt_early_time(self, mock_time):
-         plugin = JWTTokenApi("./tests/fixtures/public.pem")
- 
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         private_key = open("./tests/fixtures/private.pem", "rb").read()
-         key.import_from_pem(private_key)
-         jwt_token = jwt.JWT({"alg": "RS256"}, {'host': "remote_host", 'port': "remote_port", 'nbf': 100, 'exp': 200 })
-@@ -117,7 +117,7 @@ def test_jwt_early_time(self, mock_time):
-     def test_jwt_late_time(self, mock_time):
-         plugin = JWTTokenApi("./tests/fixtures/public.pem")
- 
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         private_key = open("./tests/fixtures/private.pem", "rb").read()
-         key.import_from_pem(private_key)
-         jwt_token = jwt.JWT({"alg": "RS256"}, {'host': "remote_host", 'port': "remote_port", 'nbf': 100, 'exp': 200 })
-@@ -132,7 +132,7 @@ def test_symmetric_jws_token_plugin(self):
-         plugin = JWTTokenApi("./tests/fixtures/symmetric.key")
- 
-         secret = open("./tests/fixtures/symmetric.key").read()
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         key.import_key(kty="oct",k=secret)
-         jwt_token = jwt.JWT({"alg": "HS256"}, {'host': "remote_host", 'port': "remote_port"})
-         jwt_token.make_signed_token(key)
-@@ -147,7 +147,7 @@ def test_symmetric_jws_token_plugin_with_illigal_key_exception(self):
-         plugin = JWTTokenApi("wrong_sauce")
- 
-         secret = open("./tests/fixtures/symmetric.key").read()
--        key = jwt.JWK()
-+        key = jwk.JWK()
-         key.import_key(kty="oct",k=secret)
-         jwt_token = jwt.JWT({"alg": "HS256"}, {'host': "remote_host", 'port': "remote_port"})
-         jwt_token.make_signed_token(key)
-@@ -159,8 +159,8 @@ def test_symmetric_jws_token_plugin_with_illigal_key_exception(self):
-     def test_asymmetric_jwe_token_plugin(self):
-         plugin = JWTTokenApi("./tests/fixtures/private.pem")
- 
--        private_key = jwt.JWK()
--        public_key = jwt.JWK()
-+        private_key = jwk.JWK()
-+        public_key = jwk.JWK()
-         private_key_data = open("./tests/fixtures/private.pem", "rb").read()
-         public_key_data = open("./tests/fixtures/public.pem", "rb").read()
-         private_key.import_from_pem(private_key_data)
-diff --git a/websockify/token_plugins.py b/websockify/token_plugins.py
-index 4dc29de..19005d3 100644
---- a/websockify/token_plugins.py
-+++ b/websockify/token_plugins.py
-@@ -103,10 +103,10 @@ class JWTTokenApi(BasePlugin):
- 
-     def lookup(self, token):
-         try:
--            from jwcrypto import jwt
-+            from jwcrypto import jwt, jwk
-             import json
- 
--            key = jwt.JWK()
-+            key = jwk.JWK()
- 
-             try:
-                 with open(self.source, 'rb') as key_file:

diff --git a/dev-python/websockify/websockify-0.10.0-r2.ebuild b/dev-python/websockify/websockify-0.10.0-r2.ebuild
deleted file mode 100644
index bb90baa958b8..000000000000
--- a/dev-python/websockify/websockify-0.10.0-r2.ebuild
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{9..11} )
-
-inherit distutils-r1
-
-DESCRIPTION="WebSockets support for any application/server"
-HOMEPAGE="
-	https://github.com/novnc/websockify/
-	https://pypi.org/project/websockify/
-"
-SRC_URI="
-	https://github.com/novnc/websockify/archive/v${PV}.tar.gz
-		-> ${P}.gh.tar.gz
-"
-
-LICENSE="LGPL-3"
-SLOT="0"
-KEYWORDS="amd64 ~arm64 ~riscv x86"
-
-RDEPEND="
-	dev-python/numpy[${PYTHON_USEDEP}]
-"
-BDEPEND="
-	test? (
-		dev-python/jwcrypto[${PYTHON_USEDEP}]
-	)
-"
-
-PATCHES=(
-	"${FILESDIR}/${P}-fix-jwcrypto-1.3.patch"
-)
-
-distutils_enable_tests pytest
-
-EPYTEST_DESELECT=(
-	# TODO: incompatible with current jwcrypto? (not a regression)
-	tests/test_token_plugins.py::JWSTokenTestCase::test_asymmetric_jwe_token_plugin
-)
-
-python_install_all() {
-	doman docs/${PN}.1
-	distutils-r1_python_install_all
-}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-25 18:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-25 18:52 [gentoo-commits] repo/gentoo:master commit in: dev-python/websockify/, dev-python/websockify/files/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2021-08-26  8:24 Michał Górny
2020-09-29 12:13 Louis Sautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox