Blob Blame History Raw
%if 0%{?fedora} > 12 || 0%{?rhel} > 7
%global with_python3 1
%endif

%global modname mccabe

Name:               python-mccabe
Version:            0.2.1
Release:            5%{?dist}
Summary:            McCabe complexity checker

Group:              Development/Libraries
License:            MIT
URL:                http://pypi.python.org/pypi/mccabe
Source0:            http://pypi.python.org/packages/source/m/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch
BuildRequires:      python2-devel, python-setuptools

%if 0%{?with_python3}
BuildRequires:      python3-devel, python3-setuptools
%endif

%description
Ned's script to check McCabe complexity.

This module provides a plugin for ``flake8``, the Python code
checker.

%if 0%{?with_python3}
%package -n python3-mccabe
Summary:            McCabe checker, plugin for flake8
Group:              Development/Libraries

%description -n python3-mccabe
Ned's script to check McCabe complexity.

This module provides a plugin for ``flake8``, the Python code
checker.
%endif

%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif


%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%{__python} setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif

%files
%doc README.rst
%{python_sitelib}/%{modname}.py*
%{python_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-mccabe
%doc README.rst
%{python3_sitelib}/%{modname}.py*
%{python3_sitelib}/%{modname}-%{version}-*
%{python3_sitelib}/__pycache__/%{modname}.*

%endif

%changelog
* Wed May 14 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Tue Apr 29 2014 Matěj Cepl <mcepl@redhat.com> - 0.2.1-4
- Fix building on RHEL-7 (we really don’t have Python3)

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Apr 15 2013 Matěj Cepl <mcepl@redhat.com> 0.2.1-2
- Fix %%changelog.

* Sun Apr 14 2013 Matěj Cepl <mcepl@redhat.com> 0.2.1-1
- initial package for Fedora