commit: b038c00e3ed31301d1c199f2c9fe10a3112c3b1c
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 08:33:21 2025 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed May 14 11:59:23 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b038c00e
dev-python/faker: Enable py3.14
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/faker/faker-37.1.0.ebuild | 7 +++-
dev-python/faker/files/faker-37.1.0-py314.patch | 45 +++++++++++++++++++++++++
2 files changed, 51 insertions(+), 1 deletion(-)
diff --git a/dev-python/faker/faker-37.1.0.ebuild
b/dev-python/faker/faker-37.1.0.ebuild
index 1f51daec1777..57e328c855a3 100644
--- a/dev-python/faker/faker-37.1.0.ebuild
+++ b/dev-python/faker/faker-37.1.0.ebuild
@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_PN=${PN^}
-PYTHON_COMPAT=( pypy3 pypy3_11 python3_{10..13} )
+PYTHON_COMPAT=( pypy3_11 python3_{11..14} )
inherit distutils-r1 pypi
@@ -34,6 +34,11 @@ BDEPEND="
# note: tests are flaky with xdist
distutils_enable_tests pytest
+PATCHES=(
+ # https://github.com/joke2k/faker/pull/2213
+ "${FILESDIR}/${P}-py314.patch"
+)
+
python_test() {
local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
local -x PYTEST_PLUGINS=faker.contrib.pytest.plugin
diff --git a/dev-python/faker/files/faker-37.1.0-py314.patch
b/dev-python/faker/files/faker-37.1.0-py314.patch
new file mode 100644
index 000000000000..9f6931ba7a8d
--- /dev/null
+++ b/dev-python/faker/files/faker-37.1.0-py314.patch
@@ -0,0 +1,45 @@
+From eaad7bb42385793a0622376caf3b832a7836781e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Wed, 14 May 2025 13:17:48 +0200
+Subject: [PATCH] Fix type annotations for Python 3.14
+
+Fix type annotations for `Provider.json()` to avoid name collision
+in Python 3.14.0b1 where `json` is resolved to the `json()` method
+itself rather than the `json` module. Import `JSONEncoder` directly
+instead, so we can reference it without `json.`.
+
+Fixes #2212
+---
+ faker/providers/misc/__init__.py | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/faker/providers/misc/__init__.py
b/faker/providers/misc/__init__.py
+index dca3363e..6ed2e958 100644
+--- a/faker/providers/misc/__init__.py
++++ b/faker/providers/misc/__init__.py
+@@ -9,6 +9,7 @@ import tarfile
+ import uuid
+ import zipfile
+
++from json import JSONEncoder
+ from typing import Any, Callable, Dict, List, Literal, Optional, Sequence,
Set, Tuple, Type, Union, overload
+
+ from faker.exceptions import UnsupportedFeature
+@@ -536,7 +537,7 @@ class Provider(BaseProvider):
+ data_columns: Optional[List] = None,
+ num_rows: int = 10,
+ indent: Optional[int] = None,
+- cls: Optional[Type[json.JSONEncoder]] = None,
++ cls: Optional[Type[JSONEncoder]] = None,
+ ) -> bytes:
+ """
+ Generate random JSON structure and return as bytes.
+@@ -551,7 +552,7 @@ class Provider(BaseProvider):
+ data_columns: Optional[List] = None,
+ num_rows: int = 10,
+ indent: Optional[int] = None,
+- cls: Optional[Type[json.JSONEncoder]] = None,
++ cls: Optional[Type[JSONEncoder]] = None,
+ ) -> str:
+ """
+ Generate random JSON structure values.