%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without python3
%global py3_so_suffix cpython-%{python3_version_nodots}m-%{_arch}-%{_target_os}%{?_gnu}
%else # 0#{?fedora} || 0#{?rhel} >= 8
%bcond_with python3
%endif # 0#{?fedora} || 0#{?rhel} >= 8
%global pypi_name hidapi
%global py_setup_opts --with-system-hidapi
Name: python-%{pypi_name}
Version: 0.7.99.post20
Release: 8%{?dist}
Summary: Interface to the %{pypi_name} library
License: GPLv3+ or BSD or Public Domain
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://files.pythonhosted.org/packages/source/h/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildRequires: hidapi-devel
BuildRequires: libusb-devel
BuildRequires: libudev-devel
%description
%{summary}.
%package -n python2-%{pypi_name}
Summary: %{summary}
BuildRequires: python2-Cython
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{summary}.
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
BuildRequires: python3-Cython
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{summary}.
%endif # with python3
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove pre-built and bundled crap.
%{__rm} -fr %{pypi_name} %{pypi_name}.egg-info
%build
%py2_build %{py_setup_opts}
%if %{with python3}
%py3_build %{py_setup_opts}
%endif # with python3
%install
%py2_install %{py_setup_opts}
%if %{with python3}
%py3_install %{py_setup_opts}
%endif # with python3
%check
PYTHONPATH_TMP="${PYTHONPATH}"
export PYTHONPATH="%{buildroot}%{python2_sitearch}"
%{__python2} tests.py
%if %{with python3}
export PYTHONPATH="%{buildroot}%{python3_sitearch}"
%{__python3} tests.py
%endif # with python3
export PYTHONPATH="${PYTHONPATH_TMP}"
unset PYTHONPATH_TMP
%files -n python2-%{pypi_name}
%license LICENSE*.txt
%doc PKG-INFO README.rst try.py
%{python2_sitearch}/hid.so
%{python2_sitearch}/hidraw.so
%{python2_sitearch}/%{pypi_name}-%{version}-py%{python2_version}.egg-info
%if %{with python3}
%files -n python3-%{pypi_name}
%license LICENSE*.txt
%doc PKG-INFO README.rst try.py
%{python3_sitearch}/hid.%{py3_so_suffix}.so
%{python3_sitearch}/hidraw.%{py3_so_suffix}.so
%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%endif # with python3
%changelog
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com>
- Rebuilt for Python 3.7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.99.post20-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.99.post20-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.99.post20-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.99.post20-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.7.99.post20-3
- Rebuild for Python 3.6
* Sun Nov 06 2016 Björn Esser <fedora@besser82.io> - 0.7.99.post20-2
- Rebuilt for ppc64
* Sat Oct 29 2016 Björn Esser <fedora@besser82.io> - 0.7.99.post20-1
- Update to new release v0.7.99.post20
- Build against system hidapi
- Run testsuite
- Remove license-files from github, included in upstream-tarball
* Sat Oct 22 2016 Björn Esser <fedora@besser82.io> - 0.7.99.post19-1
- Initial import (rhbz 1387837)
* Fri Oct 21 2016 Björn Esser <fedora@besser82.io> - 0.7.99.post19-0.1
- Initial package (rhbz 1387837)