From 870bebbb9dae07fb8d9962700c1a2d48733e73f2 Mon Sep 17 00:00:00 2001 From: wuzhaomin Date: Wed, 10 Jul 2024 14:38:39 +0800 Subject: [PATCH] Bakport commits from upstream --- ...hon-3.6-and-3.7-and-add-3.11-support.patch | 203 ++++++++++++++++++ ...inimum-version-for-typing_extensions.patch | 26 +++ ...cated-package-with-typing_extensions.patch | 96 +++++++++ python-jwcrypto.spec | 10 +- 4 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 Backport-Drop-python-3.6-and-3.7-and-add-3.11-support.patch create mode 100644 Backport-Set-a-minimum-version-for-typing_extensions.patch create mode 100644 Backport-replace-deprecated-package-with-typing_extensions.patch diff --git a/Backport-Drop-python-3.6-and-3.7-and-add-3.11-support.patch b/Backport-Drop-python-3.6-and-3.7-and-add-3.11-support.patch new file mode 100644 index 0000000..2f8925e --- /dev/null +++ b/Backport-Drop-python-3.6-and-3.7-and-add-3.11-support.patch @@ -0,0 +1,203 @@ +From c659e385883e3067acf1bf4503d244e95eba4a3d Mon Sep 17 00:00:00 2001 +From: Simo Sorce +Date: Wed, 7 Feb 2024 14:58:05 -0500 +Subject: [PATCH] Drop python 3.6 and 3.7 and add 3.11 support + +Signed-off-by: Simo Sorce +--- + .github/workflows/build.yml | 26 +++++++++++++------------- + Makefile | 3 ++- + setup.py | 5 ++--- + tox.ini | 14 +++++++------- + 4 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml +index 4c9948d..e73322c 100644 +--- a/.github/workflows/build.yml ++++ b/.github/workflows/build.yml +@@ -14,10 +14,10 @@ + "fail-fast": false, + "matrix": { + "name": [ +- "python-37", + "python-38", + "python-39", + "python-310", ++ "python-311", + "doc", + "doctest", + "sphinx", +@@ -27,12 +27,6 @@ + ], + "include": [ + { +- "name": "python-37", +- "python": "3.7", +- "toxenv": "py37", +- "arch": "x64", +- }, +- { + "name": "python-38", + "python": "3.8", + "toxenv": "py38", +@@ -51,38 +45,44 @@ + "arch": "x64", + }, + { ++ "name": "python-311", ++ "python": "3.11", ++ "toxenv": "py311", ++ "arch": "x64", ++ }, ++ { + "name": "doc", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "doc", + "arch": "x64", + }, + { + "name": "doctest", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "doctest", + "arch": "x64", + }, + { + "name": "sphinx", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "sphinx", + "arch": "x64", + }, + { + "name": "lint", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "lint", + "arch": "x64", + }, + { + "name": "pep8", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "pep8", + "arch": "x64", + }, + { + "name": "codespell", +- "python": "3.10", ++ "python": "3.11", + "toxenv": "codespell", + "arch": "x64", + }, +diff --git a/Makefile b/Makefile +index 7cfaa52..30876fd 100644 +--- a/Makefile ++++ b/Makefile +@@ -20,13 +20,14 @@ testlong: export JWCRYPTO_TESTS_ENABLE_MMA=True + testlong: export TOX_TESTENV_PASSENV=JWCRYPTO_TESTS_ENABLE_MMA + testlong: + rm -f .coverage +- tox -e py310 ++ tox -e py311 + + test: + rm -f .coverage + tox -e py38 --skip-missing-interpreter + tox -e py39 --skip-missing-interpreter + tox -e py310 --skip-missing-interpreter ++ tox -e py311 --skip-missing-interpreter + + DOCS_DIR = docs + .PHONY: docs +diff --git a/setup.py b/setup.py +index 72afb9e..cf55329 100755 +--- a/setup.py ++++ b/setup.py +@@ -26,11 +26,10 @@ setup( + long_description=long_description, + long_description_content_type='text/markdown', + classifiers = [ +- 'Programming Language :: Python :: 3.6', +- 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', ++ 'Programming Language :: Python :: 3.11', + 'Intended Audience :: Developers', + 'Topic :: Security', + 'Topic :: Software Development :: Libraries :: Python Modules' +@@ -40,5 +39,5 @@ setup( + 'cryptography >= 3.4', + 'typing_extensions', + ], +- python_requires = '>= 3.6', ++ python_requires = '>= 3.8', + ) +diff --git a/tox.ini b/tox.ini +index d77a003..fee46cc 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -1,5 +1,5 @@ + [tox] +-envlist = lint,py36,py37,py38,py39,py310,pep8,doc,sphinx,doctest ++envlist = lint,py38,py39,py310,py311,pep8,doc,sphinx,doctest + skip_missing_interpreters = true + + [testenv] +@@ -16,7 +16,7 @@ commands = + {envpython} -m coverage report -m + + [testenv:lint] +-basepython = python3.10 ++basepython = python3.11 + deps = + pylint + #sitepackages = True +@@ -24,7 +24,7 @@ commands = + {envpython} -m pylint -d c,r,i,W0613 -r n -f colorized --notes= --disable=star-args ./jwcrypto + + [testenv:pep8] +-basepython = python3.10 ++basepython = python3.11 + deps = + flake8 + flake8-import-order +@@ -37,13 +37,13 @@ deps = + doc8 + docutils + markdown +-basepython = python3.10 ++basepython = python3.11 + commands = + doc8 --allow-long-titles README.md + markdown_py README.md -f {toxworkdir}/README.md.html + + [testenv:sphinx] +-basepython = python3.10 ++basepython = python3.11 + changedir = docs/source + deps = + sphinx +@@ -51,7 +51,7 @@ commands = + sphinx-build -n -v -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html + + [testenv:doctest] +-basepython = python3.10 ++basepython = python3.11 + changedir = docs/source + deps = + sphinx +@@ -59,7 +59,7 @@ commands = + sphinx-build -v -W -b doctest -d {envtmpdir}/doctrees . {envtmpdir}/doctest + + [testenv:codespell] +-basepython = python3.10 ++basepython = python3.11 + deps = + codespell + commands = +-- +2.9.3.windows.1 + diff --git a/Backport-Set-a-minimum-version-for-typing_extensions.patch b/Backport-Set-a-minimum-version-for-typing_extensions.patch new file mode 100644 index 0000000..743bc04 --- /dev/null +++ b/Backport-Set-a-minimum-version-for-typing_extensions.patch @@ -0,0 +1,26 @@ +From e7ef80f286883f6710df54c2b7ef78f528d95ee8 Mon Sep 17 00:00:00 2001 +From: Simo Sorce +Date: Tue, 13 Feb 2024 10:50:12 -0500 +Subject: [PATCH] Set a minimum version for typing_extensions + +Signed-off-by: Simo Sorce +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index cf55329..984f9e9 100755 +--- a/setup.py ++++ b/setup.py +@@ -37,7 +37,7 @@ setup( + data_files = [('share/doc/jwcrypto', ['LICENSE', 'README.md'])], + install_requires = [ + 'cryptography >= 3.4', +- 'typing_extensions', ++ 'typing_extensions >= 4.5.0', + ], + python_requires = '>= 3.8', + ) +-- +2.9.3.windows.1 + diff --git a/Backport-replace-deprecated-package-with-typing_extensions.patch b/Backport-replace-deprecated-package-with-typing_extensions.patch new file mode 100644 index 0000000..b577c70 --- /dev/null +++ b/Backport-replace-deprecated-package-with-typing_extensions.patch @@ -0,0 +1,96 @@ +From 70c0782d8bb5a45c32b7928c4851d57ba2b53207 Mon Sep 17 00:00:00 2001 +From: David Diamant +Date: Thu, 4 Jan 2024 14:51:45 +0200 +Subject: [PATCH] replace deprecated package with typing_extensions + +Signed-off-by: David Diamant +--- + jwcrypto/jwk.py | 10 +++++----- + jwcrypto/jwt.py | 4 ++-- + setup.py | 2 +- + 3 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/jwcrypto/jwk.py b/jwcrypto/jwk.py +index 43e8b67..fe8598e 100644 +--- a/jwcrypto/jwk.py ++++ b/jwcrypto/jwk.py +@@ -11,7 +11,7 @@ from cryptography.hazmat.primitives import hashes, serialization + from cryptography.hazmat.primitives.asymmetric import ec + from cryptography.hazmat.primitives.asymmetric import rsa + +-from deprecated import deprecated ++from typing_extensions import deprecated + + from jwcrypto.common import JWException + from jwcrypto.common import base64url_decode, base64url_encode +@@ -764,13 +764,13 @@ class JWK(dict): + return self.get('kty') == 'oct' + + @property +- @deprecated ++ @deprecated('') + def key_type(self): + """The Key type""" + return self.get('kty') + + @property +- @deprecated ++ @deprecated('') + def key_id(self): + """The Key ID. + Provided by the kid parameter if present, otherwise returns None. +@@ -778,14 +778,14 @@ class JWK(dict): + return self.get('kid') + + @property +- @deprecated ++ @deprecated('') + def key_curve(self): + """The Curve Name.""" + if self.get('kty') not in ['EC', 'OKP']: + raise InvalidJWKType('Not an EC or OKP key') + return self.get('crv') + +- @deprecated ++ @deprecated('') + def get_curve(self, arg): + """Gets the Elliptic Curve associated with the key. + +diff --git a/jwcrypto/jwt.py b/jwcrypto/jwt.py +index a30804b..157d519 100644 +--- a/jwcrypto/jwt.py ++++ b/jwcrypto/jwt.py +@@ -4,7 +4,7 @@ import copy + import time + import uuid + +-from deprecated import deprecated ++from typing_extensions import deprecated + + from jwcrypto.common import JWException, JWKeyNotFound + from jwcrypto.common import json_decode, json_encode +@@ -123,7 +123,7 @@ class JWTInvalidClaimFormat(JWException): + super(JWTInvalidClaimFormat, self).__init__(msg) + + +-@deprecated ++@deprecated('') + class JWTMissingKeyID(JWException): + """JSON Web Token is missing key id. + +diff --git a/setup.py b/setup.py +index a08920f..72afb9e 100755 +--- a/setup.py ++++ b/setup.py +@@ -38,7 +38,7 @@ setup( + data_files = [('share/doc/jwcrypto', ['LICENSE', 'README.md'])], + install_requires = [ + 'cryptography >= 3.4', +- 'deprecated', ++ 'typing_extensions', + ], + python_requires = '>= 3.6', + ) +-- +2.9.3.windows.1 + diff --git a/python-jwcrypto.spec b/python-jwcrypto.spec index 1cd9be9..b9b6aac 100644 --- a/python-jwcrypto.spec +++ b/python-jwcrypto.spec @@ -1,7 +1,7 @@ %global _empty_manifest_terminate_build 0 Name: python-jwcrypto Version: 1.5.1 -Release: 1 +Release: 2 Summary: Implementation of JOSE Web standards License: LGPL-3.0-or-later URL: https://github.com/latchset/jwcrypto @@ -10,6 +10,9 @@ Source0: https://github.com/latchset/jwcrypto/archive/refs/tags/v1.5.1.tar.gz # https://github.com/latchset/jwcrypto/commit/90477a3b6e73da69740e00b8161f53fea19b831f Patch1: CVE-2024-28102.patch +Patch2: Backport-replace-deprecated-package-with-typing_extensions.patch +Patch3: Backport-Drop-python-3.6-and-3.7-and-add-3.11-support.patch +Patch4: Backport-Set-a-minimum-version-for-typing_extensions.patch BuildArch: noarch @@ -71,6 +74,11 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Wed Jul 10 2024 wuzhaomin - 1.5.1-2 +- replace deprecated package with typing_extensions +- Drop python 3.6 and 3.7 and add 3.11 support +- Set a minimum version for typing_extensions + * Fri May 31 2024 wuzhaomin - 1.5.1-1 - Update package to version 1.5.1 - Fix X22519 import/export from PEM by @achamayou in #334 -- Gitee