From 8eafb268bfe484e80d44d01459e3d8efb71d3377 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Sat, 4 Nov 2017 11:46:53 +0100 Subject: [PATCH] Cleanup spec Signed-off-by: Igor Gnatenko --- python-nose.spec | 189 +++++++++++++++++++---------------------------- 1 file changed, 76 insertions(+), 113 deletions(-) diff --git a/python-nose.spec b/python-nose.spec index 7a48239..ab6fec8 100644 --- a/python-nose.spec +++ b/python-nose.spec @@ -1,15 +1,8 @@ -%if 0%{?rhel} && 0%{?rhel} <= 7 -%bcond_with python3 -%else -%bcond_without python3 -%endif - -%global upstream_name nose +%global modname nose # Enable building without docs to avoid a circular dependency between this and python-sphinx -%global with_docs 1 +%bcond_without docs -%global sum Discovery-based unit test extension for Python %global desc nose extends the test loading and running features of unit test, making\ it easier to write, find and run tests.\ \ @@ -26,14 +19,13 @@ coverage and profiling, flexible attribute-based test selection,\ output capture and more.\ -Name: python-nose +Name: python-%{modname} Version: 1.3.7 Release: 17%{?dist} BuildArch: noarch License: LGPLv2+ and Public Domain -Summary: %{sum} -Group: Development/Languages +Summary: Discovery-based unit test extension for Python URL: https://nose.readthedocs.org/en/latest/ Source0: http://pypi.python.org/packages/source/n/nose/nose-%{version}.tar.gz # Make compatible with coverage 4.1 @@ -52,164 +44,135 @@ Patch3: python-nose-readunicode.patch # https://github.com/nose-devs/nose/pull/1029 Patch4: python-nose-py36.patch -BuildRequires: python2-devel -%if %{with python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-coverage >= 3.4-1 -%endif -BuildRequires: python-setuptools -BuildRequires: dos2unix -BuildRequires: python-coverage >= 3.4-1 - +BuildRequires: dos2unix %description %{desc} - %package docs Summary: Nose Documentation -Group: Documentation -%if 0%{?with_docs} -BuildRequires: python-sphinx +%if %{with docs} +BuildRequires: %{_bindir}/sphinx-build %endif - %description docs -Documentation for Nose - - -%package -n python2-%{upstream_name} -Summary: %{sum} - -Requires: python-setuptools - -%{?python_provide:%python_provide python2-%{upstream_name}} +Documentation for Nose. +%package -n python2-%{modname} +Summary: %{summary} +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python2-coverage >= 3.4-1 +Requires: python2-setuptools +%{?python_provide:%python_provide python2-%{modname}} -%description -n python2-%{upstream_name} +%description -n python2-%{modname} %{desc} - -%if %{with python3} -%package -n python3-%{upstream_name} -Summary: Discovery-based unit test extension for Python3 -Group: Development/Languages +%package -n python3-%{modname} +Summary: %{summary} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-coverage >= 3.4-1 Requires: python3-setuptools -%{?python_provide:%python_provide python3-%{upstream_name}} -Obsoletes: platform-python-%{upstream_name} < 1.3.7-17 +%{?python_provide:%python_provide python3-%{modname}} +Obsoletes: platform-python-%{modname} < 1.3.7-17 -%description -n python3-%{upstream_name} +%description -n python3-%{modname} %{desc} This package installs the nose module and nosetests3 program that can discover python3 unit tests. -%endif # with_python3 %prep -%setup -q -n %{upstream_name}-%{version} -%patch0 -p1 -b .coverage4 -%patch1 -p1 -b .py35 -%patch2 -p1 -b .unicode -%patch3 -p1 -b .unicode -%patch4 -p1 -b .py36 - +%setup -qc +pushd %{modname}-%{version} +%autopatch -p1 dos2unix examples/attrib_plugin.py - -%if %{with python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -%endif # with_python3 +cp -pr lgpl.txt AUTHORS CHANGELOG examples NEWS README.txt .. +popd +mv %{modname}-%{version} python2 +cp -pr python2 python3 %build +pushd python2 %py2_build - -%if %{with python3} -pushd %{py3dir} +popd +pushd python3 %py3_build popd -%endif # with_python3 %install -# Must do the python3 install first because the scripts in /usr/bin are -# overwritten with every setup.py install (and we want the python2 version -# to be the default for now). - -%if %{with python3} -pushd %{py3dir} +mkdir -p %{buildroot}%{_mandir}/man1 +pushd python2 +%py2_install +mv %{buildroot}%{_bindir}/nosetests{,-%{python2_version}} +ln -sf nosetests-%{python2_version} %{buildroot}%{_bindir}/nosetests-2 +mv %{buildroot}%{_prefix}/man/man1/nosetests.1 %{buildroot}%{_mandir}/man1/nosetests-%{python2_version}.1 +ln -sf nosetests-%{python2_version}.1 %{buildroot}%{_mandir}/man1/nosetests-2.1 +popd +pushd python3 %py3_install -rm %{buildroot}%{_bindir}/nosetests -ln -s ./nosetests-%{python3_version} %{buildroot}%{_bindir}/nosetests-3 -mkdir -m 0755 -p %{buildroot}%{_mandir}/man1/ +mv %{buildroot}%{_bindir}/nosetests{,-%{python3_version}} +ln -sf nosetests-%{python3_version} %{buildroot}%{_bindir}/nosetests-3 mv %{buildroot}%{_prefix}/man/man1/nosetests.1 %{buildroot}%{_mandir}/man1/nosetests-%{python3_version}.1 -ln -s ./nosetests-%{python3_version}.1 %{buildroot}%{_mandir}/man1/nosetests-3.1 -popd -%endif # with_python3 - -%py2_install -- --install-data=%{_datadir} -# Let's make /usr/bin/nosetests just be a symlink to nosetests-{python2_version} -rm %{buildroot}%{_bindir}/nosetests -ln -s nosetests-%{python2_version} %{buildroot}%{_bindir}/nosetests -ln -s nosetests-%{python2_version} %{buildroot}%{_bindir}/nosetests-2 -# We'll do something similar for the man page -mv %{buildroot}%{_mandir}/man1/nosetests.1 %{buildroot}%{_mandir}/man1/nosetests-%{python2_version}.1 -ln -s ./nosetests-%{python2_version}.1 %{buildroot}%{_mandir}/man1/nosetests.1 -ln -s ./nosetests-%{python2_version}.1 %{buildroot}%{_mandir}/man1/nosetests-2.1 - -%if 0%{?with_docs} -pushd doc -make html -rm -rf .build/html/.buildinfo .build/html/_sources -mv .build/html .. -rm -rf .build +ln -sf nosetests-%{python3_version}.1 %{buildroot}%{_mandir}/man1/nosetests-3.1 popd -%endif # with_docs -cp -a doc reST -rm -rf reST/.static reST/.templates +ln -sf nosetests-2 %{buildroot}%{_bindir}/nosetests +ln -sf nosetests-2.1 %{buildroot}%{_mandir}/man1/nosetests.1 + +%if %{with docs} +pushd python2/doc + sphinx-build -b html -d .build/doctrees . .build/html + rm -vrf .build/html/.buildinfo .build/html/_sources + mv .build/html ../.. + rm -vrf .build +popd +%endif +cp -a python2/doc reST +rm -vrf reST/{.static,.templates} %check +pushd python2 %{__python2} selftest.py - -%if %{with python3} -pushd %{py3dir} -export PYTHONPATH=`pwd`/build/lib +popd +pushd python3 %{__python3} setup.py build_tests %{__python3} selftest.py popd -%endif # with_python3 - -%files -n python2-%{upstream_name} +%files -n python2-%{modname} %license lgpl.txt %{_bindir}/nosetests %{_bindir}/nosetests-2 %{_bindir}/nosetests-%{python_version} -%{_mandir}/man1/nosetests.1.gz -%{_mandir}/man1/nosetests-2.1.gz -%{_mandir}/man1/nosetests-%{python_version}.1.gz -%{python_sitelib}/nose* +%{_mandir}/man1/nosetests.1* +%{_mandir}/man1/nosetests-2.1* +%{_mandir}/man1/nosetests-%{python_version}.1* +%{python2_sitelib}/nose-*.egg-info/ +%{python2_sitelib}/nose/ -%if %{with python3} -%files -n python3-%{upstream_name} +%files -n python3-%{modname} %license lgpl.txt %{_bindir}/nosetests-3 %{_bindir}/nosetests-%{python3_version} -%{_mandir}/man1/nosetests-3.1.gz -%{_mandir}/man1/nosetests-%{python3_version}.1.gz -%{python3_sitelib}/nose* -%endif +%{_mandir}/man1/nosetests-3.1* +%{_mandir}/man1/nosetests-%{python3_version}.1* +%{python3_sitelib}/nose-*.egg-info/ +%{python3_sitelib}/nose/ %files docs %license lgpl.txt %doc AUTHORS CHANGELOG examples NEWS README.txt reST -%if 0%{?with_docs} +%if %{with docs} %doc html -%endif # with_docs +%endif %changelog * Sat Nov 04 2017 Igor Gnatenko - 1.3.7-17 - Remove platform-python subpackage +- Cleanup spec * Fri Sep 29 2017 Troy Dawson - 1.3.7-16 - Cleanup spec file conditionals