]> git.pld-linux.org Git - packages/python-gsmmodem-new.git/blame - python-gsmmodem-new.spec
- make sure python3 scripts are always installed, rel 6
[packages/python-gsmmodem-new.git] / python-gsmmodem-new.spec
CommitLineData
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
10Summary: GSM modem module for Python
11Name: python-%{pypi_name}
12Version: 0.12
59f527d3 13Release: 6
103d79ce
AM
14License: LGPL v3+
15Group: Libraries/Python
16Source0: https://github.com/babca/python-gsmmodem/archive/%{version}.tar.gz
17# Source0-md5: 797db0e6c9068daa4d3c88d8425a3ccd
18URL: https://github.com/babca/python-gsmmodem
19BuildRequires: rpm-pythonprov
20BuildRequires: rpmbuild(macros) >= 1.714
21%if %{with python2}
22BuildRequires: python-modules
23%{?with_tests:BuildRequires: python-serial}
24BuildRequires: python-setuptools
25%endif
26%if %{with python3}
27BuildRequires: python3-modules
28%{?with_tests:BuildRequires: python3-serial}
29BuildRequires: python3-setuptools
30%endif
31Requires: python-modules
32Requires: python-serial
33BuildArch: noarch
34BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36%description
37Allows easy control of a GSM modem attached to the system. It also
38includes a couple of useful commandline utilities for interacting with
39a GSM modem.
40
41%package -n python3-%{pypi_name}
42Summary: GSM modem module for Python
43Group: Libraries/Python
44Requires: python3-modules
45Requires: python3-serial
46
47%description -n python3-%{pypi_name}
48Allows easy control of a GSM modem attached to the system. It also
49includes a couple of useful commandline utilities for interacting with
50a GSM modem.
51
52%package apidocs
53Summary: API documentation for Python %{module} module
54Summary(pl.UTF-8): Dokumentacja API modułu Pythona %{module}
55Group: Documentation
56
57%description apidocs
58API documentation for Python %{module} module.
59
60%description apidocs -l pl.UTF-8
61Dokumentacja 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}
76cd docs
77%{__make} -j1 html
78rm -rf _build/html/_sources
79%endif
80
81%install
82rm -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}
101install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
102cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
103find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \
104 | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
105%endif
106%if %{with python3}
107install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
108cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
109find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \
110 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
111%endif
112
113%clean
114rm -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
This page took 0.172427 seconds and 4 git commands to generate.