summaryrefslogtreecommitdiff
path: root/dev-python/websockify
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/websockify')
-rw-r--r--dev-python/websockify/Manifest3
-rw-r--r--dev-python/websockify/files/websockify-0.10.0-fix-jwcrypto-1.3.patch114
-rw-r--r--dev-python/websockify/websockify-0.10.0-r1.ebuild (renamed from dev-python/websockify/websockify-0.10.0.ebuild)17
3 files changed, 125 insertions, 9 deletions
diff --git a/dev-python/websockify/Manifest b/dev-python/websockify/Manifest
index 2e32a7c70eab..eb624ee9eec6 100644
--- a/dev-python/websockify/Manifest
+++ b/dev-python/websockify/Manifest
@@ -1,3 +1,4 @@
+AUX websockify-0.10.0-fix-jwcrypto-1.3.patch 4944 BLAKE2B ec1c42458d09082b0f2c98abee8bc922e532571d2550dd0c28ca95331e9c3f5097aaef2394d72d4c89213e7c386b193897cc204fa304ad8de098eb3d8bbac1ce SHA512 f9df762236b961549bd8ee127d7363e1942a280a892676d82bd8e32d43434cb30efbcc15ef345a5a15ad9f08759861caf6f009a8afc98a15021126c8051b8da0
DIST websockify-0.10.0.gh.tar.gz 53402 BLAKE2B e909dc316d6dd0ee03ee23b07ca2d78cc60994a8f361b3968759c382c704637357848e903fb12af002b5d5b2bec957f9a4c2b0ddb0e6d008ff9b4a462f3e8871 SHA512 262071f4858e5e3b6471c6f3731d8715c5c13fcc5f43738a330323958a8f0cbe7797847bdc676f1c6c34055c6f8afb949d005a5607d6b220b893910ff973ddc5
-EBUILD websockify-0.10.0.ebuild 867 BLAKE2B 9a6ce47d15e07be20da727247b20a51f02999443c71897b4dabfa4cde97a85fd7386d3bd7f0564c307f12f2fcfb79dd2cafb0d6497fec925b5b0128be0b1aaf2 SHA512 2dc15e1900011c3dbbc22b17573b60c971a0116ebe23f817d884abf8e8897f342011334a801bc65eab2c80635c9b08a06c9ad3e038c43e099a2202e44cc6f9c6
+EBUILD websockify-0.10.0-r1.ebuild 865 BLAKE2B 868a2e3a02892500e64ec3f56a987812d9196a38fa9f267b7cd1b45b8299e592ba05fd16972186f3696fe28f118861b39ad3ecf53999851d0561055085c24fea SHA512 dadcf10c2e6c7afdb7e789a1796eedec63424618f2f9999e0f8da4a5e333110e4d286da1c02c57377f23fddeb6fde0192208fa7d1629246b58f2c37334c4d008
MISC metadata.xml 509 BLAKE2B 225c838d2cc6350daa72ef825bac2332db172d6790623b154a49d48fc71de06b2d4b0c732b297e93514b8b088f3b7a17fb5ade431afc28fd8893f2617a67e5e1 SHA512 c70bc93e2869fd4a85a8358ca3489d0d0e6f6d8355e616e8f5d62e2922af2d2cb415e354f91cb97a1e38633ab7bd955378f7a40fd71d5f3bb51411526d2a6c29
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