3 %bcond_without doc # don't build doc
4 %bcond_with tests # run tests
5 %bcond_without python2 # CPython 2.x module
6 %bcond_without python3 # CPython 3.x module
9 %define pypi_name python-rtmidi
10 Summary: A Python wrapper for the RtMidi C++ library
11 Name: python-%{module}
15 Group: Libraries/Python
16 Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.zip
17 # Source0-md5: dac7edb268a8dcd454fbeeb19ac6fb07
18 URL: http://trac.chrisarndt.de/code/wiki/python-rtmidi
19 BuildRequires: rpm-pythonprov
20 BuildRequires: rpmbuild(macros) >= 1.714
22 BuildRequires: python-devel
23 BuildRequires: python-setuptools
26 BuildRequires: python3-devel
27 BuildRequires: python3-setuptools
30 BuildRequires: sphinx-pdg
32 BuildRequires: rtmidi-devel
33 Requires: python-modules
34 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37 python-rtmidi is a Python binding for RtMidi implemented with Cython
38 and provides a thin wrapper around the RtMidi C++ interface. The API
39 is basically the same as the C++ one but with the naming scheme of
40 classes, methods and parameters adapted to the Python PEP-8
41 conventions and requirements of the Python package naming structure.
43 %package -n python3-%{module}
44 Summary: A Python wrapper for the RtMidi C++ library
45 Group: Libraries/Python
46 Requires: python3-modules
48 %description -n python3-%{module}
49 python-rtmidi is a Python binding for RtMidi implemented with Cython
50 and provides a thin wrapper around the RtMidi C++ interface. The API
51 is basically the same as the C++ one but with the naming scheme of
52 classes, methods and parameters adapted to the Python PEP-8
53 conventions and requirements of the Python package naming structure.
56 Summary: %{module} API documentation
57 Summary(pl.UTF-8): Dokumentacja API %{module}
61 API documentation for %{module}.
63 %description apidocs -l pl.UTF-8
64 Dokumentacja API %{module}.
71 %py_build %{?with_tests:test}
75 %py3_build %{?with_tests:test}
81 rm -rf _build/html/_sources
85 rm -rf $RPM_BUILD_ROOT
96 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
97 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
98 find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \
99 | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
102 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
103 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
104 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
105 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
109 rm -rf $RPM_BUILD_ROOT
113 %defattr(644,root,root,755)
114 %doc AUTHORS.rst CHANGELOG.rst README.rst
115 %dir %{py_sitedir}/%{module}
116 %{py_sitedir}/%{module}/*.py[co]
117 %attr(755,root,root) %{py_sitedir}/%{module}/*.so
118 %{py_sitedir}/python_rtmidi-%{version}-py*.egg-info
119 %{_examplesdir}/%{name}-%{version}
123 %files -n python3-%{module}
124 %defattr(644,root,root,755)
125 %doc AUTHORS.rst CHANGELOG.rst README.rst
126 %dir %{py3_sitedir}/%{module}
127 %{py3_sitedir}/%{module}/*.py
128 %attr(755,root,root) %{py3_sitedir}/%{module}/*.so
129 %{py3_sitedir}/%{module}/__pycache__
130 %{py3_sitedir}/python_rtmidi-%{version}-py*.egg-info
131 %{_examplesdir}/python3-%{module}-%{version}
136 %defattr(644,root,root,755)
137 %doc docs/_build/html/*