]>
Commit | Line | Data |
---|---|---|
4d102708 JK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # don't build doc | |
86269b32 | 4 | %bcond_with tests # run tests |
4d102708 JK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module rtmidi | |
9 | %define pypi_name python-rtmidi | |
10 | Summary: A Python wrapper for the RtMidi C++ library | |
11 | Name: python-%{module} | |
12 | Version: 1.1.0 | |
13 | Release: 1 | |
14 | License: MIT | |
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 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-devel | |
23 | BuildRequires: python-setuptools | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-devel | |
27 | BuildRequires: python3-setuptools | |
28 | %endif | |
29 | %if %{with doc} | |
30 | BuildRequires: sphinx-pdg | |
31 | %endif | |
32 | BuildRequires: rtmidi-devel | |
33 | Requires: python-modules | |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
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. | |
42 | ||
43 | %package -n python3-%{module} | |
44 | Summary: A Python wrapper for the RtMidi C++ library | |
45 | Group: Libraries/Python | |
46 | Requires: python3-modules | |
47 | ||
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. | |
54 | ||
55 | %package apidocs | |
56 | Summary: %{module} API documentation | |
57 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
58 | Group: Documentation | |
59 | ||
60 | %description apidocs | |
61 | API documentation for %{module}. | |
62 | ||
63 | %description apidocs -l pl.UTF-8 | |
64 | Dokumentacja API %{module}. | |
65 | ||
66 | %prep | |
67 | %setup -q | |
68 | ||
69 | %build | |
70 | %if %{with python2} | |
71 | %py_build %{?with_tests:test} | |
72 | %endif | |
73 | ||
74 | %if %{with python3} | |
75 | %py3_build %{?with_tests:test} | |
76 | %endif | |
77 | ||
78 | %if %{with doc} | |
79 | cd docs | |
80 | %{__make} -j1 html | |
81 | rm -rf _build/html/_sources | |
82 | %endif | |
83 | ||
84 | %install | |
85 | rm -rf $RPM_BUILD_ROOT | |
86 | %if %{with python2} | |
87 | %py_install | |
88 | %py_postclean | |
89 | %endif | |
90 | ||
91 | %if %{with python3} | |
92 | %py3_install | |
93 | %endif | |
94 | ||
95 | %if %{with python2} | |
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}|' | |
100 | %endif | |
101 | %if %{with python3} | |
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}|' | |
106 | %endif | |
107 | ||
108 | %clean | |
109 | rm -rf $RPM_BUILD_ROOT | |
110 | ||
111 | %if %{with python2} | |
112 | %files | |
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} | |
120 | %endif | |
121 | ||
122 | %if %{with python3} | |
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} | |
132 | %endif | |
133 | ||
134 | %if %{with doc} | |
135 | %files apidocs | |
136 | %defattr(644,root,root,755) | |
137 | %doc docs/_build/html/* | |
138 | %endif |