repo/proj/guru:master commit in: dev-python/kivy/, dev-python/kivy/files/

"Florian Schmaus" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786652153.ae7133727484488f375740c04aa1f028eca2c739.flow@gentoo>
commit:     ae7133727484488f375740c04aa1f028eca2c739
Author:     Pavel Sobolev <contact <AT> paveloom <DOT> dev>
AuthorDate: Wed Aug 12 19:18:05 2026 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 20:15:53 2026 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=ae713372

dev-python/kivy: new package, add 2.3.1

Signed-off-by: Pavel Sobolev <contact <AT> paveloom.dev>

 dev-python/kivy/Manifest                           |   3 +
 .../files/kivy-2.3.1-fix-pytest-9.x.x-issues.patch | 129 +++++++++++++++++++++
 dev-python/kivy/kivy-2.3.1.ebuild                  |  74 ++++++++++++
 dev-python/kivy/metadata.xml                       |  12 ++
 4 files changed, 218 insertions(+)

diff --git a/dev-python/kivy/Manifest b/dev-python/kivy/Manifest
new file mode 100644
index 0000000000..ebf8600c45
--- /dev/null
+++ b/dev-python/kivy/Manifest
@@ -0,0 +1,3 @@
+DIST kivy-2.3.1-remove-Python-3.6-workaround.patch 1040 BLAKE2B fd43fe823cfb4c9d559f9ef8a34c354a3298dbd1102a544097d731e993f34e72776377cd7c813a2ecb90971089fd581c5807d8aee524fe6479ab3e7dfd442b48 SHA512 e7bd9e32f61644a11a4882fd034ab0aedfd585dd9b272e96cc196f007da062451ab6eb2cf191750dcc56b21af337577ff96271bcc9c282ad780961e36d1c8850
+DIST kivy-2.3.1-remove-old-Python-2-long-from-Cython-files.patch 2430 BLAKE2B ca53b9ca5338024cac3e2c726a251f5c32dadb817a33b90d4f12c25c2c01dfa79d88739488886bc0a86e6b9d56d94d2b3a8a97d219107f1f289d18d235ebee96 SHA512 431fa247aba5bef6d5f9ca5d552dabc56e5985bf3f361de972ac06aa032bb1e359320e9deab4bad9485aee936c9f304ef75f84b85d29786a8f1d308e62644026
+DIST kivy-2.3.1.tar.gz 23968642 BLAKE2B 39a0b94b26376866aca3974c4007de6ee4e03c875b5eae86fa0810936dc077fd2cef410f088cdac3f92ab777f77d078d4b668abca520dd48b0ed278612c47ffb SHA512 e524d0e3c2a259b357b3b26a0d8178a9bfb3480fe19af588150a9846757878d7d86cdd08085e1770a361cfed1bc8aafdf395a8069123bfd1ff5d7e1badadbecf

