[python-diff-cover] Fix the stuff I got wrong with the last commit:

David Shea dshea at fedoraproject.org
Sat Dec 13 15:40:50 UTC 2014


commit 4f6c0155398d8da56407c553397d96b4fdb93315
Author: David Shea <dshea at redhat.com>
Date:   Fri Dec 12 11:47:07 2014 -0500

    Fix the stuff I got wrong with the last commit:
    
    Correct the python3 version of setup.py by removing the patched one and
    just installing the binaries. Rename the python3 binaries as python3-diff-*
    
    Correct the dependencies to match requirements.txt

 python-diff-cover-0.2.9-noscripts3.patch |   31 -------------
 python-diff-cover.spec                   |   72 +++++++++++++++++++++---------
 2 files changed, 51 insertions(+), 52 deletions(-)
---
diff --git a/python-diff-cover.spec b/python-diff-cover.spec
index fdbba1d..c3e5bf9 100644
--- a/python-diff-cover.spec
+++ b/python-diff-cover.spec
@@ -6,7 +6,6 @@ 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
 
@@ -16,19 +15,24 @@ BuildRequires:  python-setuptools
 # Required for the entry_point scripts
 Requires:       python-setuptools
 
+%define jinja2ver 2.7.1
+%define lazyver 1.1
+%define sixver 1.6.1
+%define pygmentsver 2.0.1
+
 # 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 >= %{jinja2ver}
+Requires:       python-lazy >= %{lazyver}
+Requires:       python-six >= %{sixver}
+Requires:       python-pygments >= %{pygmentsver}
 Requires:       python-jinja2_pluralize
 
-# Copy the python2 requires to BuildRequires so we can run the entry point
+# Copy the 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 >= %{jinja2ver}
+BuildRequires:  python-lazy >= %{lazyver}
+BuildRequires:  python-six >= %{sixver}
+BuildRequires:  python-pygments >= %{pygmentsver}
 BuildRequires:  python-jinja2_pluralize
 
 # needed for the _git_root test
@@ -63,13 +67,20 @@ Summary:        Automatically find diff lines that need test coverage in Python
 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 >= %{jinja2ver}
+Requires:       python3-lazy >= %{lazyver}
+Requires:       python3-six >= %{sixver}
+Requires:       python3-pygments >= %{pygmentsver}
 Requires:       python3-jinja2_pluralize
 Requires:       git
 
+# More buildrequires for help2man
+BuildRequires:  python3-jinja2 >= %{jinja2ver}
+BuildRequires:  python3-lazy >= %{lazyver}
+BuildRequires:  python3-six >= %{sixver}
+BuildRequires:  python3-pygments >= %{pygmentsver}
+BuildRequires:  python3-jinja2_pluralize
+
 %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
@@ -84,22 +95,23 @@ diff.
 %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 )
+( cd %{py3dir} && %{__python3} setup.py build )
 
 %install
-%{__python2} setup.py install --skip-build --root %{buildroot}
+# Do python3 first to install and move the binaries out of the way
+( cd %{py3dir} && %{__python3} setup.py install --skip-build --root %{buildroot} )
 
-( cd %{py3dir} && %{__python3} setup3.py install --skip-build --root %{buildroot} )
+# Add a python3- prefix to the binaries
+mv %{_bindir}/diff-cover %{_bindir}/python3-diff-cover
+mv %{_bindir}/diff-quality %{_bindir}/python3-diff-quality
+
+%{__python2} setup.py install --skip-build --root %{buildroot}
 
 # Generate documentation for the scripts
 mkdir -p %{buildroot}%{_mandir}/man1
@@ -113,6 +125,19 @@ PYTHONPATH=%{buildroot}%{python2_sitelib} \
         -o %{buildroot}%{_mandir}/man1/diff-quality.1 \
         %{buildroot}%{_bindir}/diff-quality
 
+PYTHONPATH=%{buildroot}%{python3_sitelib} \
+    help2man --no-info --version-string 'python3-diff-cover %{version}' \
+    -o %{buildroot}%{_mandir}/man1/python3-diff-cover.1 \
+    %{buildroot}%{_bindir}/python3-diff-cover
+
+PYTHONPATH=%{buildroot}%{python3_sitelib} \
+    help2man --no-info --version-string 'python3-diff-quality %{version}' \
+    -o %{buildroot}%{_mandir}/man1/python3-diff-quality.1 \
+    %{buildroot}%{_bindir}/python3-diff-quality
+
+mv %{_mandir}/man1/diff-cover.1 %{_mandir}/man1/python3-diff-cover.1
+mv %{_mandir}/man1/diff-quality.1 %{_mandir}/man1/python3-diff-quality.1
+
 %check
 nosetests -v
 %{__python3} -m nose
@@ -128,6 +153,10 @@ nosetests -v
 
 %files -n python3-diff-cover
 %doc AUTHORS LICENSE README.rst
+%{_bindir}/python3-diff-cover
+%{_bindir}/python3-diff-quality
+%{_mandir}/man1/python3-diff-cover.1*
+%{_mandir}/man1/python3-diff-quality.1*
 %{python3_sitelib}/diff_cover
 %{python3_sitelib}/diff_cover-%{version}-*.egg-info
 
@@ -136,6 +165,7 @@ nosetests -v
 - Added pylint support!
 - Fixed bug around python 1.6 and pyflakes
 - Update Pygments allowing us to remove code we grabbed from the development branch of the project used to support python3 correctly
+- provide python3 binaries as python3-diff-*
 
 * Fri Nov  7 2014 David Shea <dshea at redhat.com> - 0.7.2-1
 - bugfix around prasing of options


More information about the scm-commits mailing list