]> git.pld-linux.org Git - packages/python-gsmmodem-new.git/blob - python-gsmmodem-new.spec
c9e0477f733c454986e93d9b633c29beecc0bf7d
[packages/python-gsmmodem-new.git] / python-gsmmodem-new.spec
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
13 Release:        3
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}
94 %py3_install
95 %endif
96
97 # in case there are examples provided
98 %if %{with python2}
99 install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
100 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version}
101 find $RPM_BUILD_ROOT%{_examplesdir}/python-%{pypi_name}-%{version} -name '*.py' \
102         | xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
103 %endif
104 %if %{with python3}
105 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
106 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version}
107 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{pypi_name}-%{version} -name '*.py' \
108         | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
109 %endif
110
111 %clean
112 rm -rf $RPM_BUILD_ROOT
113
114 %if %{with python2}
115 %files
116 %defattr(644,root,root,755)
117 %doc AUTHORS ChangeLog README.rst
118 %{py_sitescriptdir}/%{module}
119 %{py_sitescriptdir}/gsmtermlib
120 %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
121 %{_examplesdir}/python-%{pypi_name}-%{version}
122 %endif
123
124 %if %{with python3}
125 %files -n python3-%{pypi_name}
126 %defattr(644,root,root,755)
127 %attr(755,root,root) %{_bindir}/gsmterm.py
128 %attr(755,root,root) %{_bindir}/identify-modem.py
129 %attr(755,root,root) %{_bindir}/sendsms.py
130 %doc AUTHORS ChangeLog README.rst
131 %{py3_sitescriptdir}/%{module}
132 %{py3_sitescriptdir}/gsmtermlib
133 %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
134 %{_examplesdir}/python3-%{pypi_name}-%{version}
135 %endif
136
137 %if %{with doc}
138 %files apidocs
139 %defattr(644,root,root,755)
140 %doc docs/_build/html/*
141 %endif
This page took 0.050168 seconds and 2 git commands to generate.