diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-06-17 14:09:04 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-06-17 14:21:10 +0300 |
commit | 00c7c8c633f9f5aaa36d5b0f05ed218cbf0fd92d (patch) | |
tree | e126a75f4aaa4c268b6e34039d68afdf589d65b3 /dev-python/websockify | |
parent | dev-python/zope-schema: enable py3.11 (diff) | |
download | gentoo-00c7c8c633f9f5aaa36d5b0f05ed218cbf0fd92d.tar.gz gentoo-00c7c8c633f9f5aaa36d5b0f05ed218cbf0fd92d.tar.bz2 gentoo-00c7c8c633f9f5aaa36d5b0f05ed218cbf0fd92d.zip |
dev-python/websockify: enable py3.11, fix for >=jwcrypto-1.3
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'dev-python/websockify')
-rw-r--r-- | dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch | 114 | ||||
-rw-r--r-- | dev-python/websockify/websockify-0.10.0-r1.ebuild (renamed from dev-python/websockify/websockify-0.10.0.ebuild) | 17 |
2 files changed, 123 insertions, 8 deletions
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 new file mode 100644 index 000000000000..9da2cfe093dc --- /dev/null +++ b/dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch @@ -0,0 +1,114 @@ +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.ebuild b/dev-python/websockify/websockify-0.10.0-r1.ebuild index 2998d8ecf9be..6381a4b18ee4 100644 --- a/dev-python/websockify/websockify-0.10.0.ebuild +++ b/dev-python/websockify/websockify-0.10.0-r1.ebuild @@ -3,7 +3,7 @@ EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{8..11} ) inherit distutils-r1 DESCRIPTION="WebSockets support for any application/server" @@ -19,15 +19,16 @@ 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 -python_test() { - local deselect=( - # TODO: incompatible with current jwcrypto? (not a regression) - tests/test_token_plugins.py::JWSTokenTestCase::test_asymmetric_jwe_token_plugin - ) - epytest ${deselect[@]/#/--deselect } -} +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 |