Blob Blame History Raw
Name:           python-diff-cover
Version:        0.7.2
Release:        3%{?dist}
Summary:        Automatically find diff lines that need test coverage

License:        AGPLv3
URL:            https://github.com/edx/diff-cover/
Source0:        https://pypi.python.org/packages/source/d/diff_cover/diff_cover-%{version}.tar.gz
Patch0:         python-diff-cover-0.2.9-noscripts3.patch

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

# Required for the entry_point scripts
Requires:       python-setuptools

# from requirements.txt, checked by setuptools when running entry point scripts
Requires:       python-jinja2 >= 2.7.1
Requires:       python-lazy >= 1.1
Requires:       python-six >= 1.6.1
Requires:       python-pygments == 1.6
Requires:       python-jinja2_pluralize

# Copy the python2 requires to BuildRequires so we can run the entry point
# scripts for help2man
BuildRequires:  python-jinja2 >= 2.7.1
BuildRequires:  python-lazy >= 1.1
BuildRequires:  python-six >= 1.6.1
BuildRequires:  python-pygments == 1.6
BuildRequires:  python-jinja2_pluralize

# needed for the _git_root test
BuildRequires:  git
Requires:       git

# needed for %check
BuildRequires:  python-nose
BuildRequires:  pyflakes
BuildRequires:  python-mock
BuildRequires:  python-pep8

BuildRequires:  python3-nose
BuildRequires:  python3-pyflakes
BuildRequires:  python3-mock
BuildRequires:  python3-pep8

BuildRequires:  help2man

%description
Diff coverage is the percentage of new or modified lines that are covered by
tests.  This provides a clear and achievable standard for code review: If you
touch a line of code, that line should be covered.  Code coverage is *every*
developer's responsibility!

The diff-cover command line tool compares an XML coverage report with the
output of git diff.  It then reports coverage information for lines in the
diff.

%package -n python3-diff-cover
Summary:        Automatically find diff lines that need test coverage in Python 3
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools

Requires:       python3-jinja2 >= 2.7.1
Requires:       python3-lazy >= 1.1
Requires:       python3-six >= 1.6.1
Requires:       python3-pygments >= 1.6
Requires:       python3-jinja2_pluralize
Requires:       git

%description -n python3-diff-cover
Diff coverage is the percentage of new or modified lines that are covered by
tests.  This provides a clear and achievable standard for code review: If you
touch a line of code, that line should be covered.  Code coverage is *every*
developer's responsibility!

The diff-cover command line tool compares an XML coverage report with the
output of git diff.  It then reports coverage information for lines in the
diff.

%prep
%setup -q -n diff_cover-%{version}
rm -rf diff_cover.egg-info

# Disable scripts for the python3 package. The entry points in bindir
# will be provided by the python2 package.
%patch0 -p1

rm -rf %{py3dir}
cp -a . %{py3dir}

%build
%{__python2} setup.py build

( cd %{py3dir} && %{__python3} setup3.py build )

%install
%{__python2} setup.py install --skip-build --root %{buildroot}

( cd %{py3dir} && %{__python3} setup3.py install --skip-build --root %{buildroot} )

# Generate documentation for the scripts
mkdir -p %{buildroot}%{_mandir}/man1
PYTHONPATH=%{buildroot}%{python2_sitelib} \
    help2man --no-info --version-string 'diff-cover %{version}' \
        -o %{buildroot}%{_mandir}/man1/diff-cover.1 \
        %{buildroot}%{_bindir}/diff-cover

PYTHONPATH=%{buildroot}%{python2_sitelib} \
    help2man --no-info --version-string 'diff-quality %{version}' \
        -o %{buildroot}%{_mandir}/man1/diff-quality.1 \
        %{buildroot}%{_bindir}/diff-quality

%check
nosetests -v
%{__python3} -m nose

%files
%license LICENSE
%doc AUTHORS README.rst
%{_bindir}/diff-cover
%{_bindir}/diff-quality
%{_mandir}/man1/diff-cover.1*
%{_mandir}/man1/diff-quality.1*
%{python2_sitelib}/diff_cover
%{python2_sitelib}/diff_cover-%{version}-*.egg-info

%files -n python3-diff-cover
%license LICENSE
%doc AUTHORS README.rst
%{python3_sitelib}/diff_cover
%{python3_sitelib}/diff_cover-%{version}-*.egg-info

%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Jan 28 2015 David Shea <dshea@redhat.com> - 0.7.2-2
- Use %license for the license file

* Fri Nov  7 2014 David Shea <dshea@redhat.com> - 0.7.2-1
- bugfix around prasing of options
- enable nosetests in spec file

* Wed Oct 22 2014 David Shea <dshea@redhat.com> - 0.7.1-1
- Incorporate sources tag in corbetura reports improving diff-cover's behavior in non python codebases
- Generating HTML report still allows STDOUT to print the regular report

* Mon Oct 13 2014 David Shea <dshea@redhat.com> - 0.6.2-1
- Added log line for when diff-cover fails due to coverage being lower than the fail-under condition

* Sun Oct  5 2014 David Shea <dshea@redhat.com> - 0.6.1-1
- Fixed issue where error message was not being returned after diff-quality errors
- Fixed issue where diff-quality would fail due to warnings.

* Fri Aug  1 2014 David Shea <dshea@redhat.com> - 0.6.0-1
- Add --fail-under option
- Fix requires in spec file for python3 package

* Mon Jul 21 2014 David Shea <dshea@redhat.com> - 0.5.7-2
- Actually remove lxml from requires and buildrequires

* Tue Jul 15 2014 David Shea <dshea@redhat.com> - 0.5.7-1
- Diff quality no longer requires every potential quality tool to be installed
- Fix bug where logging was being called without being configured
- Remove lxml requirement speeding up builds by roughly 50%
- Fixed the git requirement

* Tue Jul  8 2014 David Shea <dshea@redaht.com> - 0.5.4-1
- Fix bug when writing report to stdout. Ensure that all file like objects that get passed into the report generator take bytes
- Run diff cover over the code in each language
- Pluralize report output
- Bugfixes around git_path and unicode
- Add snippets to quality html reports
- Fix snippets relative path
- Add support for Pyflakes

* Mon Jun 16 2014 David Shea <dshea@redhat.com> - 0.4.3-1
- Remove dependency on ipython

* Wed Jun 11 2014 David Shea <dshea@redhat.com> - 0.4.2-1
- Use context manager for output_file
- Write report to stdout even with --html-report
- Load python sources in a safer way

* Mon Jun  2 2014 David Shea <dshea@redhat.com> - 0.4.1-1
- New upstream release diff-cover-0.4.1

* Fri May  2 2014 David Shea <dshea@redhat.com> - 0.4.0-1
- New upstream release diff-cover-0.4.0

* Fri Mar 21 2014 David Shea <dshea@redhat.com> - 0.2.9-1
- Initial package