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