%global srcname pyserial
%global sum Serial Port Access

Name:           python-%{srcname}
Version:        3.2.1
Release:        1%{?dist}
Summary:        %{sum}

License:        BSD
URL:            https://github.com/%{srcname}/%{srcname}
Source0:        https://github.com/%{srcname}/%{srcname}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
BuildRequires:  python2-devel python3-devel

%description
Serial Port Access.

%package -n python2-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
Serial Port Access.


%prep
%autosetup -n %{srcname}-%{version}

%build
%py2_build

%install
%py2_install

%check
%{__python2} setup.py test

# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
%files -n python2-%{srcname}
%license LICENSE.txt
%doc README.rst
%{python2_sitelib}/*
%{_bindir}/miniterm.py

%changelog
* Sun Mar 25 2018 Thomas Sailer <t.sailer@alumni.ethz.ch> - 3.2.1-1
- initial spec file