1f53472
%if 0%{?fedora} > 12
30354bf
%bcond_without python3
30354bf
%else
30354bf
%bcond_with python3
30354bf
%endif
30354bf
30354bf
%global modname flake8
30354bf
30354bf
Name:             python-%{modname}
30354bf
Version:          2.0
1f53472
Release:          5%{?dist}
30354bf
Summary:          Code checking using pep8 and pyflakes
30354bf
30354bf
Group:            Development/Languages
30354bf
License:          MIT
30354bf
URL:              http://pypi.python.org/pypi/%{modname}
30354bf
Source0:          http://pypi.python.org/packages/source/f/%{modname}/%{modname}-%{version}.tar.gz
30354bf
30354bf
BuildArch:        noarch
30354bf
BuildRequires:    python2-devel python-nose python-setuptools
30354bf
BuildRequires:    python-mccabe >= 0.2
30354bf
BuildRequires:    python-pep8 >= 1.4.3
30354bf
BuildRequires:    pyflakes >= 0.6.1
1f53472
Requires:         python-mccabe >= 0.2
1f53472
Requires:         python-pep8 >= 1.4.3
1f53472
Requires:         pyflakes >= 0.6.1
30354bf
%if %{with python3}
30354bf
BuildRequires:    python3-devel
30354bf
BuildRequires:    python3-setuptools
30354bf
BuildRequires:    python3-nose
30354bf
BuildRequires:    python3-mccabe >= 0.2
30354bf
BuildRequires:    python3-pep8 >= 1.4.3
30354bf
BuildRequires:    python3-pyflakes >= 0.6.1
30354bf
%endif
30354bf
30354bf
%description
30354bf
Flake8 is a wrapper around these tools:
30354bf
30354bf
- PyFlakes - pep8 - Ned's McCabe script
30354bf
30354bf
Flake8 runs all tools by launching the single 'flake8' script, but ignores
30354bf
pep8 and PyFlakes extended options and just uses defaults. It displays the
30354bf
warnings in a per-file, merged output.
30354bf
30354bf
It also adds a few features:
30354bf
30354bf
- files that contains with this header are skipped::
30354bf
30354bf
# flake8: noqa
30354bf
30354bf
- lines that contains a "# NOQA" comment at the end will not issue a
30354bf
warning. - a Mercurial hook.
30354bf
30354bf
- a McCabe complexity checker.
30354bf
30354bf
30354bf
%if %{with python3}
30354bf
%package -n python3-%{modname}
30354bf
Summary:        Code checking using pep8 and pyflakes
30354bf
Group:          Development/Languages
30354bf
30354bf
%description -n python3-%{modname}
30354bf
Flake8 is a wrapper around these tools:
30354bf
30354bf
- PyFlakes - pep8 - Ned's McCabe script
30354bf
30354bf
Flake8 runs all tools by launching the single 'flake8' script, but ignores
30354bf
pep8 and PyFlakes extended options and just uses defaults. It displays the
30354bf
warnings in a per-file, merged output.
30354bf
30354bf
It also adds a few features:
30354bf
30354bf
- files that contains with this header are skipped::
30354bf
30354bf
# flake8: noqa
30354bf
30354bf
- lines that contains a "# NOQA" comment at the end will not issue a
30354bf
warning. - a Mercurial hook.
30354bf
30354bf
- a McCabe complexity checker.
30354bf
30354bf
This is version of the package running with Python 3.
30354bf
30354bf
%endif
30354bf
30354bf
30354bf
%prep
30354bf
%setup -q -n %{modname}-%{version}
30354bf
30354bf
#sed -i -e '/^#!\s*\/.*bin\/.*python/d' flake8/pep8.py
30354bf
#chmod -x flake8/pep8.py
30354bf
30354bf
%if %{with python3}
30354bf
rm -rf %{py3dir}
30354bf
cp -a . %{py3dir}
30354bf
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
30354bf
30354bf
%endif
30354bf
30354bf
30354bf
%build
30354bf
%{__python2} setup.py build
30354bf
30354bf
%if %{with python3}
30354bf
pushd %{py3dir}
30354bf
%{__python3} setup.py build
30354bf
popd
30354bf
%endif
30354bf
30354bf
%install
30354bf
unset PYTHONPATH
30354bf
rm -rf %{buildroot}
30354bf
# Must do the python3 install first because the scripts in /usr/bin are
30354bf
# overwritten with every setup.py install (and we want the python2 version
30354bf
# to be the default for now).
30354bf
%if %{with python3}
30354bf
pushd %{py3dir}
30354bf
    %{__python3} setup.py install -O1 --skip-build --root %{buildroot}
30354bf
    mv %{buildroot}%{_bindir}/flake8 %{buildroot}%{_bindir}/python3-flake8
30354bf
popd
30354bf
%endif
30354bf
30354bf
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
30354bf
30354bf
30354bf
%check
30354bf
%{__python2} setup.py nosetests --verbosity=2
30354bf
%if %{with python3}
30354bf
%{__python3} setup.py nosetests --verbosity=2
30354bf
%endif
30354bf
30354bf
%files
30354bf
%doc README.rst CONTRIBUTORS.txt
30354bf
30354bf
%{_bindir}/%{modname}
30354bf
%{python_sitelib}/%{modname}*
30354bf
30354bf
%if %{with python3}
30354bf
%files -n python3-%{modname}
30354bf
%doc README.rst CONTRIBUTORS.txt
30354bf
%{_bindir}/python3-flake8
30354bf
%{python3_sitelib}/%{modname}*
30354bf
%endif
30354bf
30354bf
30354bf
%changelog
1f53472
* Wed Nov 05 2014 Matej Cepl <mcepl@redhat.com> - 2.0-5
1f53472
- Fix missing Requires (RHBZ# 1160221)
1f53472
30354bf
* Mon Nov 18 2013 Matthias Runge <mrunge@redhat.com> - 2.0-4
30354bf
- use __python2 instead of __python
30354bf
- add CONTRIBUTORS.txt to py3 docs
30354bf
30354bf
* Tue Nov 05 2013 Matthias Runge <mrunge@redhat.com> - 2.0-3
30354bf
- minimal spec cleanup, fix one rpmlint warning
30354bf
30354bf
* Sat Sep 08 2012 Matej Cepl <mcepl@redhat.com> - 1.4-2
30354bf
- Update .spec file according to ongoing packaging review.
30354bf
30354bf
* Tue Jul 10 2012 Matej Cepl <mcepl@redhat.com> - 1.4-1
30354bf
- initial package for Fedora
30354bf