dev-python/python-rtmidi: add 1.5.1

With thanks to ztrawhcse in #gentoo-dev for useful comments regarding
switching this to meson-python.

Closes: https://bugs.gentoo.org/908426
Signed-off-by: Marek Szuba <marecki@gentoo.org>
This commit is contained in:
Marek Szuba
2023-06-13 16:00:07 +01:00
parent 8cec346f7e
commit bdfd73ac58
4 changed files with 142 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST python-rtmidi-1.4.9.tar.gz 251238 BLAKE2B dda4052e893839f88a6756306f8ff4e89ee66ad9716d374efbb7b92a8e9074e98c8d5df0cc82aa3c6e0c77a78fe9b997079623a5147c03eeea9128dfb7605215 SHA512 91c5a0f807549fbe9d87df6e40b8c3db0f9be753616ba51804900195d02120cd972e39c69dd99e60e4ea1b1d9831d0b956b64ce71b2fe03422efc57bccf5cb70
DIST python-rtmidi-1.5.1.tar.gz 331487 BLAKE2B fafa56132c54c20a702bcdc7dbe87b9eb3384ecf1e53ee76926866ba6f6fb601f55f4525f6b12f477f8659e4da8138940c5037ac0a4f31f472261089f0d25b03 SHA512 656690f397983834a719be6b58db66db066469b356ef00ff8d62666af9b5e3ef572e541cf38e082b2122a31d8895fd52c0392ed6bdec387baf3f5827de411254

View File

@@ -0,0 +1,33 @@
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,14 +1,14 @@
[build-system]
-# https://thiblahute.gitlab.io/mesonpep517/
-build-backend = "mesonpep517.buildapi"
+build-backend = "mesonpy"
requires = [
"cython",
"wheel",
- "mesonpep517 @ git+https://gitlab.com/SpotlightKid/mesonpep517.git@rtmidi",
+ "meson-python",
"ninja"
]
[project]
+name = "python-rtmidi"
description = "A Python binding for the RtMidi C++ library implemented using Cython."
authors = [
{ name="Christopher Arndt", email="info@chrisarndt.de" },
@@ -41,12 +41,6 @@
"music",
"rtmidi",
]
-meson-python-option-name = "python"
-meson-options = [
- "-Dwheel=true",
- "-Dverbose=true",
- "--buildtype=plain"
-]
[project.license]
file = "LICENSE.md"

View File

@@ -0,0 +1,55 @@
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,8 @@
cpp = meson.get_compiler('cpp')
+rtmidi_dep = dependency('rtmidi')
+
# Jack API (portable)
jack2_dep = dependency('jack', version: '>=1.9.11', required: false)
jack1_dep = dependency('jack', version: ['>=0.125.0', '<1.0'], required: false)
--- a/rtmidi/meson.build
+++ b/rtmidi/meson.build
@@ -1,7 +1,7 @@
# https://mesonbuild.com/Python-module.html
defines = []
-dependencies = [python.dependency()]
+dependencies = [python.dependency(), rtmidi_dep]
link_args = []
if host_machine.system() == 'darwin' and coremidi_dep.found() and get_option('coremidi')
@@ -47,11 +47,10 @@
# Build and install the extension module
module = python.extension_module(
'_rtmidi',
- [rtmidi_cython, rtmidi_sources],
+ [rtmidi_cython],
dependencies: dependencies,
cpp_args: defines,
link_args: link_args,
- include_directories: rtmidi_inc,
install: true,
subdir: 'rtmidi',
)
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,9 +1,5 @@
fs = import('fs')
-rtmidi_sources = files([
- 'rtmidi/RtMidi.cpp',
-])
-rtmidi_inc = include_directories('.', 'rtmidi')
rtmidi_mod_pyx = '_rtmidi.pyx'
rtmidi_mod_cpp = '_rtmidi.cpp'
@@ -16,7 +12,6 @@
'rtmidi_cython',
output: rtmidi_mod_cpp,
input: rtmidi_mod_pyx,
- depend_files: [rtmidi_sources],
command: [cython, '-3', '--cplus', '-o', '@OUTPUT@', '@INPUT@'],
)
else

View File

@@ -0,0 +1,53 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{9..11} )
DISTUTILS_USE_PEP517=meson-python
PYPI_NO_NORMALIZE=1
inherit distutils-r1 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-2.99[${PYTHON_USEDEP}]
virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${PN}-1.5.1-build_backend.patch
"${FILESDIR}"/${PN}-1.5.1-unbundle_rtmidi.patch
)
distutils_enable_sphinx docs
distutils_enable_tests unittest
src_prepare() {
distutils-r1_src_prepare
# Just in case
rm -r src/rtmidi || die
rm src/_rtmidi.cpp || die
}
python_test() {
cd "${T}" || die
eunittest "${S}"/tests
}