# sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: pyftdi Version: 0.28.7 Release: 3%{?dist} Summary: python binding for libftdi License: LGPL v2 URL: https://github.com/eblot/pyftdi Source0: %{name}-%{version}.tar.gz Patch0: 0001-print-fixes-for-python2.patch %if %{with python3} Requires: python3-pyserial >= 2.6 %endif # with python3 Requires: pyserial >= 2.6 Requires: pyusb >= 1.0.0 BuildArch: noarch BuildRequires: python2-devel %if %{with python3} BuildRequires: python3-devel %endif # with python3 %if 0%{?fedora} BuildRequires: python2-setuptools %else BuildRequires: python-setuptools %endif %description python ftdi binding %if %{with python3} %package -n python3-pyftdi Summary: python3 binding for libftdi %description -n python3-pyftdi python3 ftdi binding %endif # with python3 %prep %setup -qc mv %{name}-%{version} python2 pushd python2 %patch0 -p1 -b .p2fix popd %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build popd %if %{with python3} pushd python3 # Remove CFLAGS=... for noarch packages (unneeded) CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build popd %endif # with python3 %install rm -rf $RPM_BUILD_ROOT # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if %{with python3} pushd python3 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with python3 pushd python2 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %check %if %{with python3} pushd python3 %{__python3} setup.py test popd %endif # with python3 pushd python2 %{__python2} setup.py test popd %files %doc %{python2_sitelib}/* %if %{with python3} %files -n python3-pyftdi %doc %{python3_sitelib}/* %endif # with python3 %changelog * Wed Mar 7 2018 Jiri Kastner - 0.28.7-3 - fixed builddeps for rhel platforms * Wed Mar 7 2018 Jiri Kastner - 0.28.7-2 - python2 fixes * Wed Mar 7 2018 Jiri Kastner - 0.28.7-1 - added python3-pyserial for python3 - updated to latest release - fixed 'copy pasta' in check * Fri Oct 30 2015 Jiri Kastner - 0.11.3-1 - initial package