]>
Commit | Line | Data |
---|---|---|
01b42c11 ŁK |
1 | # |
2 | # Conditional build: | |
0bfb977b | 3 | %bcond_without doc # Sphinx documentation |
f90eef3c | 4 | %bcond_with tests # unit tests (test_pty.Test_Pty_Serial_Open tests require ptys) |
01b42c11 ŁK |
5 | %bcond_without python2 # Python 2.x module |
6 | %bcond_without python3 # Python 3.x module | |
d0f6a6f1 | 7 | |
376a9b1c | 8 | %define module serial |
6489d097 | 9 | Summary: Serial port interface module |
612b0b56 | 10 | Summary(pl.UTF-8): Moduł interfejsu do portu szeregowego |
e08ccba4 | 11 | Name: python-serial |
0bfb977b JB |
12 | Version: 3.5 |
13 | Release: 1 | |
7a269694 | 14 | License: BSD |
5dd0867a | 15 | Group: Development/Languages/Python |
7a269694 JB |
16 | #Source0Download: https://github.com/pyserial/pyserial/releases |
17 | Source0: https://github.com/pyserial/pyserial/archive/v%{version}/pyserial-%{version}.tar.gz | |
0bfb977b | 18 | # Source0-md5: ce1cf20f1bbf608027b14d4a97a377fc |
7a269694 | 19 | URL: https://pypi.org/project/pyserial/ |
01b42c11 | 20 | %if %{with python2} |
7a269694 JB |
21 | BuildRequires: python-devel >= 1:2.7 |
22 | BuildRequires: python-modules >= 1:2.7 | |
23 | BuildRequires: python-setuptools | |
01b42c11 ŁK |
24 | %endif |
25 | %if %{with python3} | |
0bfb977b JB |
26 | BuildRequires: python3-devel >= 1:3.4 |
27 | BuildRequires: python3-modules >= 1:3.4 | |
7a269694 | 28 | BuildRequires: python3-setuptools |
01b42c11 | 29 | %endif |
7a269694 JB |
30 | BuildRequires: rpmbuild(macros) >= 1.714 |
31 | BuildRequires: rpm-pythonprov | |
32 | Requires: python-modules >= 1:2.7 | |
e08ccba4 | 33 | BuildArch: noarch |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | This module encapsulates the access for the serial port. It provides | |
38 | backends for Python running on Windows, Linux, BSD (possibly any POSIX | |
39 | compilant system) and Jython. The module named "serial" automatically | |
40 | selects the appropriate backend. | |
41 | ||
f04dc3d2 JR |
42 | %description -l pl.UTF-8 |
43 | Ten moduł opakowuje dostęp do portu szeregowego. Dostarcza backendy | |
44 | dla Pythona działającego na Windows, Linuksie, BSD (być może dowolnym | |
45 | systemie zgodnym z POSIX) oraz Jythona. Moduł o nazwie "serial" | |
46 | automatycznie wybiera właściwy backend. | |
e08ccba4 | 47 | |
7a269694 | 48 | %package -n python3-%{module} |
96dd273c | 49 | Summary: Serial port interface module |
7a269694 | 50 | Summary(pl.UTF-8): Moduł interfejsu do portu szeregowego |
96dd273c | 51 | Group: Libraries/Python |
0bfb977b | 52 | Requires: python3-modules >= 1:3.4 |
96dd273c | 53 | |
54 | %description -n python3-%{module} | |
55 | This module encapsulates the access for the serial port. It provides | |
56 | backends for Python running on Windows, Linux, BSD (possibly any POSIX | |
57 | compilant system) and Jython. The module named "serial" automatically | |
58 | selects the appropriate backend. | |
59 | ||
7a269694 JB |
60 | %description -n python3-%{module} -l pl.UTF-8 |
61 | Ten moduł opakowuje dostęp do portu szeregowego. Dostarcza backendy | |
62 | dla Pythona działającego na Windows, Linuksie, BSD (być może dowolnym | |
63 | systemie zgodnym z POSIX) oraz Jythona. Moduł o nazwie "serial" | |
64 | automatycznie wybiera właściwy backend. | |
65 | ||
0bfb977b JB |
66 | %package apidocs |
67 | Summary: API documentation for Python serial module | |
68 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona serial | |
69 | Group: Documentation | |
70 | ||
71 | %description apidocs | |
72 | API documentation for Python serial module. | |
73 | ||
74 | %description apidocs -l pl.UTF-8 | |
75 | Dokumentacja API modułu Pythona serial. | |
76 | ||
d0f6a6f1 | 77 | %package -n miniterm |
d44bac7c | 78 | Summary: Very simple serial terminal |
7a269694 | 79 | Summary(pl.UTF-8): Bardzo prosty terminal szeregowy |
d44bac7c AM |
80 | Group: Applications/Communications |
81 | Requires: python%{?with_python3:3}-%{module} = %{version}-%{release} | |
82 | ||
83 | %description -n miniterm | |
84 | Very simple serial terminal written in Python. | |
85 | ||
7a269694 JB |
86 | %description -n miniterm -l pl.UTF-8 |
87 | Bardzo prosty terminal szeregowy napisany w Pythonie. | |
88 | ||
e08ccba4 | 89 | %prep |
90 | %setup -q -n pyserial-%{version} | |
91 | ||
92 | %build | |
01b42c11 | 93 | %if %{with python2} |
376a9b1c | 94 | %py_build |
0bfb977b JB |
95 | |
96 | %if %{with tests} | |
97 | %{__python} -m unittest discover -s test | |
98 | %endif | |
01b42c11 | 99 | %endif |
7a269694 | 100 | |
01b42c11 | 101 | %if %{with python3} |
376a9b1c | 102 | %py3_build |
0bfb977b JB |
103 | |
104 | %if %{with tests} | |
105 | %{__python3} -m unittest discover -s test | |
106 | %endif | |
107 | %endif | |
108 | ||
109 | %if %{with doc} | |
110 | %{__make} -C documentation html | |
01b42c11 | 111 | %endif |
e08ccba4 | 112 | |
113 | %install | |
114 | rm -rf $RPM_BUILD_ROOT | |
7a269694 | 115 | |
01b42c11 | 116 | %if %{with python2} |
376a9b1c JR |
117 | %py_install |
118 | ||
7a269694 | 119 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} |
d0f6a6f1 | 120 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} |
7a269694 JB |
121 | %{__sed} -i -e '1s,/usr/bin/env python,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}/*.py |
122 | ||
123 | # remove .NET (IronPython), Jython, Win32 specific code | |
124 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/serial/{serialcli,serialjava,serialwin32,win32}.py* | |
125 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/serial/tools/list_ports_{osx,windows}.py* | |
126 | ||
127 | %py_postclean | |
01b42c11 | 128 | %endif |
376a9b1c | 129 | |
01b42c11 | 130 | %if %{with python3} |
7a269694 | 131 | # prefer python3 version |
0bfb977b JB |
132 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/pyserial-miniterm |
133 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/pyserial-ports | |
a9fb2967 | 134 | |
376a9b1c JR |
135 | %py3_install |
136 | ||
7a269694 | 137 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
d0f6a6f1 | 138 | cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
7a269694 JB |
139 | %{__sed} -i -e '1s,/usr/bin/env python,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/*.py |
140 | ||
141 | # remove .NET (IronPython), Jython, Win32 specific code | |
142 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/serial/{serialcli,serialjava,serialwin32,win32}.py | |
143 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/serial/tools/list_ports_{osx,windows}.py | |
144 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/serial/__pycache__/{serialcli,serialjava,serialwin32,win32}.*.py* | |
145 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/serial/tools/__pycache__/list_ports_{osx,windows}.*.py* | |
01b42c11 | 146 | %endif |
7d5fe39c | 147 | |
e08ccba4 | 148 | %clean |
149 | rm -rf $RPM_BUILD_ROOT | |
150 | ||
01b42c11 | 151 | %if %{with python2} |
e08ccba4 | 152 | %files |
153 | %defattr(644,root,root,755) | |
bc7640bc | 154 | %doc CHANGES.rst LICENSE.txt README.rst |
7a269694 JB |
155 | %{py_sitescriptdir}/serial |
156 | %{py_sitescriptdir}/pyserial-%{version}-py*.egg-info | |
d0f6a6f1 | 157 | %{_examplesdir}/python-%{module}-%{version} |
01b42c11 | 158 | %endif |
96dd273c | 159 | |
01b42c11 | 160 | %if %{with python3} |
96dd273c | 161 | %files -n python3-%{module} |
162 | %defattr(644,root,root,755) | |
bc7640bc | 163 | %doc CHANGES.rst LICENSE.txt README.rst |
7a269694 JB |
164 | %{py3_sitescriptdir}/serial |
165 | %{py3_sitescriptdir}/pyserial-%{version}-py*.egg-info | |
d0f6a6f1 | 166 | %{_examplesdir}/python3-%{module}-%{version} |
01b42c11 | 167 | %endif |
d44bac7c | 168 | |
0bfb977b JB |
169 | %if %{with doc} |
170 | %files apidocs | |
171 | %defattr(644,root,root,755) | |
172 | %doc documentation/_build/html/{_static,*.html,*.js} | |
173 | %endif | |
174 | ||
d44bac7c AM |
175 | %files -n miniterm |
176 | %defattr(644,root,root,755) | |
0bfb977b JB |
177 | %attr(755,root,root) %{_bindir}/pyserial-miniterm |
178 | %attr(755,root,root) %{_bindir}/pyserial-ports |