commit: 4aca62fd578977aefdca33ee632169c0185d08a8 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat May 3 12:29:38 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat May 3 13:12:01 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4aca62fd
dev-python/zeroconf: Apply a workaround for Cython-3.1 issues Bug: https://bugs.gentoo.org/954107 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../files/zeroconf-0.146.5-cython-3.1.patch | 41 ++++++++++++++++++++++ dev-python/zeroconf/zeroconf-0.146.5.ebuild | 7 +++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/dev-python/zeroconf/files/zeroconf-0.146.5-cython-3.1.patch b/dev-python/zeroconf/files/zeroconf-0.146.5-cython-3.1.patch new file mode 100644 index 000000000000..3e533ed28f6b --- /dev/null +++ b/dev-python/zeroconf/files/zeroconf-0.146.5-cython-3.1.patch @@ -0,0 +1,41 @@ +From c45c924a2de4d8c153800e9a31a28e4d569d8280 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]> +Date: Sat, 3 May 2025 14:26:57 +0200 +Subject: [PATCH] Workaround Cython-3.1 problems + +Disable the use of type annotations since they are often incorrect +upstream, and workaround one other problem caused by wrong annotations. +--- + build_ext.py | 2 +- + src/zeroconf/_services/browser.py | 5 ++++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/build_ext.py b/build_ext.py +index ff088f8..7ebe344 100644 +--- a/build_ext.py ++++ b/build_ext.py +@@ -62,7 +62,7 @@ def build(setup_kwargs: Any) -> None: + { + "ext_modules": cythonize( + EXTENSIONS, +- compiler_directives={"language_level": "3"}, # Python 3 ++ compiler_directives={"language_level": "3", "annotation_typing": False}, # Python 3 + ), + "cmdclass": {"build_ext": BuildExt}, + } +diff --git a/src/zeroconf/_services/browser.py b/src/zeroconf/_services/browser.py +index ab8c050..6af2af8 100644 +--- a/src/zeroconf/_services/browser.py ++++ b/src/zeroconf/_services/browser.py +@@ -394,7 +394,10 @@ class QueryScheduler: + refresh_time_millis: float_, + ) -> None: + """Schedule a query for a pointer.""" +- ttl = int(pointer.ttl) if isinstance(pointer.ttl, float) else pointer.ttl ++ if isinstance(pointer.ttl, float): ++ ttl = int(pointer.ttl) ++ else: ++ ttl = pointer.ttl + scheduled_ptr_query = _ScheduledPTRQuery( + pointer.alias, pointer.name, ttl, expire_time_millis, refresh_time_millis + ) diff --git a/dev-python/zeroconf/zeroconf-0.146.5.ebuild b/dev-python/zeroconf/zeroconf-0.146.5.ebuild index 0e509bc307dd..4a09da4b8792 100644 --- a/dev-python/zeroconf/zeroconf-0.146.5.ebuild +++ b/dev-python/zeroconf/zeroconf-0.146.5.ebuild @@ -5,7 +5,7 @@ EAPI=8 DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=poetry -PYTHON_COMPAT=( python3_{10..13} ) +PYTHON_COMPAT=( python3_{11..13} ) inherit distutils-r1 pypi @@ -36,6 +36,11 @@ distutils_enable_tests pytest export REQUIRE_CYTHON=1 +PATCHES=( + # https://bugs.gentoo.org/954107 (workaround) + "${FILESDIR}/zeroconf-0.146.5-cython-3.1.patch" +) + python_test() { local -x SKIP_IPV6=1 local EPYTEST_DESELECT=(
