%{!?dotests: %define dotests 1} %define name python3-pyserial %define srcname pyserial %define version 3.4 %define release 1 %define is_python %(test -e /usr/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /usr/bin/python3 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3_64 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif Summary: Python serial port access library Name: %{name} Version: %{version} Release: %{release} Source0: %{srcname}-%{version}.tar.gz Url: https://pypi.python.org/pypi/pyserial License: Python Group: Development/Libraries BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot Prefix: %{_prefix} BuildRequires: python3 >= 3.7.4-1 BuildRequires: python3-devel >= 3.7.4-1 Requires: python3 >= 3.7.4-1 %description This module encapsulates the access for the serial port. It provides backends for standard Python running on Windows, Linux, BSD (possibly any POSIX compilant system) and Jython. The module named "serial" automaticaly selects the appropriate backend. %prep %setup -q -n %{srcname}-%{version} %build export OBJECT_MODE=64 python3 setup.py build %install [ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} #Renaming binaries to avoid conflict with python-pyserial mv $RPM_BUILD_ROOT/%{_bindir}/miniterm.py $RPM_BUILD_ROOT/%{_bindir}/miniterm-3.py %if %{dotests} %check python3 test/run_all_tests.py || true %endif %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %{_bindir}/* %doc LICENSE.txt CHANGES.rst README.rst examples %{python_sitelib}/* %changelog * Sun Jan 26 2020 Reshma V Kumar -3.4-1 - Update to latest version - Build with python3 * Thu Jun 16 2016 Reshma V Kumar -2.7-1 - updated to latest version * Wed May 25 2016 Ravi Hirekurabar - 2.7-1 - first version for AIX V6.1 and higher