pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/devel/py-kivy
Module Name: pkgsrc
Committed By: wiz
Date: Wed Oct 28 05:09:43 UTC 2026
Modified Files:
pkgsrc/devel/py-kivy: Makefile distinfo
Added Files:
pkgsrc/devel/py-kivy/patches: patch-kivy_clock.py
patch-kivy_core_text_____init____.py patch-kivy_tests_common.py
patch-kivy_tests_conftest.py patch-kivy_tests_fixtures.py
patch-kivy_utils.py patch-pyproject.toml
Log Message:
py-kivy: improve NetBSD support
Based on https://codeberg.org/gnuhealth/mygnuhealth/wiki/MyGNUHealth-on-NetBSD-with-Kivy-Python
While here, pull in upstream changes to fix compatibility with
latest pytest-asyncio, and get the test suite to run.
Bump PKGREVISION.
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 pkgsrc/devel/py-kivy/Makefile
cvs rdiff -u -r1.6 -r1.7 pkgsrc/devel/py-kivy/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/py-kivy/patches/patch-kivy_clock.py \
pkgsrc/devel/py-kivy/patches/patch-kivy_core_text_____init____.py \
pkgsrc/devel/py-kivy/patches/patch-kivy_tests_common.py \
pkgsrc/devel/py-kivy/patches/patch-kivy_tests_conftest.py \
pkgsrc/devel/py-kivy/patches/patch-kivy_tests_fixtures.py \
pkgsrc/devel/py-kivy/patches/patch-kivy_utils.py \
pkgsrc/devel/py-kivy/patches/patch-pyproject.toml
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/devel/py-kivy/Makefile
diff -u pkgsrc/devel/py-kivy/Makefile:1.31 pkgsrc/devel/py-kivy/Makefile:1.32
--- pkgsrc/devel/py-kivy/Makefile:1.31 Fri Oct 16 19:43:49 2026
+++ pkgsrc/devel/py-kivy/Makefile Wed Oct 28 05:09:43 2026
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.31 2026/10/16 19:43:49 adam Exp $
+# $NetBSD: Makefile,v 1.32 2026/10/28 05:09:43 wiz Exp $
DISTNAME= Kivy-2.3.1
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:tl}
-PKGREVISION= 8
+PKGREVISION= 9
CATEGORIES= devel python
MASTER_SITES= ${MASTER_SITE_PYPI:=K/Kivy/}
@@ -24,6 +24,7 @@ DEPENDS+= ${PYPKGPREFIX}-Pillow>=9.5.0:.
# \todo File upstream bug that dependency on enchant and pygame is undocumented.
DEPENDS+= ${PYPKGPREFIX}-enchant>=1.6.5:../../textproc/py-enchant
DEPENDS+= ${PYPKGPREFIX}-game-[0-9]*:../../devel/py-game
+TEST_DEPENDS+= ${PYPKGPREFIX}-responses-[0-9]*:../../net/py-responses
TEST_DEPENDS+= ${PYPKGPREFIX}-test-asyncio-[0-9]*:../../devel/py-test-asyncio
TEST_DEPENDS+= ${PYPKGPREFIX}-test-benchmark-[0-9]*:../../devel/py-test-benchmark
TEST_DEPENDS+= ${PYPKGPREFIX}-test-cov-[0-9]*:../../devel/py-test-cov
@@ -52,6 +53,28 @@ WHEEL_NAME= ${DISTNAME:tl}
# For share/kivy-examples
PYTHON_SELF_CONFLICT= yes
+SUBST_CLASSES+= prefix
+SUBST_VARS.prefix= PREFIX
+SUBST_FILES.prefix+= kivy/core/text/__init__.py
+SUBST_STAGE.prefix= pre-configure
+SUBST_MESSAGE.prefix= Fixing PREFIX.
+
+post-install:
+ ${RM} ${DESTDIR}${PREFIX}/${PYSITELIB}/kivy/tests/common.py.orig
+ ${RM} ${DESTDIR}${PREFIX}/${PYSITELIB}/kivy/tests/conftest.py.orig
+ ${RM} ${DESTDIR}${PREFIX}/${PYSITELIB}/kivy/tests/fixtures.py.orig
+
+# as of 2.3.1
+# 19 failed, 873 passed, 23 skipped, 1 xfailed, 5 warnings
+
+TEST_ENV+= PYTHONPATH=${DESTDIR}${PREFIX}/${PYSITELIB}
+# Run tests against destdir (after 'make package') to have compiled
+# extension available; explicitly pass test directory to avoid
+# automatic collection find examples/widgets/bubble_test.py first.
+do-test:
+ cd ${WRKSRC} && ${SETENV} ${TEST_ENV} \
+ pytest-${PYVERSSUFFIX} ${DESTDIR}${PREFIX}/${PYSITELIB}/kivy/tests
+
.include "../../mk/bsd.prefs.mk"
# Include various packages needed for SDL2.
Index: pkgsrc/devel/py-kivy/distinfo
diff -u pkgsrc/devel/py-kivy/distinfo:1.6 pkgsrc/devel/py-kivy/distinfo:1.7
--- pkgsrc/devel/py-kivy/distinfo:1.6 Tue Aug 25 09:23:00 2026
+++ pkgsrc/devel/py-kivy/distinfo Wed Oct 28 05:09:43 2026
@@ -1,9 +1,16 @@
-$NetBSD: distinfo,v 1.6 2026/08/25 09:23:00 wiz Exp $
+$NetBSD: distinfo,v 1.7 2026/10/28 05:09:43 wiz Exp $
BLAKE2s (Kivy-2.3.1.tar.gz) = bc67e1d62d706dfe5c8f168960bf6b352db08539eb009993069dd7bf20b4de87
SHA512 (Kivy-2.3.1.tar.gz) = f26983a6ccdc173d7d69f0c17a36dc8a4dfd31e4777363253b6bcbf549c44ff2d281e8529ff3ea6683fbfb1c16102bd436bb0433b00c23eb4084be30b3b487ad
Size (Kivy-2.3.1.tar.gz) = 23967306 bytes
+SHA1 (patch-kivy_clock.py) = aaf276d23d1c6706d59635348c42af39a2242f83
+SHA1 (patch-kivy_core_text_____init____.py) = 9619ee9954f0d179ed9afcc0218f0d98bd2b026d
SHA1 (patch-kivy_graphics_context__instructions.pyx) = 832277962827829929a90ee5feeb8da34d7051a9
SHA1 (patch-kivy_graphics_instructions.pyx) = 36300574e45441df13b082bc7b3ad6dcb94f02d5
SHA1 (patch-kivy_graphics_opengl.pyx) = 968074f0b413e5b1b267d8d126cbee1a10756f00
+SHA1 (patch-kivy_tests_common.py) = 25ed0951210163046fc8250a04d9852e4eca6544
+SHA1 (patch-kivy_tests_conftest.py) = b9d34ded50ca4e3c2505c8dfb69193f33e449cb5
+SHA1 (patch-kivy_tests_fixtures.py) = 02507b88ccdbf13c9cbec431dbdef729526d2854
+SHA1 (patch-kivy_utils.py) = a1219b45c70e5cff7a5d3a3781cabae422b3cd93
SHA1 (patch-kivy_weakproxy.pyx) = 34214bdd35389edab5cc13e3009870b183ac6371
+SHA1 (patch-pyproject.toml) = 3402eadb72ba7abcbdc75ffdc8bc53d14df56fa4
Added files:
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_clock.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_clock.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_clock.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,15 @@
+$NetBSD: patch-kivy_clock.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+Support NetBSD.
+
+--- kivy/clock.py.orig 2026-10-27 17:57:38.893708086 +0000
++++ kivy/clock.py
+@@ -531,7 +531,7 @@ try:
+ # 12: CLOCK_MONOTONIC_FAST (FreeBSD specific)
+ Logger.debug('clock.py: {{{:s}}} clock ID {:d}'.format(
+ platform, _clockid))
+- elif 'openbsd' in platform:
++ elif platform == 'openbsd' or platform.startswith('netbsd'):
+ _clockid = 3 # CLOCK_MONOTONIC
+ else:
+ _clockid = 1 # CLOCK_MONOTONIC
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_core_text_____init____.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_core_text_____init____.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_core_text_____init____.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,18 @@
+$NetBSD: patch-kivy_core_text_____init____.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+Support NetBSD.
+
+--- kivy/core/text/__init__.py.orig 2026-10-27 17:58:45.353122636 +0000
++++ kivy/core/text/__init__.py
+@@ -433,6 +433,11 @@ class LabelBase(object):
+ '/usr/share/fonts', '/usr/local/share/fonts',
+ os.path.expanduser('~/.fonts'),
+ os.path.expanduser('~/.local/share/fonts')]
++ elif platform == 'netbsd':
++ fdirs = [
++ '/usr/X11R7/lib/X11/fonts', '@PREFIX@/share/fonts/X11',
++ os.path.expanduser('~/.fonts'),
++ os.path.expanduser('~/.local/share/fonts')]
+ elif platform == 'macosx':
+ fdirs = ['/Library/Fonts', '/System/Library/Fonts',
+ os.path.expanduser('~/Library/Fonts')]
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_tests_common.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_tests_common.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_tests_common.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,18 @@
+$NetBSD: patch-kivy_tests_common.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+https://github.com/kivy/kivy/commit/122596b656304aef81b53de2aebfc53bd24f0ecc
+
+--- kivy/tests/common.py.orig 2026-10-28 04:29:19.784039385 +0000
++++ 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 '
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_tests_conftest.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_tests_conftest.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_tests_conftest.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,15 @@
+$NetBSD: patch-kivy_tests_conftest.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+https://github.com/kivy/kivy/commit/122596b656304aef81b53de2aebfc53bd24f0ecc
+
+--- kivy/tests/conftest.py.orig 2026-10-28 04:29:19.784222810 +0000
++++ kivy/tests/conftest.py
+@@ -6,7 +6,7 @@ try:
+ 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
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_tests_fixtures.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_tests_fixtures.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_tests_fixtures.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,95 @@
+$NetBSD: patch-kivy_tests_fixtures.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+https://github.com/kivy/kivy/commit/122596b656304aef81b53de2aebfc53bd24f0ecc
+
+--- kivy/tests/fixtures.py.orig 2026-10-28 04:29:19.784400323 +0000
++++ kivy/tests/fixtures.py
+@@ -1,4 +1,17 @@ import pytest
+ 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 @@ apps = []
+ apps = []
+
+
+-@pytest.fixture()
++# 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()
Index: pkgsrc/devel/py-kivy/patches/patch-kivy_utils.py
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-kivy_utils.py:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-kivy_utils.py Wed Oct 28 05:09:43 2026
@@ -0,0 +1,15 @@
+$NetBSD: patch-kivy_utils.py,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+Support NetBSD.
+
+--- kivy/utils.py.orig 2026-10-27 17:58:09.545138203 +0000
++++ kivy/utils.py
+@@ -448,6 +448,8 @@ def _get_platform():
+ return 'linux'
+ elif _sys_platform.startswith('freebsd'):
+ return 'linux'
++ elif _sys_platform.startswith('netbsd'):
++ return 'netbsd'
+ return 'unknown'
+
+
Index: pkgsrc/devel/py-kivy/patches/patch-pyproject.toml
diff -u /dev/null pkgsrc/devel/py-kivy/patches/patch-pyproject.toml:1.1
--- /dev/null Wed Oct 28 05:09:43 2026
+++ pkgsrc/devel/py-kivy/patches/patch-pyproject.toml Wed Oct 28 05:09:43 2026
@@ -0,0 +1,11 @@
+$NetBSD: patch-pyproject.toml,v 1.1 2026/10/28 05:09:43 wiz Exp $
+
+https://github.com/kivy/kivy/commit/122596b656304aef81b53de2aebfc53bd24f0ecc
+
+--- pyproject.toml.orig 2026-10-28 04:29:19.784505631 +0000
++++ pyproject.toml
+@@ -15,3 +15,4 @@ markers = "incremental: mark a test as incremental."
+ [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"
Home |
Main Index |
Thread Index |
Old Index