summaryrefslogtreecommitdiff
blob: a1779b717ea1a168a1807bc052f53ae414e7ff07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )
DOCS_BUILDER="sphinx"
DOCS_DEPEND="dev-python/myst-parser"
DOCS_DIR="docs"
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=meson-python

inherit distutils-r1 docs pypi

DESCRIPTION="Python bindings for media-libs/rtmidi implemented using Cython"
HOMEPAGE="
	https://pypi.org/project/python-rtmidi/
	https://spotlightkid.github.io/python-rtmidi/
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+alsa jack"

# Most of these tests do not play nicely with the sandbox, some only
# work with exactly the same version of rtmidi as the bundled one, and
# several fail even with disabled sandbox unless there are actual MIDI
# I/O devices present.
RESTRICT="test"

DEPEND="media-libs/rtmidi[alsa?,jack?]"
RDEPEND="${DEPEND}"
BDEPEND="dev-python/cython[${PYTHON_USEDEP}]
	virtual/pkgconfig"

PATCHES=(
	"${FILESDIR}"/${PN}-1.5.1-unbundle_rtmidi.patch
)

distutils_enable_tests unittest

src_prepare() {
	distutils-r1_src_prepare

	# Just in case
	rm -r src/rtmidi || die
	rm src/_rtmidi.cpp || die

	# Needed by USE=doc because documentation generation happens in ${S}
	# but the version.py generated by Meson end up in respective ${BUILD_DIR}s.
	# The version put in ${S} should be ignored by everything except Sphinx but
	# just in case, be consistent and generate it unconditionally.
	sed -e "s|@VERSION@|${PV}|" < rtmidi/version.py.in > rtmidi/version.py || die
}

python_test() {
	cd "${T}" || die
	eunittest "${S}"/tests
}