]>
Commit | Line | Data |
---|---|---|
103d79ce AM |
1 | # Conditional build: |
2 | %bcond_without doc # Sphinx documentation | |
3 | %bcond_without tests # unit tests | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module gsmmodem | |
8 | %define egg_name python_gsmmodem_new | |
9 | %define pypi_name gsmmodem-new | |
10 | Summary: GSM modem module for Python | |
11 | Name: python-%{pypi_name} | |
12 | Version: 0.12 | |
59f527d3 | 13 | Release: 6 |
103d79ce AM |
14 | License: LGPL v3+ |
15 | Group: Libraries/Python | |
16 | Source0: https://github.com/babca/python-gsmmodem/archive/%{version}.tar.gz | |
17 | # Source0-md5: 797db0e6c9068daa4d3c88d8425a3ccd | |
18 | URL: https://github.com/babca/python-gsmmodem | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-modules | |
23 | %{?with_tests:BuildRequires: python-serial} | |
24 | BuildRequires: python-setuptools | |
25 | %endif | |
26 | %if %{with python3} | |
27 | BuildRequires: python3-modules | |
28 | %{?with_tests:BuildRequires: python3-serial} | |
29 | BuildRequires: python3-setuptools | |
30 | %endif | |
31 | Requires: python-modules | |
32 | Requires: python-serial | |
33 | BuildArch: noarch | |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | Allows easy control of a GSM modem attached to the system. It also | |
38 | includes a couple of useful commandline utilities for interacting with | |
39 | a GSM modem. | |
40 | ||
41 | %package -n python3-%{pypi_name} | |
42 | Summary: GSM modem module for Python | |
43 | Group: Libraries/Python | |
44 | Requires: python3-modules | |
45 | Requires: python3-serial | |
46 | ||
47 | %description -n python3-%{pypi_name} | |
48 | Allows easy control of a GSM modem attached to the system. It also | |
49 | includes a couple of useful commandline utilities for interacting with | |
50 | a GSM modem. | |
51 | ||
52 | %package apidocs | |
53 | Summary: API documentation for Python %{module} module | |
54 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module} | |
55 | Group: Documentation | |
56 | ||
57 | %description apidocs | |
58 | API documentation for Python %{module} module. | |
59 | ||
60 | %description apidocs -l pl.UTF-8 | |
61 | Dokumentacja API modułu Pythona %{module}. | |
62 | ||
63 | %prep | |
64 | %setup -q -n python-gsmmodem-%{version} | |
65 | ||
66 | %build | |
67 | %if %{with python2} | |
68 | %py_build %{?with_tests:test} | |
69 | %endif | |
70 | ||
71 | %if %{with python3} | |
72 | %py3_build %{?with_tests:test} | |
73 | %endif | |
74 | ||
75 | %if %{with doc} | |
76 | cd docs | |
77 | %{__make} -j1 html | |
78 | rm -rf _build/html/_sources | |
79 | %endif | |
80 | ||
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
83 | ||
84 | %if %{with python2} | |
85 | %py_install | |
86 | ||
87 | %py_ocomp $RPM_BUILD_ROOT%{py_sitedir} | |
88 | %py_comp $RPM_BUILD_ROOT%{py_sitedir} | |
89 | ||
90 | %py_postclean | |
91 | %endif | |
92 | ||
93 | %if %{with python3} | |
59f527d3 JR |
94 | # Remove python2 artefacts |
95 | %{__rm} -f $RPM_BUILD_ROOT%{_bindir}/* | |
103d79ce AM |
96 | %py3_install |
97 | %endif | |
98 | ||
99 | # in case there are examples provided | |
100 | %if %{with python2} | |
101 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} | |
102 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} | |
103 | find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \ | |
104 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
105 | %endif | |
106 | %if %{with python3} | |
107 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} | |
108 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} | |
109 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \ | |
110 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
111 | %endif | |
112 | ||
113 | %clean | |
114 | rm -rf $RPM_BUILD_ROOT | |
115 | ||
116 | %if %{with python2} | |
117 | %files | |
118 | %defattr(644,root,root,755) | |
119 | %doc AUTHORS ChangeLog README.rst | |
120 | %{py_sitescriptdir}/%{module} | |
121 | %{py_sitescriptdir}/gsmtermlib | |
122 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
123 | %{_examplesdir}/python-%{pypi_name}-%{version} | |
124 | %endif | |
125 | ||
126 | %if %{with python3} | |
127 | %files -n python3-%{pypi_name} | |
128 | %defattr(644,root,root,755) | |
129 | %attr(755,root,root) %{_bindir}/gsmterm.py | |
130 | %attr(755,root,root) %{_bindir}/identify-modem.py | |
131 | %attr(755,root,root) %{_bindir}/sendsms.py | |
132 | %doc AUTHORS ChangeLog README.rst | |
133 | %{py3_sitescriptdir}/%{module} | |
134 | %{py3_sitescriptdir}/gsmtermlib | |
135 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
136 | %{_examplesdir}/python3-%{pypi_name}-%{version} | |
137 | %endif | |
138 | ||
139 | %if %{with doc} | |
140 | %files apidocs | |
141 | %defattr(644,root,root,755) | |
142 | %doc docs/_build/html/* | |
143 | %endif |