Blob Blame Raw
%bcond_without python3

%global module_name vulture
%global common_desc \
Vulture finds unused classes, functions and variables in your code. \
This helps you cleanup and find errors in your programs. If you run it \
on both your library and test suite you can find untested code. \
Due to Python’s dynamic nature, static code analyzers like vulture \
are likely to miss some dead code. Also, code that is only called \
implicitly may be reported as unused. Nonetheless, vulture can be a \
very helpful tool for higher code quality.

Name:		python-%{module_name}
Version:	0.27
Release:	4%{?dist}
Summary:	Find Dead Code

License:	MIT
URL:		https://pypi.python.org/pypi/vulture
Source0:	https://files.pythonhosted.org/packages/source/v/%{module_name}/%{module_name}-%{version}.tar.gz

BuildArch:	noarch

%description
%{common_desc}

%package -n	python2-%{module_name}
Summary:	Find Dead Code
%{?python_provide:%python_provide python2-%{module_name}}

BuildRequires:	python2-devel
BuildRequires:	python2-setuptools
# Required by tests
BuildRequires:	python2-pytest
BuildRequires:	python2-pytest-cov

Requires:	python2-setuptools

%description -n	python2-%{module_name}
%{common_desc}

%if %{with python3}
%package -n	python3-%{module_name}
Summary:	Find Dead Code
%{?python_provide:%python_provide python3-%{module_name}}

BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
# Required by tests
BuildRequires:	python3-pytest
BuildRequires:	python3-pytest-cov

Requires:	python3-setuptools
%description -n	python3-%{module_name}
%{common_desc}
%endif

%prep
%autosetup -n	%{module_name}-%{version}
# Remove shebang
sed -i '1{/^#!/d}' vulture/*.py

%build
%py2_build
%if %{with python3}
%py3_build
%endif

%install
%if %{with python3}
%py3_install
mv %{buildroot}%{_bindir}/%{module_name} %{buildroot}%{_bindir}/%{module_name}-%{python3_version}
%endif
%py2_install
mv %{buildroot}%{_bindir}/%{module_name} %{buildroot}%{_bindir}/%{module_name}-%{python2_version}

ln -s %{_bindir}/vulture-%{python3_version} %{buildroot}/%{_bindir}/vulture-3
ln -s %{_bindir}/vulture-%{python2_version} %{buildroot}/%{_bindir}/vulture-2
ln -s %{_bindir}/vulture-%{python2_version} %{buildroot}/%{_bindir}/vulture

%check
export PYTHONPATH=.
py.test-2
%if %{with python3}
py.test-3
%endif

%files -n	python2-%{module_name}
%doc README.rst
%license LICENSE.txt
%{_bindir}/%{module_name}
%{_bindir}/%{module_name}-2
%{_bindir}/%{module_name}-%{python2_version}
%{python2_sitelib}/%{module_name}
%{python2_sitelib}/%{module_name}-%{version}-py?.?.egg-info

%if %{with python3}
%files -n	python3-%{module_name}
%doc README.rst
%license LICENSE.txt
%{_bindir}/%{module_name}-3
%{_bindir}/%{module_name}-%{python3_version}
%{python3_sitelib}/%{module_name}/__pycache__
%{python3_sitelib}/%{module_name}
%{python3_sitelib}/%{module_name}-%{version}-py?.?.egg-info
%endif

%changelog
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.27-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.27-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jun 29 2018 Yatin Karel <ykarel@redhat.com> - 0.27-2
- Rebuilt for Python 3.7

* Fri Jun 29 2018 Yatin Karel <ykarel@redhat.com> - 0.27-1
- Update to 0.27 (#1586070)

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.26-3
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.26-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Aug 28 2017 Fedora Release Monitoring  <release-monitoring@fedoraproject.org> - 0.26-1
- Update to 0.26 (#1485917)

* Wed Aug 16 2017 Fedora Release Monitoring  <release-monitoring@fedoraproject.org> - 0.25-1
- Update to 0.25 (#1472024)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Jul 17 2017 Yatin Karel <ykarel@redhat.com> - 0.16-1
- Sync with upstream release 0.16

* Wed Jul 05 2017 Yatin Karel <ykarel@redhat.com> - 0.14-3
- Fix Changelog release

* Wed Jul 05 2017 Yatin Karel <ykarel@redhat.com> - 0.14-2
- Use versioned package, python2-setuptools(not python-setuptools)

* Tue Jun 20 2017 Yatin Karel <ykarel@redhat.com> - 0.14-1
- Initial package import