commit:     280768d71fb475d0ef898743ad59a27e07685037
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 10 16:36:11 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Nov 10 18:44:48 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=280768d7

dev-python/pyopengl: Enable py3.12

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../pyopengl/files/pyopengl-3.1.7-py312.patch      | 28 ++++++++++++++++++++++
 dev-python/pyopengl/pyopengl-3.1.7.ebuild          | 12 +++++++++-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/dev-python/pyopengl/files/pyopengl-3.1.7-py312.patch 
b/dev-python/pyopengl/files/pyopengl-3.1.7-py312.patch
new file mode 100644
index 000000000000..53c4b6ab847f
--- /dev/null
+++ b/dev-python/pyopengl/files/pyopengl-3.1.7-py312.patch
@@ -0,0 +1,28 @@
+From b49af26c615236ebc29cf125a8315091482a4a2a Mon Sep 17 00:00:00 2001
+From: Scott Talbert <[email protected]>
+Date: Tue, 18 Jul 2023 10:12:29 -0400
+Subject: [PATCH] Fix ctypes FormatHandler for Python 3.12+
+
+In Python 3.12, CArgObject moved from builtins to _ctypes it seems.
+
+Fixes #99.
+---
+ OpenGL/__init__.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/OpenGL/__init__.py b/OpenGL/__init__.py
+index f9cc6bfc..77dc8c0b 100644
+--- a/OpenGL/__init__.py
++++ b/OpenGL/__init__.py
+@@ -308,7 +308,7 @@ FormatHandler(
+     "ctypesparameter",
+     "OpenGL.arrays.ctypesparameters.CtypesParameterHandler",
+     [
+-        _bi + ".CArgObject",
++        ("_ctypes" if sys.version_info[:2] >= (3,12) else _bi) + 
".CArgObject",
+         "ctypes.c_uint",
+         "ctypes.c_int",
+         "ctypes.c_float",
+-- 
+2.42.1
+

diff --git a/dev-python/pyopengl/pyopengl-3.1.7.ebuild 
b/dev-python/pyopengl/pyopengl-3.1.7.ebuild
index 223b4939eb29..e809448d849d 100644
--- a/dev-python/pyopengl/pyopengl-3.1.7.ebuild
+++ b/dev-python/pyopengl/pyopengl-3.1.7.ebuild
@@ -7,7 +7,7 @@ DISTUTILS_USE_PEP517=setuptools
 PYPI_NO_NORMALIZE=1
 PYPI_PN=PyOpenGL
 PYTHON_REQ_USE="tk?"
-PYTHON_COMPAT=( python3_{10..11} )
+PYTHON_COMPAT=( python3_{10..12} )
 
 inherit distutils-r1 pypi virtualx
 
@@ -49,6 +49,16 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       # 
https://github.com/mcfletch/pyopengl/commit/b49af26c615236ebc29cf125a8315091482a4a2a
+       "${FILESDIR}/${P}-py312.patch"
+)
+
+EPYTEST_DESELECT=(
+       # unreliable memory counting test
+       tests/test_vbo_memusage.py::test_sf_2980896
+)
+
 src_test() {
        virtx distutils-r1_src_test
 }

Reply via email to