commit:     86a33e7222c625f7e04ddc919ebd78dcc727cd4d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu May 29 20:00:53 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 29 20:02:09 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=86a33e72

dev-python/pynvim: enable py3.14, fix typing-extensions dep

I don't think we need typing-extensions for 3.12. See also
https://github.com/neovim/pynvim/commit/a2adeecbb753b2998b24f9ec7ea2b927f6332042
upstream?

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/pynvim/files/pynvim-0.5.2-py314.patch | 51 +++++++++++++++++++++
 dev-python/pynvim/pynvim-0.5.2-r1.ebuild         | 56 ++++++++++++++++++++++++
 2 files changed, 107 insertions(+)

diff --git a/dev-python/pynvim/files/pynvim-0.5.2-py314.patch 
b/dev-python/pynvim/files/pynvim-0.5.2-py314.patch
new file mode 100644
index 000000000000..1bd0d1d90e72
--- /dev/null
+++ b/dev-python/pynvim/files/pynvim-0.5.2-py314.patch
@@ -0,0 +1,51 @@
+https://github.com/neovim/pynvim/commit/e2a3ead549f91bc5f5a157660be7a29e0bc9f728
+
+From e2a3ead549f91bc5f5a157660be7a29e0bc9f728 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <[email protected]>
+Date: Mon, 13 Jan 2025 09:43:32 +0100
+Subject: [PATCH] fix: asyncio.get_child_watcher() was removed in Python 3.14
+ #584
+
+Fixes #583
+---
+ pynvim/msgpack_rpc/event_loop/asyncio.py | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/pynvim/msgpack_rpc/event_loop/asyncio.py 
b/pynvim/msgpack_rpc/event_loop/asyncio.py
+index cb17f321..d4ad1413 100644
+--- a/pynvim/msgpack_rpc/event_loop/asyncio.py
++++ b/pynvim/msgpack_rpc/event_loop/asyncio.py
+@@ -188,10 +188,20 @@ async def connect_stdout():
+ 
+     @override
+     def _connect_child(self, argv: List[str]) -> None:
++        def get_child_watcher():
++            try:
++                return asyncio.get_child_watcher()
++            except AttributeError:  # Python 3.14
++                return None
++
++            return None
++
+         if os.name != 'nt':
+             # see #238, #241
+-            self._child_watcher = asyncio.get_child_watcher()
+-            self._child_watcher.attach_loop(self._loop)
++            watcher = get_child_watcher()
++            if watcher is not None:
++                watcher.attach_loop(self._loop)
++                self._child_watcher = watcher
+ 
+         async def create_subprocess():
+             transport: asyncio.SubprocessTransport  # type: ignore
+@@ -250,7 +260,8 @@ def _close_transport(transport):
+             # Windows: for ProactorBasePipeTransport, close() doesn't take in
+             # effect immediately (closing happens asynchronously inside the
+             # event loop), need to wait a bit for completing graceful 
shutdown.
+-            if os.name == 'nt' and hasattr(transport, '_sock'):
++            if (sys.version_info < (3, 13) and
++                    os.name == 'nt' and hasattr(transport, '_sock')):
+                 async def wait_until_closed():
+                     # pylint: disable-next=protected-access
+                     while transport._sock is not None:
+

diff --git a/dev-python/pynvim/pynvim-0.5.2-r1.ebuild 
b/dev-python/pynvim/pynvim-0.5.2-r1.ebuild
new file mode 100644
index 000000000000..0bdde465d0b2
--- /dev/null
+++ b/dev-python/pynvim/pynvim-0.5.2-r1.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{11..14} pypy3_11 )
+
+inherit distutils-r1
+
+DESCRIPTION="Python client for Neovim"
+HOMEPAGE="
+       https://github.com/neovim/pynvim/
+       https://pypi.org/project/pynvim/
+"
+SRC_URI="
+       https://github.com/neovim/pynvim/archive/${PV}.tar.gz
+               -> ${P}.gh.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+
+RDEPEND="
+       dev-python/msgpack[${PYTHON_USEDEP}]
+       $(python_gen_cond_dep '
+               >=dev-python/greenlet-3.0[${PYTHON_USEDEP}]
+       ' 'python*')
+       $(python_gen_cond_dep '
+               >=dev-python/typing-extensions-4.5[${PYTHON_USEDEP}]
+       ' 3.11)
+"
+BDEPEND="
+       test? (
+               app-editors/neovim
+               dev-python/pytest-timeout[${PYTHON_USEDEP}]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.5.2-py314.patch
+)
+
+: ${EPYTEST_TIMEOUT:=5}
+distutils_enable_tests pytest
+
+python_test() {
+       local EPYTEST_DESELECT=(
+               # hangs
+               test/test_events.py::test_broadcast
+       )
+
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest
+}

Reply via email to