summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-06-02 22:48:37 +0100
committerSam James <sam@gentoo.org>2024-06-02 22:49:31 +0100
commitf29a2197112517666901f840a9cb59510b878f54 (patch)
tree583861ac33e5cad8b011ba1b8ed7114061369609 /dev-python/pyalsa
parentdev-vcs/python-gitlab: add 4.6.0 (diff)
downloadgentoo-f29a2197112517666901f840a9cb59510b878f54.tar.gz
gentoo-f29a2197112517666901f840a9cb59510b878f54.tar.bz2
gentoo-f29a2197112517666901f840a9cb59510b878f54.zip
dev-python/pyalsa: enable py3.12
Closes: https://bugs.gentoo.org/929483 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/pyalsa')
-rw-r--r--dev-python/pyalsa/files/pyalsa-1.2.7-python3.12.patch34
-rw-r--r--dev-python/pyalsa/pyalsa-1.2.7-r2.ebuild55
2 files changed, 89 insertions, 0 deletions
diff --git a/dev-python/pyalsa/files/pyalsa-1.2.7-python3.12.patch b/dev-python/pyalsa/files/pyalsa-1.2.7-python3.12.patch
new file mode 100644
index 000000000000..f27a7714a986
--- /dev/null
+++ b/dev-python/pyalsa/files/pyalsa-1.2.7-python3.12.patch
@@ -0,0 +1,34 @@
+https://github.com/alsa-project/alsa-python/issues/9
+https://github.com/alsa-project/alsa-python/pull/10
+https://github.com/alsa-project/alsa-python/commit/cb75f5cdba0a29bdfa43eb56285da4917d2941a9
+
+From cb75f5cdba0a29bdfa43eb56285da4917d2941a9 Mon Sep 17 00:00:00 2001
+From: Francesco Ceruti <ceppofrancy@gmail.com>
+Date: Sat, 4 May 2024 22:16:16 +0200
+Subject: [PATCH] alsaseq: fix seg. fault when accessing `ConstantObject` extra
+
+Closes: https://github.com/alsa-project/alsa-python/pull/10
+Signed-off-by: Francesco Ceruti <ceppofrancy@gmail.com>
+Signed-off-by: Jaroslav Kysela <perex@perex.cz>
+--- a/pyalsa/alsaseq.c
++++ b/pyalsa/alsaseq.c
+@@ -353,18 +353,11 @@ typedef struct {
+ } ConstantObject;
+
+ #if PY_MAJOR_VERSION < 3
+-/* PyInt is fixed size in Python 2 */
+ # define CONST_VALUE(x) PyInt_AsLong((PyObject *)x)
+-# define CONST_EXTRA(x) (&(x->extra))
+ #else
+-/* PyLong is variable size in Python 3 */
+ # define CONST_VALUE(x) PyLong_AsLong((PyObject *)x)
+-# define CONST_EXTRA(x) \
+- ((ConstantExtraFields *)( \
+- ((intptr_t)(&x->extra)) \
+- + abs(Py_SIZE(&x->base)) * Py_TYPE(x)->tp_itemsize \
+- ))
+ #endif
++# define CONST_EXTRA(x) (&(x->extra))
+
+ /** alsaseq.Constant type (initialized later...) */
+ static PyTypeObject ConstantType;
diff --git a/dev-python/pyalsa/pyalsa-1.2.7-r2.ebuild b/dev-python/pyalsa/pyalsa-1.2.7-r2.ebuild
new file mode 100644
index 000000000000..2632cb21b9c9
--- /dev/null
+++ b/dev-python/pyalsa/pyalsa-1.2.7-r2.ebuild
@@ -0,0 +1,55 @@
+# 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..12} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python bindings for ALSA library"
+HOMEPAGE="https://alsa-project.org/wiki/Main_Page"
+SRC_URI="https://www.alsa-project.org/files/pub/pyalsa/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+# Needs access to system's alsa configuration/devices
+RESTRICT="test"
+
+DEPEND="
+ media-libs/alsa-lib
+"
+RDEPEND="
+ ${DEPEND}
+"
+BDEPEND="
+ dev-python/setuptools[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.1.6-no-build-symlinks.patch"
+ "${FILESDIR}/${PN}-1.2.7-python3.12.patch"
+)
+
+python_test() {
+ cd "${T}" || die
+
+ shopt -s nullglob
+ local test
+ local failed
+ for test in "${S}"/test/*.py ; do
+ ${EPYTHON} "${test}" || {
+ eerror "${test} failed with ${EPYTHON}"
+ failed=1
+ break
+ }
+ done
+ shopt -u nullglob
+
+ if [[ ${failed} -eq 1 ]] ; then
+ die "${test} failed with ${EPYTHON}"
+ fi
+}