diff --git a/dev-python/kivy/files/kivy-2.3.1-fix-pytest-9.x.x-issues.patch b/dev-python/kivy/files/kivy-2.3.1-fix-pytest-9.x.x-issues.patch
new file mode 100644
index 0000000000..845358ec06
--- /dev/null
+++ b/dev-python/kivy/files/kivy-2.3.1-fix-pytest-9.x.x-issues.patch
@@ -0,0 +1,129 @@
+From: Pavel Sobolev <contact-2GWvd5oGOoG/[email protected]>
+Subject: [PATCH] Fix pytest>=9.x.x issues
+
+Upstream-Commit: https://github.com/kivy/kivy/commit/122596b656304aef81b53de2aebfc53bd24f0ecc
+Signed-off-by: Pavel Sobolev <contact-2GWvd5oGOoG/[email protected]>
+
+--- a/kivy/tests/common.py
++++ b/kivy/tests/common.py
+@@ -498,7 +498,10 @@ def async_run(func=None, app_cls_func=None):
+         if kivy_eventloop == 'asyncio':
+             try:
+                 import pytest_asyncio
+-                return pytest.mark.asyncio(pytest_asyncio.fixture(func))
++                # In pytest 9, marks on fixtures have no effect.
++                # We only need to mark the async test function,
++                # not turn it into a fixture.
++                return pytest.mark.asyncio(func)
+             except ImportError:
+                 return pytest.mark.skip(
+                     reason='KIVY_EVENTLOOP == "asyncio" but '
+--- a/kivy/tests/conftest.py
++++ b/kivy/tests/conftest.py
+@@ -6,7 +6,7 @@ kivy_eventloop = os.environ.get('KIVY_EVENTLOOP', 'asyncio')
+ try:
+     from .fixtures import kivy_app, kivy_clock, kivy_metrics, \
+         kivy_exception_manager
+-except SyntaxError:
++except (SyntaxError, ImportError):
+     # async app tests would be skipped due to async_run forcing it to skip so
+     # it's ok to fail here as it won't be used anyway
+     pass
+--- a/kivy/tests/fixtures.py
++++ b/kivy/tests/fixtures.py
+@@ -1,4 +1,17 @@
+ import pytest
++import os
++import sys
++# Choose async fixture decorator based on KIVY_EVENTLOOP and available plugins
++_env_eventloop = os.environ.get('KIVY_EVENTLOOP', 'asyncio')
++if _env_eventloop == 'asyncio':
++    try:
++        import pytest_asyncio
++        _ASYNC_FIXTURE_DECORATOR = pytest_asyncio.fixture
++    except ImportError:  # fallback if pytest-asyncio is missing
++        _ASYNC_FIXTURE_DECORATOR = pytest.fixture
++else:
++    # For trio/other event loops, let the active plugin handle async functions
++    _ASYNC_FIXTURE_DECORATOR = pytest.fixture
+ import gc
+ import weakref
+ import time
+@@ -66,13 +79,28 @@ def kivy_exception_manager():
+ apps = []
+ 
+ 
[email protected]()
++# Async fixture, decorator chosen based on available plugin
++@_ASYNC_FIXTURE_DECORATOR()
+ async def kivy_app(request, nursery):
++    from kivy.base import stopTouchApp
++    from kivy.app import App
++
+     gc.collect()
++    # Clean up any previous app that might still be hanging around
+     if apps:
+         last_app, last_request = apps.pop()
+-        assert last_app() is None, \
+-            'Memory leak: failed to release app for test ' + repr(last_request)
++        leaked = last_app()
++        if leaked is not None:
++            # Log warning but don't fail - pytest 9 async fixtures may not
++            # guarantee teardown completion before next test setup
++            print(
++                f"\nWarning: Previous app not released: {last_request}",
++                file=sys.stderr,
++            )
++            stopTouchApp()
++            App._running_app = None
++            gc.collect()
++            del leaked
+ 
+     from os import environ
+     environ['KIVY_USE_DEFAULTCONFIG'] = '1'
+@@ -96,10 +124,6 @@ async def kivy_app(request, nursery):
+ 
+     kivy_eventloop = environ.get('KIVY_EVENTLOOP', 'asyncio')
+     if kivy_eventloop == 'asyncio':
+-        pytest.importorskip(
+-            'pytest_asyncio',
+-            reason='KIVY_EVENTLOOP == "asyncio" but '
+-                   '"pytest_asyncio" is not installed')
+         async_lib = 'asyncio'
+     elif kivy_eventloop == 'trio':
+         pytest.importorskip(
+@@ -149,7 +173,10 @@ async def kivy_app(request, nursery):
+ 
+     yield app
+ 
++    # Comprehensive cleanup for pytest 9 async fixture compatibility
++    from kivy.app import App
+     stopTouchApp()
++    App._running_app = None
+ 
+     ts = time.perf_counter()
+     while not app.app_has_stopped:
+@@ -161,9 +188,14 @@ async def kivy_app(request, nursery):
+         Window.remove_widget(child)
+     context.pop()
+ 
+-    # release all the resources
++    # Aggressively release all resources
+     del context
+     LoggerHistory.clear_history()
++
++    # Store weakref for next test to check cleanup
+     apps.append((weakref.ref(app), request))
+     del app
+-    gc.collect()
++
++    # Force garbage collection multiple times to ensure cleanup
++    for _ in range(3):
++        gc.collect()
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -15,3 +15,4 @@ requires = [
+ [tool.pytest.ini_options]
+ addopts = "--benchmark-skip --benchmark-warmup=on --benchmark-warmup-iterations=5 --benchmark-disable-gc --benchmark-name=short --benchmark-sort=mean --benchmark-group-by=fullfunc --benchmark-storage=.benchmarks-kivy --benchmark-save=kivy"
+ markers = "incremental: mark a test as incremental."
++asyncio_mode = "auto"

diff --git a/dev-python/kivy/kivy-2.3.1.ebuild b/dev-python/kivy/kivy-2.3.1.ebuild
new file mode 100644
index 0000000000..6e362e1fc7
--- /dev/null
+++ b/dev-python/kivy/kivy-2.3.1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{12..15} )
+
+inherit distutils-r1
+
+DESCRIPTION="Open source cross-platform UI framework written in Python"
+HOMEPAGE="https://kivy.org/"
+SRC_URI="
+	https://github.com/kivy/kivy/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
+	https://github.com/kivy/kivy/commit/5a1b27d7d3bdee6cedb55440bfae9c4e66fb3c68.patch
+		-> ${PN}-2.3.1-remove-old-Python-2-long-from-Cython-files.patch
+	https://github.com/kivy/kivy/commit/4b20740cb63b03fdfb65b782f1ce3de42bd6e7b3.patch
+		-> ${PN}-2.3.1-remove-Python-3.6-workaround.patch
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+	dev-python/pysdl2[${PYTHON_USEDEP}]
+	media-libs/libsdl2
+	media-libs/sdl2-image
+	media-libs/sdl2-mixer
+	media-libs/sdl2-ttf
+
+	media-libs/gstreamer
+
+	dev-python/filetype[${PYTHON_USEDEP}]
+	dev-python/pygments[${PYTHON_USEDEP}]
+	dev-python/requests[${PYTHON_USEDEP}]
+"
+BDEPEND="
+	dev-python/cython[${PYTHON_USEDEP}]
+
+	test? (
+		dev-python/responses[${PYTHON_USEDEP}]
+	)
+"
+
+PATCHES=(
+	"${DISTDIR}/${PN}-2.3.1-remove-old-Python-2-long-from-Cython-files.patch"
+	"${DISTDIR}/${PN}-2.3.1-remove-Python-3.6-workaround.patch"
+	"${FILESDIR}/${PN}-2.3.1-fix-pytest-9.x.x-issues.patch"
+)
+
+EPYTEST_IGNORE=(
+	"kivy/tests/test_audio.py"
+	"kivy/tests/test_benchmark.py"
+	"kivy/tests/test_video.py"
+)
+
+EPYTEST_PLUGINS=( pytest-asyncio )
+distutils_enable_tests pytest
+
+src_compile() {
+	export USE_WAYLAND=1
+	export USE_X11=1
+	distutils-r1_src_compile
+}
+
+python_test() {
+	export nonetwork=1
+	export NONETWORK=1
+	cd "${BUILD_DIR}/install$(python_get_sitedir)" || die
+	epytest -o addopts=
+	rm results.png || die
+}

diff --git a/dev-python/kivy/metadata.xml b/dev-python/kivy/metadata.xml
new file mode 100644
index 0000000000..2b8898611f
--- /dev/null
+++ b/dev-python/kivy/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer type="person">
+    <name>Pavel Sobolev</name>
+    <email>contact-2GWvd5oGOoG/[email protected]</email>
+  </maintainer>
+  <upstream>
+    <bugs-to>https://github.com/kivy/kivy/issues</bugs-to>
+    <remote-id type="github">kivy/kivy</remote-id>
+  </upstream>
+</pkgmetadata>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.