summaryrefslogtreecommitdiff
path: root/dev-python/pyopengl-accelerate
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-12-02 02:07:07 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-12-02 02:07:07 +0000
commitd4f65848c7ecabb56e2f93889cbd20078cd347f7 (patch)
tree180032f5afeb689db6a270d612f3e3364ed8fd2b /dev-python/pyopengl-accelerate
parentc635a4b7ddb6105bfc6fef130b188a087726677b (diff)
gentoo auto-resync : 02:12:2024 - 02:07:07
Diffstat (limited to 'dev-python/pyopengl-accelerate')
-rw-r--r--dev-python/pyopengl-accelerate/Manifest4
-rw-r--r--dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-gcc-14.patch42
-rw-r--r--dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-numpy-2.0.patch171
-rw-r--r--dev-python/pyopengl-accelerate/pyopengl-accelerate-3.1.8-r1.ebuild81
-rw-r--r--dev-python/pyopengl-accelerate/pyopengl-accelerate-9999.ebuild81
5 files changed, 379 insertions, 0 deletions
diff --git a/dev-python/pyopengl-accelerate/Manifest b/dev-python/pyopengl-accelerate/Manifest
index 5bf35e44a8b3..b2dfad0b6299 100644
--- a/dev-python/pyopengl-accelerate/Manifest
+++ b/dev-python/pyopengl-accelerate/Manifest
@@ -1,3 +1,7 @@
+AUX pyopengl-accelerate-3.1.8-gcc-14.patch 1852 BLAKE2B 8751f51383f1971803dbf79ceb2d2434125b4e0803c2848f03ef268528e53bb1c28c08a354c5cb0a15616f47313c77e7748c8278892ab5558dbc7bc40762bb02 SHA512 fa8f7b98f08dc0679e050c637996460539a9b1a0dc2852aefa51e862753430e3b316390f1792acf9ffdbab0a59858e01efc669d084a68fac3db0492bb0232824
+AUX pyopengl-accelerate-3.1.8-numpy-2.0.patch 5634 BLAKE2B ede68f2263a4fb64b9f429f7840c35af94defeb101c0573fecdb468776e88a886c2ac58053f0544dc6b5f6d0d26ca2773ff993a0889c649ca01efd221853c136 SHA512 d70778ea7d55e49f07fbbe201c0b08ea107bc48a6f73a89184c5f6cafe961a876d7916c624413eaa1d2271e8b10ddf57a7117925bfa716deb77b69c8fb20e630
DIST pyopengl-release-3.1.8.gh.tar.gz 3599436 BLAKE2B 7f33345d68d66d3cc81278eaa5f54298694f41f40583ee08a1f9f677705fb4414b6b2afbcd7b9345199b5f573478bfeba050e185b6534cbb19b45cb25c241b47 SHA512 d95014a36bd889fa014043e4640ba7f319bb996cb56e5f7086ee05d39c53d3928512d52b0ce181d7c144775a4da7eff7403cada0f91f23f56a699a1b023e00e6
+EBUILD pyopengl-accelerate-3.1.8-r1.ebuild 1521 BLAKE2B 0c9d9e69a33e1637223ede578a7fd464bec52f16389498c9998634f79ade5862819bd79c461e06b9a5099bbf7bd36596727626e71726b1983ebe9fc197794f65 SHA512 dfa4175d7187ad74e725ba23bfaa3f6fa4f376d391bfc709ecd371829e4bb38484416dfee75c80375febea7b7ac1b92009001755939c90640e640465f1890c81
EBUILD pyopengl-accelerate-3.1.8.ebuild 1165 BLAKE2B e1439fc90fb74f421f6d37e0c55255ae365e4607ca7623cd7515b74e33396ad73e992f307016499b628ec44bd6bcf52d83626a15128834e8b529b55d5326e254 SHA512 368d13e0194307287159e4663138d746c403ab4c88fddc5f6d607f4f6e9bbdd208524a83c665262787de0d24b14538becabe311b71c87f7d9519af7ad1bef7aa
+EBUILD pyopengl-accelerate-9999.ebuild 1521 BLAKE2B 0c9d9e69a33e1637223ede578a7fd464bec52f16389498c9998634f79ade5862819bd79c461e06b9a5099bbf7bd36596727626e71726b1983ebe9fc197794f65 SHA512 dfa4175d7187ad74e725ba23bfaa3f6fa4f376d391bfc709ecd371829e4bb38484416dfee75c80375febea7b7ac1b92009001755939c90640e640465f1890c81
MISC metadata.xml 515 BLAKE2B 4a8dfbbf2250df73d9880ed75c4bfd63596e7f276dfd5dc15aff9177ad0b005256237e827bf4a0ce10f823ee1a17651248c1b47961bbd09af0a41b6281214228 SHA512 4f1a5ea9b42ba29e78fc15d2ad40623c63a2f351cc0a5f27eb7f8173155278bf214d5ac0f2d348c04967a99b2bb1f2c4b596ab8741a17cd891b2c34065ef0e35
diff --git a/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-gcc-14.patch b/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-gcc-14.patch
new file mode 100644
index 000000000000..56f976288316
--- /dev/null
+++ b/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-gcc-14.patch
@@ -0,0 +1,42 @@
+From fbe0fab7947788039cb4fbc9a5a1ea65a0c0e15b Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Fri, 5 Jan 2024 08:48:12 +0100
+Subject: [PATCH 1/2] accelerate: Fix type of PyArray_FillWithScalar
+
+The first argument is of type PyArrayObject, not PyObject.
+--- a/accelerate/src/numpy_formathandler.pyx
++++ b/accelerate/src/numpy_formathandler.pyx
+@@ -22,7 +22,7 @@ cdef extern from "numpy/arrayobject.h":
+ int PyArray_ISCARRAY_RO( np.ndarray instance )
+ cdef np.ndarray PyArray_Zeros(int nd, np.npy_intp* dims, np.dtype, int fortran)
+ cdef np.ndarray PyArray_EnsureArray(object)
+- cdef int PyArray_FillWithScalar(object, object)
++ cdef int PyArray_FillWithScalar(np.ndarray, object)
+ cdef void import_array()
+ cdef void* PyArray_DATA( np.ndarray )
+ cdef int PyArray_NDIM( np.ndarray )
+
+From f62dd58a5437c628d3ff3e626d4507811ef2127b Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Fri, 5 Jan 2024 08:48:43 +0100
+Subject: [PATCH 2/2] accelerate: Use recommended way to integrate NumPy with
+ Cython
+
+This approach follows
+<https://cython.readthedocs.io/en/latest/src/tutorial/numpy.html#adding-types>.
+--- a/accelerate/src/numpy_formathandler.pyx
++++ b/accelerate/src/numpy_formathandler.pyx
+@@ -23,7 +23,6 @@ cdef extern from "numpy/arrayobject.h":
+ cdef np.ndarray PyArray_Zeros(int nd, np.npy_intp* dims, np.dtype, int fortran)
+ cdef np.ndarray PyArray_EnsureArray(object)
+ cdef int PyArray_FillWithScalar(np.ndarray, object)
+- cdef void import_array()
+ cdef void* PyArray_DATA( np.ndarray )
+ cdef int PyArray_NDIM( np.ndarray )
+ cdef int *PyArray_DIMS( np.ndarray )
+@@ -227,4 +226,4 @@ cdef class NumpyHandler(FormatHandler):
+
+ # Cython numpy tutorial neglects to mention this AFAICS
+ # get segfaults without it
+-import_array()
++np.import_array()
diff --git a/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-numpy-2.0.patch b/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-numpy-2.0.patch
new file mode 100644
index 000000000000..a7d1c50db4ed
--- /dev/null
+++ b/dev-python/pyopengl-accelerate/files/pyopengl-accelerate-3.1.8-numpy-2.0.patch
@@ -0,0 +1,171 @@
+From 20213b913f4a396752c515cafd7ee2ea53ab1fcf Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 17:03:20 +0200
+Subject: [PATCH 1/2] add requirements
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/requirements.txt
++++ b/requirements.txt
+@@ -0,0 +1,4 @@
++numpy>=2.0.0
++pytest>=8.2.2
++setuptools>=70.0.0
++Cython>=3.0.10
+\ No newline at end of file
+--
+2.45.2
+
+
+From bfb5c7005917fc5b4cb71e17b2ed8cc015828f1b Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 21:40:28 +0200
+Subject: [PATCH 1/5] numpy-2.0 define_macros
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/setup.py
++++ b/setup.py
+@@ -45,7 +45,7 @@ def cython_extension(
+ # *cython* itself is using the deprecated api, and the
+ # deprecated APIs are actually providing the attributes
+ # that we use throughout our code...
+- # ('NPY_NO_DEPRECATED_API','NPY_1_7_API_VERSION'),
++ ('NPY_NO_DEPRECATED_API', 'NPY_2_0_API_VERSION'),
+ ],
+ compiler_directives={'language_level': "3"} if have_cython else {},
+ )
+--
+2.45.2
+
+
+From b352289a51b2629917b59ee2b35569651436af70 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 21:42:33 +0200
+Subject: [PATCH 2/5] python-3.11-PyMemoryView_GetContiguous
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/src/buffers_formathandler.pyx
++++ b/src/buffers_formathandler.pyx
+@@ -73,8 +73,8 @@ cdef class MemoryviewHandler(FormatHandler):
+ # TODO: respect no-copy flag!
+ instance = PyMemoryView_GetContiguous(
+ instance,
+- PyBUF_STRIDES|PyBUF_FORMAT|PyBUF_C_CONTIGUOUS,
+ 'C'
++ PyBUF_WRITE,
+ )
+ return instance
+ cdef c_from_param( self, object instance, object typeCode ):
+--
+2.45.2
+
+
+From 86268a423c994f0808bd745ac4b0dfe69c8682ad Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 21:43:32 +0200
+Subject: [PATCH 3/5] enable conversion to C char
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/src/buffers_formathandler.pyx
++++ b/src/buffers_formathandler.pyx
+@@ -73,8 +73,8 @@ cdef class MemoryviewHandler(FormatHandler):
+ # TODO: respect no-copy flag!
+ instance = PyMemoryView_GetContiguous(
+ instance,
+- 'C'
+ PyBUF_WRITE,
++ b'C'
+ )
+ return instance
+ cdef c_from_param( self, object instance, object typeCode ):
+--
+2.45.2
+
+
+From 8d8618cd4d318ace3ecabe823da0dcfdae2fb0e5 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 21:44:53 +0200
+Subject: [PATCH 4/5] set language_level
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/setup.py
++++ b/setup.py
+@@ -47,7 +47,6 @@ def cython_extension(
+ # that we use throughout our code...
+ ('NPY_NO_DEPRECATED_API', 'NPY_2_0_API_VERSION'),
+ ],
+- compiler_directives={'language_level': "3"} if have_cython else {},
+ )
+
+
+@@ -116,6 +115,8 @@ if ( # Prevents running of setup during code introspection imports
+ extraArguments["cmdclass"] = {
+ "build_ext": build_ext,
+ }
++ for e in extensions:
++ e.cython_directives = {'language_level': "3"}
+ setup(
+ options={
+ "sdist": {
+--- a/src/numpy_formathandler.pyx
++++ b/src/numpy_formathandler.pyx
+@@ -1,5 +1,5 @@
+ """Accelerator for numpy format handler operations"""
+-#cython: language_level=3
++# cython: language_level=3
+ from ctypes import c_void_p
+ import numpy as np
+ cimport numpy as np
+--
+2.45.2
+
+
+From 6cd6e7c053e3268086e90df6d1297941cbce93f2 Mon Sep 17 00:00:00 2001
+From: Paul Zander <negril.nx+gentoo@gmail.com>
+Date: Thu, 20 Jun 2024 21:46:46 +0200
+Subject: [PATCH 5/5] drop old cython numpy definitions
+
+Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
+--- a/src/numpy_formathandler.pyx
++++ b/src/numpy_formathandler.pyx
+@@ -3,36 +3,18 @@
+ from ctypes import c_void_p
+ import numpy as np
+ cimport numpy as np
++from numpy cimport *
+ from OpenGL_accelerate.formathandler cimport FormatHandler
+-import traceback, weakref
+ from OpenGL.error import CopyError
+ from OpenGL._bytes import bytes,unicode
+
+-cdef extern from "Python.h":
+- cdef void Py_INCREF( object )
+-
+ cdef extern from "numpy/arrayobject.h":
+ cdef np.ndarray PyArray_FromArray( np.ndarray, np.dtype, int )
+- cdef np.ndarray PyArray_ContiguousFromAny( object op, int, int, int max_depth)
+- cdef int PyArray_Check( object )
+- cdef int PyArray_CheckScalar( object )
+- int NPY_ARRAY_CARRAY
+- int NPY_ARRAY_FORCECAST
+- int PyArray_ISCARRAY( np.ndarray instance )
+- int PyArray_ISCARRAY_RO( np.ndarray instance )
+ cdef np.ndarray PyArray_Zeros(int nd, np.npy_intp* dims, np.dtype, int fortran)
+- cdef np.ndarray PyArray_EnsureArray(object)
+- cdef int PyArray_FillWithScalar(np.ndarray, object)
+- cdef void* PyArray_DATA( np.ndarray )
+- cdef int PyArray_NDIM( np.ndarray )
+- cdef int *PyArray_DIMS( np.ndarray )
+- cdef int PyArray_DIM( np.ndarray, int dim )
+- cdef np.dtype PyArray_DESCR( np.ndarray )
+- cdef np.npy_intp PyArray_SIZE( np.ndarray )
+
+ cdef np.dtype array_descr( np.ndarray array ):
+ """Wrap PyArray_DESCR and incref to deal with the "borrowed" reference"""
+- cdef np.dtype desc = PyArray_DESCR( array )
++ cdef np.dtype desc = array.dtype
+ Py_INCREF(<object> desc)
+ return desc
+
+--
+2.45.2
+
diff --git a/dev-python/pyopengl-accelerate/pyopengl-accelerate-3.1.8-r1.ebuild b/dev-python/pyopengl-accelerate/pyopengl-accelerate-3.1.8-r1.ebuild
new file mode 100644
index 000000000000..a2b0f657fce8
--- /dev/null
+++ b/dev-python/pyopengl-accelerate/pyopengl-accelerate-3.1.8-r1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2024 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_{10..13} )
+
+inherit distutils-r1
+
+DESCRIPTION="Accelerate module for PyOpenGL"
+HOMEPAGE="
+ https://pyopengl.sourceforge.net/
+ https://github.com/mcfletch/pyopengl/
+ https://pypi.org/project/PyOpenGL-accelerate/
+"
+
+if [[ ${PV} = *9999* ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/mcfletch/pyopengl.git"
+ S="${S}/accelerate"
+else
+ MY_P=pyopengl-release-${PV}
+ SRC_URI="
+ https://github.com/mcfletch/pyopengl/archive/release-${PV}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+ "
+ KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+ S=${WORKDIR}/${MY_P}/accelerate
+fi
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="numpy"
+
+DEPEND="
+ numpy? (
+ dev-python/numpy:=[${PYTHON_USEDEP}]
+ )
+"
+RDEPEND="
+ ${DEPEND}
+ dev-python/pyopengl[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ dev-python/cython[${PYTHON_USEDEP}]
+"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+ default
+
+ touch requirements.txt || die
+
+ eapply -p2 "${FILESDIR}/${PN}-3.1.8-gcc-14.patch"
+
+ eapply -p1 "${FILESDIR}/${PN}-3.1.8-numpy-2.0.patch"
+}
+
+src_configure() {
+ rm src/*.c || die
+
+ if ! use numpy; then
+ cat > "${T}"/numpy.py <<-EOF || die
+ raise ImportError("building numpy extension disabled")
+ EOF
+ fi
+}
+
+python_compile() {
+ local -x PYTHONPATH=${T}:${PYTHONPATH}
+ distutils-r1_python_compile
+}
+
+python_test() {
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ cd "${T}" || die
+ epytest "${S}"/tests
+}
diff --git a/dev-python/pyopengl-accelerate/pyopengl-accelerate-9999.ebuild b/dev-python/pyopengl-accelerate/pyopengl-accelerate-9999.ebuild
new file mode 100644
index 000000000000..a2b0f657fce8
--- /dev/null
+++ b/dev-python/pyopengl-accelerate/pyopengl-accelerate-9999.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2024 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_{10..13} )
+
+inherit distutils-r1
+
+DESCRIPTION="Accelerate module for PyOpenGL"
+HOMEPAGE="
+ https://pyopengl.sourceforge.net/
+ https://github.com/mcfletch/pyopengl/
+ https://pypi.org/project/PyOpenGL-accelerate/
+"
+
+if [[ ${PV} = *9999* ]] ; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/mcfletch/pyopengl.git"
+ S="${S}/accelerate"
+else
+ MY_P=pyopengl-release-${PV}
+ SRC_URI="
+ https://github.com/mcfletch/pyopengl/archive/release-${PV}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+ "
+ KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+ S=${WORKDIR}/${MY_P}/accelerate
+fi
+
+LICENSE="BSD"
+SLOT="0"
+IUSE="numpy"
+
+DEPEND="
+ numpy? (
+ dev-python/numpy:=[${PYTHON_USEDEP}]
+ )
+"
+RDEPEND="
+ ${DEPEND}
+ dev-python/pyopengl[${PYTHON_USEDEP}]
+"
+BDEPEND="
+ dev-python/cython[${PYTHON_USEDEP}]
+"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+ default
+
+ touch requirements.txt || die
+
+ eapply -p2 "${FILESDIR}/${PN}-3.1.8-gcc-14.patch"
+
+ eapply -p1 "${FILESDIR}/${PN}-3.1.8-numpy-2.0.patch"
+}
+
+src_configure() {
+ rm src/*.c || die
+
+ if ! use numpy; then
+ cat > "${T}"/numpy.py <<-EOF || die
+ raise ImportError("building numpy extension disabled")
+ EOF
+ fi
+}
+
+python_compile() {
+ local -x PYTHONPATH=${T}:${PYTHONPATH}
+ distutils-r1_python_compile
+}
+
+python_test() {
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ cd "${T}" || die
+ epytest "${S}"/tests
+}