%if 0%{?rhel} && 0%{?rhel} <= 7
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?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))")}
%else
%global with_python3 1
%endif
%global srcname pytest-flakes
Name: python-%{srcname}
Version: 0.2
Release: 4%{?dist}
Summary: Pytest plugin to check source code with pyflakes
License: MIT
URL: https://pypi.python.org/pypi/%{srcname}
Source0: https://pypi.python.org/packages/source/p/%{srcname}/%{srcname}-%{version}.zip
Source1: https://raw.githubusercontent.com/fschulze/pytest-flakes/master/LICENSE
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-setuptools
BuildRequires: pyflakes
BuildRequires: python-pytest-cache
Requires: pyflakes
Requires: python-pytest-cache
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pyflakes
BuildRequires: python3-pytest-cache
%endif
%description
Py.test plugin for efficiently checking python source with pyflakes.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: Pytest plugin to check source code with pyflakes
Requires: python3-pyflakes
Requires: python3-pytest-cache
%description -n python3-%{srcname}
Py.test plugin for efficiently checking python source with pyflakes.
%endif # with_python3
%prep
%setup -q -n %{srcname}-%{version}
cp %SOURCE1 .
rm -rf *.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%endif # with_python3
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%{__python2} setup.py install --skip-build --root %{buildroot}
%check
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3
%files
%doc LICENSE README.rst
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc LICENSE README.rst
%{python3_sitelib}/*
%endif # with_python3
%changelog
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Mon May 19 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
* Sat Mar 22 2014 Orion Poplawski <orion@cora.nwra.com> - 0.2-2
- Capitalize summary/description
- Add upstream license file
* Tue Feb 25 2014 Orion Poplawski <orion@cora.nwra.com> - 0.2-1
- Initial package