public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-josepy] epel10.3: add patch to support Python 3.14
@ 2026-11-11  6:20 Felix Schwarz
  0 siblings, 0 replies; only message in thread
From: Felix Schwarz @ 2026-11-11  6:20 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-josepy
Branch : epel10.3
Commit : 66e07329e7b736c45a77af5141cb601cac3435cb
Author : Felix Schwarz <fschwarz@fedoraproject.org>
Date   : 2025-06-26T08:23:10+02:00
Stats  : +116/-2 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-josepy/c/66e07329e7b736c45a77af5141cb601cac3435cb?branch=epel10.3

Log:
add patch to support Python 3.14

---
diff --git a/python-josepy-support-py314.patch b/python-josepy-support-py314.patch
new file mode 100644
index 0000000..bd10e85
--- /dev/null
+++ b/python-josepy-support-py314.patch
@@ -0,0 +1,108 @@
+Upstream:
+https://github.com/certbot/josepy/commit/8ddcaaed99a61e9277df1ec00157f0aea53378d4
+
+diff --git a/pyproject.toml b/pyproject.toml
+index c7836bc..4f05217 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -22,6 +22,7 @@ classifiers = [
+     "Programming Language :: Python :: 3.11",
+     "Programming Language :: Python :: 3.12",
+     "Programming Language :: Python :: 3.13",
++    "Programming Language :: Python :: 3.14",
+     "Topic :: Internet :: WWW/HTTP",
+     "Topic :: Security",
+ ]
+@@ -74,6 +75,7 @@ jws = "josepy.jws:CLI.run"
+ line-length = 100
+ # This should be kept in sync with the version of Python specified in poetry's
+ # dependencies above.
++# TODO add 'py314' once black supports it, see #232 for details
+ target-version = ['py39', 'py310', 'py311', 'py312', 'py313']
+ 
+ # Mypy tooling configuration
+diff --git a/src/josepy/json_util.py b/src/josepy/json_util.py
+index e692a9d..a3d3663 100644
+--- a/src/josepy/json_util.py
++++ b/src/josepy/json_util.py
+@@ -10,6 +10,7 @@ The framework presented here is somewhat based on `Go's "json" package`_
+ import abc
+ import binascii
+ import logging
++import sys
+ from typing import (
+     Any,
+     Callable,
+@@ -27,6 +28,9 @@ from cryptography.hazmat.primitives.serialization import Encoding
+ 
+ from josepy import b64, errors, interfaces, util
+ 
++if sys.version_info >= (3, 14):
++    import annotationlib
++
+ logger = logging.getLogger(__name__)
+ 
+ 
+@@ -233,7 +237,19 @@ class JSONObjectWithFieldsMeta(abc.ABCMeta):
+                 if isinstance(value, _TypedField):
+                     # Ensure the type annotation has been set for the field.
+                     # Error out if it is not the case.
+-                    if key not in namespace.get("__annotations__", {}):
++                    if "__annotations__" in namespace:
++                        annotations = namespace["__annotations__"]
++                    elif sys.version_info >= (3, 14):
++                        annotate = annotationlib.get_annotate_from_class_namespace(namespace)
++                        if annotate:
++                            annotations = annotationlib.call_annotate_function(
++                                annotate, format=annotationlib.Format.FORWARDREF
++                            )
++                        else:
++                            annotations = {}
++                    else:
++                        annotations = {}
++                    if key not in annotations:
+                         raise ValueError(
+                             f"Field `{key}` in JSONObject `{name}` has no type annotation."
+                         )
+diff --git a/src/josepy/jws.py b/src/josepy/jws.py
+index a282e38..a9a42aa 100644
+--- a/src/josepy/jws.py
++++ b/src/josepy/jws.py
+@@ -396,8 +396,8 @@ class CLI:
+     @classmethod
+     def sign(cls, args: argparse.Namespace) -> None:
+         """Sign."""
+-        key = args.alg.kty.load(args.key.read())
+-        args.key.close()
++        with open(args.key, "rb") as fp:
++            key = args.alg.kty.load(fp.read())
+         if args.protect is None:
+             args.protect = []
+         if args.compact:
+@@ -426,8 +426,8 @@ class CLI:
+ 
+         if args.key is not None:
+             assert args.kty is not None
+-            key = args.kty.load(args.key.read()).public_key()
+-            args.key.close()
++            with open(args.key, "rb") as fp:
++                key = args.kty.load(fp.read()).public_key()
+         else:
+             key = None
+ 
+@@ -459,13 +459,13 @@ class CLI:
+         subparsers = parser.add_subparsers()
+         parser_sign = subparsers.add_parser("sign")
+         parser_sign.set_defaults(func=cls.sign)
+-        parser_sign.add_argument("-k", "--key", type=argparse.FileType("rb"), required=True)
++        parser_sign.add_argument("-k", "--key", required=True)
+         parser_sign.add_argument("-a", "--alg", type=cls._alg_type, default=jwa.RS256)
+         parser_sign.add_argument("-p", "--protect", action="append", type=cls._header_type)
+ 
+         parser_verify = subparsers.add_parser("verify")
+         parser_verify.set_defaults(func=cls.verify)
+-        parser_verify.add_argument("-k", "--key", type=argparse.FileType("rb"), required=False)
++        parser_verify.add_argument("-k", "--key", required=False)
+         parser_verify.add_argument("--kty", type=cls._kty_type, required=False)
+ 
+         parsed = parser.parse_args(args)

diff --git a/python-josepy.spec b/python-josepy.spec
index f2b57be..68c048a 100644
--- a/python-josepy.spec
+++ b/python-josepy.spec
@@ -6,7 +6,7 @@
 
 Name:           python-%{pypi_name}
 Version:        2.0.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        JOSE protocol implementation in Python
 
 # Automatically converted from old format: ASL 2.0 - review is highly recommended.
@@ -14,6 +14,9 @@ License:        Apache-2.0
 URL:            https://pypi.python.org/pypi/josepy
 Source0:        %{pypi_source}
 Source2:        https://dl.eff.org/certbot.pub
+# patch by Marc Mueller / cdce8p
+# https://github.com/certbot/josepy/commit/8ddcaaed99a61e9277df1ec00157f0aea53378d4
+Patch1:         python-josepy-support-py314.patch
 BuildArch:      noarch
 
 BuildRequires:  python3-devel
@@ -60,7 +63,7 @@ Documentation for python-%{pypi_name}
 %endif
 
 %prep
-%autosetup -n %{pypi_name}-%{version}
+%autosetup -n %{pypi_name}-%{version} -p1
 
 # Remove bundled egg-info
 rm -rf %{pypi_name}.egg-info
@@ -101,6 +104,9 @@ install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/*.1*
 %endif
 
 %changelog
+* Thu Jun 26 2025 Felix Schwarz <fschwarz@fedoraproject.org> - 2.0.0-4
+- add patch to support Python 3.14
+
 * Tue Jun 03 2025 Python Maint <python-maint@redhat.com> - 2.0.0-3
 - Rebuilt for Python 3.14
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-11  6:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  6:20 [rpms/python-josepy] epel10.3: add patch to support Python 3.14 Felix Schwarz

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