Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/python-rtmidi/files/, dev-python/python-rtmidi/
Date: Thu, 29 Sep 2022 00:39:12
Message-Id: 1664411942.6117d33a3ef05727723316ced984a4f74e133478.marecki@gentoo
1 commit: 6117d33a3ef05727723316ced984a4f74e133478
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 29 00:35:53 2022 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 29 00:39:02 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6117d33a
7
8 dev-python/python-rtmidi: new package, add 1.4.9
9
10 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
11
12 dev-python/python-rtmidi/Manifest | 1 +
13 .../python-rtmidi-1.4.9-unbundle_rtmidi.patch | 60 ++++++++++++++++++++++
14 dev-python/python-rtmidi/metadata.xml | 12 +++++
15 .../python-rtmidi/python-rtmidi-1.4.9.ebuild | 52 +++++++++++++++++++
16 4 files changed, 125 insertions(+)
17
18 diff --git a/dev-python/python-rtmidi/Manifest b/dev-python/python-rtmidi/Manifest
19 new file mode 100644
20 index 000000000000..0cb23d6df4d8
21 --- /dev/null
22 +++ b/dev-python/python-rtmidi/Manifest
23 @@ -0,0 +1 @@
24 +DIST python-rtmidi-1.4.9.tar.gz 251238 BLAKE2B dda4052e893839f88a6756306f8ff4e89ee66ad9716d374efbb7b92a8e9074e98c8d5df0cc82aa3c6e0c77a78fe9b997079623a5147c03eeea9128dfb7605215 SHA512 91c5a0f807549fbe9d87df6e40b8c3db0f9be753616ba51804900195d02120cd972e39c69dd99e60e4ea1b1d9831d0b956b64ce71b2fe03422efc57bccf5cb70
25
26 diff --git a/dev-python/python-rtmidi/files/python-rtmidi-1.4.9-unbundle_rtmidi.patch b/dev-python/python-rtmidi/files/python-rtmidi-1.4.9-unbundle_rtmidi.patch
27 new file mode 100644
28 index 000000000000..ecd9f53b108c
29 --- /dev/null
30 +++ b/dev-python/python-rtmidi/files/python-rtmidi-1.4.9-unbundle_rtmidi.patch
31 @@ -0,0 +1,60 @@
32 +--- a/setup.py
33 ++++ b/setup.py
34 +@@ -102,7 +102,7 @@
35 +
36 + # Set up options for compiling the _rtmidi Extension
37 + if cythonize:
38 +- sources = [join(SRC_DIR, "_rtmidi.pyx"), join(SRC_DIR, "rtmidi", "RtMidi.cpp")]
39 ++ sources = [join(SRC_DIR, "_rtmidi.pyx")]
40 + elif exists(join(SRC_DIR, "_rtmidi.cpp")):
41 + cythonize = lambda x: x # noqa
42 + sources = [join(SRC_DIR, "_rtmidi.cpp"), join(SRC_DIR, "rtmidi", "RtMidi.cpp")]
43 +@@ -145,18 +145,18 @@
44 +
45 +
46 + if sys.platform.startswith('linux'):
47 +- if alsa and find_library('asound'):
48 +- define_macros.append(("__LINUX_ALSA__", None))
49 +- libraries.append('asound')
50 +-
51 +- if jack:
52 +- check_for_jack(define_macros, libraries)
53 +-
54 + if not find_library('pthread'):
55 + sys.exit("The 'pthread' library is required to build python-rtmidi on"
56 + "Linux. Please install the libc6 development package.")
57 ++ if not find_library('rtmidi'):
58 ++ sys.exit("Failed to find librtmidi")
59 +
60 + libraries.append("pthread")
61 ++
62 ++ res = subprocess.check_output(['pkg-config', '--variable', 'includedir', 'rtmidi'])
63 ++ rtmidi_include_dir = res.decode().strip()
64 ++ include_dirs.append(rtmidi_include_dir)
65 ++ libraries.append('rtmidi')
66 + elif sys.platform.startswith('darwin'):
67 + if jack:
68 + check_for_jack(define_macros, libraries)
69 +@@ -197,7 +197,7 @@
70 + # Finally, set up our distribution
71 + setup(
72 + packages=['rtmidi'],
73 +- ext_modules=cythonize(extensions),
74 ++ ext_modules=cythonize(extensions, include_path=[ rtmidi_include_dir ]),
75 + tests_require=[], # Test dependencies are handled by tox
76 + # On systems without a RTC (e.g. Raspberry Pi), system time will be the
77 + # Unix epoch when booted without network connection, which makes zip fail,
78 +--- a/tests/test_rtmidi.py
79 ++++ b/tests/test_rtmidi.py
80 +@@ -54,11 +54,6 @@
81 + else:
82 + self.assertEqual(res, rtmidi.API_UNSPECIFIED)
83 +
84 +- def test_get_rtmidi_version(self):
85 +- version = rtmidi.get_rtmidi_version()
86 +- self.assertTrue(isinstance(version, string_types))
87 +- self.assertEqual(version, '4.0.0')
88 +-
89 +
90 + class BaseTests:
91 + NOTE_ON = [0x90, 48, 100]
92
93 diff --git a/dev-python/python-rtmidi/metadata.xml b/dev-python/python-rtmidi/metadata.xml
94 new file mode 100644
95 index 000000000000..93ee6355d770
96 --- /dev/null
97 +++ b/dev-python/python-rtmidi/metadata.xml
98 @@ -0,0 +1,12 @@
99 +<?xml version="1.0" encoding="UTF-8"?>
100 +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
101 +<pkgmetadata>
102 + <maintainer type="person">
103 + <email>marecki@g.o</email>
104 + <name>Marek Szuba</name>
105 + </maintainer>
106 + <upstream>
107 + <remote-id type="pypi">python-rtmidi</remote-id>
108 + <remote-id type="github">SpotlightKid/python-rtmidi</remote-id>
109 + </upstream>
110 +</pkgmetadata>
111
112 diff --git a/dev-python/python-rtmidi/python-rtmidi-1.4.9.ebuild b/dev-python/python-rtmidi/python-rtmidi-1.4.9.ebuild
113 new file mode 100644
114 index 000000000000..0c8c966de3fc
115 --- /dev/null
116 +++ b/dev-python/python-rtmidi/python-rtmidi-1.4.9.ebuild
117 @@ -0,0 +1,52 @@
118 +# Copyright 1999-2022 Gentoo Authors
119 +# Distributed under the terms of the GNU General Public License v2
120 +
121 +EAPI=8
122 +
123 +PYTHON_COMPAT=( python3_{8..11} )
124 +DISTUTILS_USE_PEP517=setuptools
125 +
126 +inherit distutils-r1
127 +
128 +DESCRIPTION="Python bindings for media-libs/rtmidi implemented using Cython"
129 +HOMEPAGE="
130 + https://pypi.org/project/python-rtmidi/
131 + https://spotlightkid.github.io/python-rtmidi/
132 +"
133 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
134 +
135 +LICENSE="MIT"
136 +SLOT="0"
137 +KEYWORDS="~amd64"
138 +IUSE="+alsa jack"
139 +
140 +# Most of these tests do not play nicely with the sandbox, some only
141 +# work with exactly the same version of rtmidi as the bundled one, and
142 +# several fail even with disabled sandbox unless there are actual MIDI
143 +# I/O devices present.
144 +RESTRICT="test"
145 +
146 +DEPEND="media-libs/rtmidi[alsa?,jack?]"
147 +RDEPEND="${DEPEND}"
148 +BDEPEND="dev-python/cython[${PYTHON_USEDEP}]
149 + virtual/pkgconfig"
150 +
151 +PATCHES=(
152 + "${FILESDIR}"/${PN}-1.4.9-unbundle_rtmidi.patch
153 +)
154 +
155 +distutils_enable_sphinx docs
156 +distutils_enable_tests unittest
157 +
158 +src_prepare() {
159 + distutils-r1_src_prepare
160 +
161 + # Just in case
162 + rm -r src/rtmidi || die
163 + rm src/_rtmidi.cpp || die
164 +}
165 +
166 +python_test() {
167 + cd "${T}" || die
168 + eunittest "${S}"/tests
169 +}