diff options
author | V3n3RiX <venerix@koprulu.sector> | 2025-02-16 00:13:18 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2025-02-16 00:13:18 +0000 |
commit | f2bdc27fe0f79f8f9a3945eb2b1163ce75c56439 (patch) | |
tree | dd0f7da0455831dffb2cb662e7dae760f92e68ad /dev-python/python-jose | |
parent | 770d63f36dbe1722e0ff9ab55eeca49986f01527 (diff) |
gentoo auto-resync : 16:02:2025 - 00:13:18
Diffstat (limited to 'dev-python/python-jose')
-rw-r--r-- | dev-python/python-jose/Manifest | 5 | ||||
-rw-r--r-- | dev-python/python-jose/files/python-jose-3.3.0-test.patch | 119 | ||||
-rw-r--r-- | dev-python/python-jose/python-jose-3.3.0-r1.ebuild | 48 | ||||
-rw-r--r-- | dev-python/python-jose/python-jose-3.4.0-r1.ebuild (renamed from dev-python/python-jose/python-jose-3.4.0.ebuild) | 11 |
4 files changed, 10 insertions, 173 deletions
diff --git a/dev-python/python-jose/Manifest b/dev-python/python-jose/Manifest index d9523a5dff6e..c01a24e3eaed 100644 --- a/dev-python/python-jose/Manifest +++ b/dev-python/python-jose/Manifest @@ -1,6 +1,3 @@ -AUX python-jose-3.3.0-test.patch 5171 BLAKE2B 581bffa2ae6af4527a1fa7758c6627f1bf24197590aed459a46021b3aaf16bf9594cef8efe5f9b9a8e4aec89a4be461ed3bbf12007274ac3fc34cf3b39759437 SHA512 2c77d7fd504199862fc2ab0166e41e0c8ee28a2107df1dd002d8577f58025327759535a2110ef189fd944df07edbfc1be33db4585ad850f60b7148f7319dc095 -DIST python-jose-3.3.0.gh.tar.gz 126578 BLAKE2B d1279d2a0788b4d395e760ee3a1b2ce8c9340ad12ebe103cb1ba98aea33566cf0134d5af75be9727fff96adab4fc88f1b471ba9ea7d36c16de10587a9efd1304 SHA512 de7147cc6e12406d6e459c32829acae46395acba727c53e65bc05f4794ee3050eecd355e3ae2e87f4ebdbd871f53822eea08a10f25d7ca6088fc6128dc7d9637 DIST python-jose-3.4.0.gh.tar.gz 88084 BLAKE2B 9cec36d634019248508164a246c6debc3778321f75aec1d9870611df4b162ee87722137983124b5a5afb7525bb8dfb845e3a302068d7c1d295a326f635016ca5 SHA512 61988e07a2251b475346ac56d7845e1c573e1c4b7bdccec13937c31c325c0731c6679047451a08be79044e5a57a5470e90b43bb94b0a249c84c11675779f3dcf -EBUILD python-jose-3.3.0-r1.ebuild 1243 BLAKE2B b18e34ee58f1c9ac68d7d35e776136c3773ec3345beeb6bcc883a085762ad73aa10b268606af0cf1492c0730130475db0a017863feb216742a56b7c26bc43d8d SHA512 bf93dbc024b1ac3d596fa63674a95373540422378014437a4e645a00d0e4a01a64ebc364b5253eb0f643d39f3170daf4d6683298d01b237f38653b6fd2ceed80 -EBUILD python-jose-3.4.0.ebuild 1056 BLAKE2B 6f6b7d152fd63603c65778c4839d795c9c34ebed318fffdfa8de2be9c7ceb10062fbbcd7dad9f3d0da86eb7718319d8ec638c9de0a130419487aa6a247a3b654 SHA512 b464e041b2c7536465c029f63e4e913ae86553421bd1d0a5632b59b98302e89627e2f9639cfedcfa15c6b3cc1e1818ebfe1c5cd5fa3115cb0d4ceace702cd93d +EBUILD python-jose-3.4.0-r1.ebuild 1163 BLAKE2B e0d3a1dbc223ff32fbd9867a5c9321c4b46fb5a05e701f8cfd5e84c8c1597544375d2892b625c29385e61b9cba5deae861d94595201e645ecaab4412834d9c9a SHA512 678ac8b24ad813b75687d9554b27e828fee4c1f1f694ed7393dec4988431e93666759499356ca57511a1901b6101676c3ed616047f76c3c96aeadd821f3aa696 MISC metadata.xml 570 BLAKE2B b931b6de4f0dc9a5cefa9b31805590b2c667c5d2bc1ea31aea6f7c4b47db6d861e9fdc4666e66784b25e4dcc84e2d6d257e9ed19a80c1310d83948467cbfdcb2 SHA512 369591ec42b7dcfd9e28f0fb510bfac1212e678e9829f5c8ffbc35993446865b721457d790dbf63551f8247f28e4990bef7e9928600e74541d50cf353f41eafb diff --git a/dev-python/python-jose/files/python-jose-3.3.0-test.patch b/dev-python/python-jose/files/python-jose-3.3.0-test.patch deleted file mode 100644 index 7f87069853d7..000000000000 --- a/dev-python/python-jose/files/python-jose-3.3.0-test.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 19677540e74eba4392be53ae434b561cf74ad9a6 Mon Sep 17 00:00:00 2001 -From: Todd Wildey <twwildey@amazon.com> -Date: Thu, 30 May 2024 16:02:09 -0700 -Subject: [PATCH] Adding `get_pem_for_key` and `normalize_pem` methods to - normalize PEM formatting of keys in `tests/algorithms/test_EC.py` and - updating `tests/algorithms/test_EC_compat.py` to use these methods - -Test failures were occurring due to differences of line lengths generated by the `cryptography` vs `ecdsa` PIP libraries for PEM formatting of cryptographic keys. This method removes newlines from the bodies of PEM-formated keys so that test comparisons will not fail on differentiated line lengths between PEM formattings. ---- - tests/algorithms/test_EC.py | 28 +++++++++++++++++++++++++++- - tests/algorithms/test_EC_compat.py | 14 +++++++------- - 2 files changed, 34 insertions(+), 8 deletions(-) - -diff --git a/tests/algorithms/test_EC.py b/tests/algorithms/test_EC.py -index 6c167d29..b9028a77 100644 ---- a/tests/algorithms/test_EC.py -+++ b/tests/algorithms/test_EC.py -@@ -1,4 +1,5 @@ - import json -+import re - - from jose.backends import ECKey - from jose.constants import ALGORITHMS -@@ -48,6 +49,31 @@ - b"\xfeMO\x04\xb2[\x86A\xbd\xc6hu\x953X\x1e" - ) - -+# Define the regex pattern to capture the header, body, and footer of the PEM file -+PEM_REGEX = re.compile(r"(-----BEGIN [A-Z ]+-----)(.*?)(-----END [A-Z ]+-----)", re.DOTALL) -+WHITE_SPACE_REGEX = re.compile(r"\s+") -+ -+ -+def get_pem_for_key(key): -+ return key.to_pem().strip().decode("utf-8") -+ -+ -+def normalize_pem(key_pem_str): -+ # Search for the PEM sections -+ pem_match = PEM_REGEX.search(key_pem_str) -+ if not pem_match: -+ raise ValueError("The provided string does not contain a valid PEM formatted data.") -+ -+ header = pem_match.group(1) -+ body = pem_match.group(2) -+ footer = pem_match.group(3) -+ -+ # Remove all newlines and spaces from the body -+ clean_body = WHITE_SPACE_REGEX.sub("", body) -+ -+ # Reassemble the PEM string -+ return f"{header}\n{clean_body}\n{footer}" -+ - - def _backend_exception_types(): - """Build the backend exception types based on available backends.""" -@@ -104,7 +130,7 @@ def test_key_from_pem(self): - def test_to_pem(self): - key = ECKey(private_key, ALGORITHMS.ES256) - assert not key.is_public() -- assert key.to_pem().strip() == private_key.strip().encode("utf-8") -+ assert normalize_pem(get_pem_for_key(key)) == normalize_pem(private_key.strip()) - - public_pem = key.public_key().to_pem() - assert ECKey(public_pem, ALGORITHMS.ES256).is_public() -diff --git a/tests/algorithms/test_EC_compat.py b/tests/algorithms/test_EC_compat.py -index 05d033cc..1bb7373a 100644 ---- a/tests/algorithms/test_EC_compat.py -+++ b/tests/algorithms/test_EC_compat.py -@@ -7,7 +7,7 @@ - ECDSAECKey = CryptographyECKey = None - from jose.constants import ALGORITHMS - --from .test_EC import private_key -+from .test_EC import get_pem_for_key, normalize_pem, private_key - - - @pytest.mark.backend_compatibility -@@ -37,7 +37,7 @@ def test_public_key_to_pem(self, BackendFrom, BackendTo): - key = BackendFrom(private_key, ALGORITHMS.ES256) - key2 = BackendTo(private_key, ALGORITHMS.ES256) - -- assert key.public_key().to_pem().strip() == key2.public_key().to_pem().strip() -+ assert normalize_pem(get_pem_for_key(key.public_key())) == normalize_pem(get_pem_for_key(key2.public_key())) - - @pytest.mark.parametrize("BackendFrom", [ECDSAECKey, CryptographyECKey]) - @pytest.mark.parametrize("BackendTo", [ECDSAECKey, CryptographyECKey]) -@@ -45,7 +45,7 @@ def test_private_key_to_pem(self, BackendFrom, BackendTo): - key = BackendFrom(private_key, ALGORITHMS.ES256) - key2 = BackendTo(private_key, ALGORITHMS.ES256) - -- assert key.to_pem().strip() == key2.to_pem().strip() -+ assert normalize_pem(get_pem_for_key(key)) == normalize_pem(get_pem_for_key(key2)) - - @pytest.mark.parametrize("BackendFrom", [ECDSAECKey, CryptographyECKey]) - @pytest.mark.parametrize("BackendTo", [ECDSAECKey, CryptographyECKey]) -@@ -53,19 +53,19 @@ def test_public_key_load_cycle(self, BackendFrom, BackendTo): - key = BackendFrom(private_key, ALGORITHMS.ES256) - pubkey = key.public_key() - -- pub_pem_source = pubkey.to_pem().strip() -+ pub_pem_source = normalize_pem(get_pem_for_key(pubkey)) - - pub_target = BackendTo(pub_pem_source, ALGORITHMS.ES256) - -- assert pub_pem_source == pub_target.to_pem().strip() -+ assert pub_pem_source == normalize_pem(get_pem_for_key(pub_target)) - - @pytest.mark.parametrize("BackendFrom", [ECDSAECKey, CryptographyECKey]) - @pytest.mark.parametrize("BackendTo", [ECDSAECKey, CryptographyECKey]) - def test_private_key_load_cycle(self, BackendFrom, BackendTo): - key = BackendFrom(private_key, ALGORITHMS.ES256) - -- pem_source = key.to_pem().strip() -+ pem_source = normalize_pem(get_pem_for_key(key)) - - target = BackendTo(pem_source, ALGORITHMS.ES256) - -- assert pem_source == target.to_pem().strip() -+ assert pem_source == normalize_pem(get_pem_for_key(target)) diff --git a/dev-python/python-jose/python-jose-3.3.0-r1.ebuild b/dev-python/python-jose/python-jose-3.3.0-r1.ebuild deleted file mode 100644 index ecfd9c2c9724..000000000000 --- a/dev-python/python-jose/python-jose-3.3.0-r1.ebuild +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 1999-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{10..13} ) - -inherit distutils-r1 - -DESCRIPTION="A JavaScript Object Signing and Encryption (JOSE) implementation in Python" -HOMEPAGE=" - https://github.com/mpdavis/python-jose/ - https://pypi.org/project/python-jose/ -" -# pypi tarball lacks unit tests -SRC_URI=" - https://github.com/mpdavis/python-jose/archive/${PV}.tar.gz - -> ${P}.gh.tar.gz -" - -LICENSE="MIT" -SLOT="0" -KEYWORDS="amd64 ~arm arm64 ~ppc64 ~riscv x86 ~amd64-linux ~x86-linux" - -# TODO: require only one crypto backend? -RDEPEND=" - dev-python/cryptography[${PYTHON_USEDEP}] - dev-python/ecdsa[${PYTHON_USEDEP}] - dev-python/pyasn1[${PYTHON_USEDEP}] - >=dev-python/pycryptodome-3.3.1[${PYTHON_USEDEP}] - dev-python/rsa[${PYTHON_USEDEP}] - dev-python/six[${PYTHON_USEDEP}] -" - -distutils_enable_tests pytest -distutils_enable_sphinx docs - -python_prepare_all() { - local PATCHES=( - # https://github.com/mpdavis/python-jose/commit/19677540e74eba4392be53ae434b561cf74ad9a6 - "${FILESDIR}/${P}-test.patch" - ) - - distutils-r1_python_prepare_all - sed -e '/pytest-runner/d' -i setup.py || die - sed -e '/addopts/d' -i setup.cfg || die -} diff --git a/dev-python/python-jose/python-jose-3.4.0.ebuild b/dev-python/python-jose/python-jose-3.4.0-r1.ebuild index 8d6be90dbf14..af32d7ee44cf 100644 --- a/dev-python/python-jose/python-jose-3.4.0.ebuild +++ b/dev-python/python-jose/python-jose-3.4.0-r1.ebuild @@ -21,7 +21,7 @@ SRC_URI=" LICENSE="MIT" SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux" +KEYWORDS="amd64 ~arm arm64 ~ppc64 ~riscv x86 ~amd64-linux ~x86-linux" # TODO: require only one crypto backend? RDEPEND=" @@ -38,5 +38,12 @@ distutils_enable_sphinx docs python_prepare_all() { distutils-r1_python_prepare_all - sed -e '/addopts/d' -i setup.cfg || die + + # unpin dependencies + sed -i -e 's:, <[0-9.]*::' setup.cfg || die +} + +python_test() { + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + epytest -o addopts= } |