# Python 3 only for Fedora for now.
%if 0%{?fedora}
%global with_python3 1
%endif
%global srcname pytest-flakes
Name: python-%{srcname}
Version: 1.0.1
Release: 7%{?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: pytest
# this is specified in setup.py, so we need it installed to run the
# tests even if we have pytest >= 2.8, in which case it won't be used
# at all
BuildRequires: python-pytest-cache
%if 0%{?with_python3}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-pyflakes
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pytest-cache
%endif # with_python3
%description
Py.test plugin for efficiently checking python source with pyflakes.
%package -n python2-%{srcname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{srcname}}
Requires: pyflakes
%if 0%{?fedora} < 24
# caching was moved into core pytest in 2.8, which appeared in f24
Requires: python-pytest-cache
%endif
%description -n python2-%{srcname}
Py.test plugin for efficiently checking python source with pyflakes.
Python 2 build.
%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary: Pytest plugin to check source code with pyflakes
Requires: python%{python3_pkgversion}-pyflakes
%if 0%{?fedora} < 24
# caching was moved into core pytest in 2.8, which appeared in f24
Requires: python%{python3_pkgversion}-pytest-cache
%endif # fedora < 24
%description -n python%{python3_pkgversion}-%{srcname}
Py.test plugin for efficiently checking python source with pyflakes.
Python 3 build.
%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
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
%py3_build
popd
%endif # with_python3
%install
%if 0%{?with_python3}
pushd %{py3dir}
%py3_install
popd
%endif # with_python3
%py2_install
%check
%{__python2} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3
%files -n python2-%{srcname}
%license LICENSE
%doc README.rst
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/*.py
%endif # with_python3
%changelog
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.0.1-5
- Rebuild for Python 3.6
* Wed Nov 16 2016 Orion Poplawski <orion@cora.nwra.com> - 1.0.1-4
- Do not own __pycache__ dir
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Jan 22 2016 Adam Williamson <awilliam@redhat.com> - 1.0.1-1
- new release 1.0.1 (compatible with pytest 2.8)
- rename py2 package to python2-pytest-flakes
- only require pytest-cache on <F24 (and EPEL), pytest 2.8 includes it
- use pyX_build and pyX_install
- use license macro
- provide python2-pytest-flakes
- drop EPEL 6 workarounds from spec as we can't build on EPEL 6 anyway
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* 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