%if 0%{?rhel} != 0 && 0%{?rhel} <= 6 %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %endif %if 0%{?rhel} != 0 && 0%{?rhel} <= 7 # Do not build python3 subpackage for RHEL <= 7 %bcond_with python3 %else %bcond_without python3 %endif Name: python-yubico Version: 1.2.3 Release: 5%{?dist} Summary: Pure-python library for interacting with Yubikeys License: BSD URL: https://github.com/Yubico/python-yubico Source0: https://github.com/Yubico/python-yubico/archive/%{name}-%{version}.tar.gz Patch0: %{name}-python3.patch Patch1: %{name}-python3_util_examples.patch BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools %if 0%{?rhel} == 0 || 0%{?rhel} >= 7 BuildRequires: python-nose BuildRequires: pyusb %endif Requires: pyusb %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-nose BuildRequires: python3-pyusb %endif %description Pure-python library for interacting with Yubikeys %if %{with python3} %package -n python3-yubico Summary: Pure-python library for interacting with Yubikeys Requires: python3-pyusb %description -n python3-yubico Pure-python library for interacting with Yubikeys. For Python 3. %endif %prep %setup -qc mv %{name}-%{name}-%{version} python2 pushd python2 sed -i 's|setup_requires=|tests_require=|' setup.py popd %if %{with python3} cp -a python{2,3} pushd python3 %patch0 -p1 %patch1 -p1 popd %endif %build pushd python2 %{__python2} setup.py build popd %if %{with python3} pushd python3 %{__python3} setup.py build popd %endif %install pushd python2 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %if %{with python3} pushd python3 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif %files %{!?_licensedir:%global license %%doc} %license python2/COPYING %doc python2/NEWS python2/README %{python2_sitelib}/* %if %{with python3} %files -n python3-yubico %license python3/COPYING %doc python3/NEWS python3/README %{python3_sitelib}/* %endif %if 0%{?rhel} == 0 || 0%{?rhel} >= 7 %check pushd python2 # Exclude tests that require a physical yubikey attached. nosetests -e test_challenge_response -e test_serial -e test_status popd %if %{with python3} pushd python3 # Exclude tests that require a physical yubikey attached. nosetests-%{python3_version} -e test_challenge_response -e test_serial -e test_status popd %endif # with python3 %endif # rhel %changelog * Mon Jan 11 2016 Will Thompson - 1.2.3-5 - Add python3-pyusb dependency to python3 subpackage (#1278210) * Mon Jan 11 2016 Ville Skyttä - Ship COPYING as %%license where applicable * Tue Nov 10 2015 Fedora Release Engineering - 1.2.3-4 - Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 * Mon Jul 20 2015 Miro Hrončok - 1.2.3-3 - Add Python 3 subpackage (#1244237) * Thu Jun 18 2015 Fedora Release Engineering - 1.2.3-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild * Mon Mar 23 2015 Nathaniel McCallum - 1.2.3-1 - Upstream 1.2.3 - Require pyusb during building when running tests * Mon Jun 23 2014 Nathaniel McCallum - 1.2.1-3 - Enable build on EL6. * Sat Jun 21 2014 Nathaniel McCallum - 1.2.1-2 - Run upstream tests during build. * Thu Jun 19 2014 Nathaniel McCallum - 1.2.1-1 - Initial release.