3eabb00
%bcond_without python3
3eabb00
3eabb00
%global module_name vulture
3eabb00
%global common_desc \
3eabb00
Vulture finds unused classes, functions and variables in your code. \
3eabb00
This helps you cleanup and find errors in your programs. If you run it \
3eabb00
on both your library and test suite you can find untested code. \
3eabb00
Due to Python’s dynamic nature, static code analyzers like vulture \
3eabb00
are likely to miss some dead code. Also, code that is only called \
3eabb00
implicitly may be reported as unused. Nonetheless, vulture can be a \
3eabb00
very helpful tool for higher code quality.
3eabb00
3eabb00
Name:		python-%{module_name}
3eabb00
Version:	0.14
3eabb00
Release:	1%{?dist}
3eabb00
Summary:	Find Dead Code
3eabb00
3eabb00
License:	MIT
3eabb00
URL:		https://pypi.python.org/pypi/vulture
3eabb00
Source0:	https://files.pythonhosted.org/packages/source/v/%{module_name}/%{module_name}-%{version}.tar.gz
3eabb00
3eabb00
BuildArch:	noarch
3eabb00
3eabb00
%description
3eabb00
%{common_desc}
3eabb00
3eabb00
%package -n	python2-%{module_name}
3eabb00
Summary:	Find Dead Code
3eabb00
%{?python_provide:%python_provide python2-%{module_name}}
3eabb00
3eabb00
BuildRequires:	python2-devel
3eabb00
BuildRequires:	python-setuptools
3eabb00
# Required by tests
3eabb00
BuildRequires:	python2-pytest
3eabb00
BuildRequires:	python2-pytest-cov
3eabb00
3eabb00
Requires:	python-setuptools
3eabb00
3eabb00
%description -n	python2-%{module_name}
3eabb00
%{common_desc}
3eabb00
3eabb00
%if %{with python3}
3eabb00
%package -n	python3-%{module_name}
3eabb00
Summary:	Find Dead Code
3eabb00
%{?python_provide:%python_provide python3-%{module_name}}
3eabb00
3eabb00
BuildRequires:	python3-devel
3eabb00
BuildRequires:	python3-setuptools
3eabb00
# Required by tests
3eabb00
BuildRequires:	python3-pytest
3eabb00
BuildRequires:	python3-pytest-cov
3eabb00
3eabb00
Requires:	python3-setuptools
3eabb00
%description -n	python3-%{module_name}
3eabb00
%{common_desc}
3eabb00
%endif
3eabb00
3eabb00
%prep
3eabb00
%autosetup -n	%{module_name}-%{version}
3eabb00
# Remove shebang
3eabb00
sed -i '1{/^#!/d}' vulture.py
3eabb00
3eabb00
%build
3eabb00
%py2_build
3eabb00
%if %{with python3}
3eabb00
%py3_build
3eabb00
%endif
3eabb00
3eabb00
%install
3eabb00
%if %{with python3}
3eabb00
%py3_install
3eabb00
mv %{buildroot}%{_bindir}/%{module_name} %{buildroot}%{_bindir}/%{module_name}-%{python3_version}
3eabb00
%endif
3eabb00
%py2_install
3eabb00
mv %{buildroot}%{_bindir}/%{module_name} %{buildroot}%{_bindir}/%{module_name}-%{python2_version}
3eabb00
3eabb00
ln -s %{_bindir}/vulture-%{python3_version} %{buildroot}/%{_bindir}/vulture-3
3eabb00
ln -s %{_bindir}/vulture-%{python2_version} %{buildroot}/%{_bindir}/vulture-2
3eabb00
ln -s %{_bindir}/vulture-%{python2_version} %{buildroot}/%{_bindir}/vulture
3eabb00
3eabb00
%check
3eabb00
py.test-2
3eabb00
%if %{with python3}
3eabb00
py.test-3
3eabb00
%endif
3eabb00
3eabb00
%files -n	python2-%{module_name}
3eabb00
%doc README.rst
3eabb00
%license LICENSE.txt
3eabb00
%{_bindir}/%{module_name}
3eabb00
%{_bindir}/%{module_name}-2
3eabb00
%{_bindir}/%{module_name}-%{python2_version}
3eabb00
%{python2_sitelib}/%{module_name}.py*
3eabb00
%{python2_sitelib}/%{module_name}-%{version}-py?.?.egg-info
3eabb00
3eabb00
%if %{with python3}
3eabb00
%files -n	python3-%{module_name}
3eabb00
%doc README.rst
3eabb00
%license LICENSE.txt
3eabb00
%{_bindir}/%{module_name}-3
3eabb00
%{_bindir}/%{module_name}-%{python3_version}
3eabb00
%{python3_sitelib}/__pycache__/*
3eabb00
%{python3_sitelib}/%{module_name}.py
3eabb00
%{python3_sitelib}/%{module_name}-%{version}-py?.?.egg-info
3eabb00
%endif
3eabb00
3eabb00
%changelog
3eabb00
* Tue Jun 20 2017 Yatin Karel <ykarel@redhat.com> - 0.14-1
3eabb00
- Initial package import
3eabb00