Fix broken python-docutils provides (bug #1399655)

Use %license, python build macro
Spec cleanup
This commit is contained in:
Orion Poplawski 2017-01-30 15:26:12 -07:00
parent 909612be3e
commit b03192047c

View File

@ -1,8 +1,3 @@
# Just a reminder to remove this when these conditions can no longer occur.
%if 0%{?rhel} && 0%{?rhel} <= 5
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif
%if 0%{?fedora} %if 0%{?fedora}
%global with_python3 0%{!?_without_python3:1} %global with_python3 0%{!?_without_python3:1}
%endif %endif
@ -11,7 +6,7 @@
Name: python-%{srcname} Name: python-%{srcname}
Version: 0.13.1 Version: 0.13.1
Release: 2%{?dist} Release: 3%{?dist}
Summary: System for processing plaintext documentation Summary: System for processing plaintext documentation
Group: Development/Languages Group: Development/Languages
@ -26,11 +21,10 @@ URL: http://docutils.sourceforge.net
# The tarball is in dist/docutils-VERSION.tar.gz # The tarball is in dist/docutils-VERSION.tar.gz
Source0: %{srcname}-%{version}.tar.gz Source0: %{srcname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
%if 0%{?with_python3} %if 0%{?with_python3}
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python-tools BuildRequires: python-tools
@ -67,7 +61,7 @@ Python inline documentation modules and packages.
%if 0%{?with_python3} %if 0%{?with_python3}
%package -n python3-%{srcname} %package -n python3-%{srcname}
Summary: System for processing plaintext documentation for python3 Summary: System for processing plaintext documentation for python3
%{?python_provide:%python_provide python2-%{srcname}} %{?python_provide:%python_provide python3-%{srcname}}
Group: Development/Languages Group: Development/Languages
%description -n python3-%{srcname} %description -n python3-%{srcname}
@ -101,25 +95,22 @@ cp -a . %{py3dir}
%endif %endif
%build %build
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build %py2_build
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} pushd %{py3dir}
%py3_build
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd popd
%endif # with_python3 %endif # with_python3
%install %install
rm -rf %{buildroot}
# Must do the python3 install first because the scripts in /usr/bin are # Must do the python3 install first because the scripts in /usr/bin are
# overwritten by setup.py install (and we want the python2 version to be the # overwritten by setup.py install (and we want the python2 version to be the
# default for now). # default for now).
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot} %py3_install
# docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib. # docutils setup.py runs 2to3 on a copy of the tests and puts it in sitelib.
rm -rf %{buildroot}%{python3_sitelib}/test rm -rf %{buildroot}%{python3_sitelib}/test
@ -131,7 +122,7 @@ popd
rm -rf %{buildroot}%{_bindir}/* rm -rf %{buildroot}%{_bindir}/*
%endif # with_python3 %endif # with_python3
%{__python} setup.py install --skip-build --root %{buildroot} %py2_install
for file in %{buildroot}/%{_bindir}/*.py; do for file in %{buildroot}/%{_bindir}/*.py; do
mv $file `dirname $file`/`basename $file .py` mv $file `dirname $file`/`basename $file .py`
@ -156,23 +147,27 @@ rm docs/user/rst/images/biohazard.swf
popd popd
%endif %endif
%clean
rm -rf %{buildroot}
%files -n python2-%{srcname} %files -n python2-%{srcname}
%license COPYING.txt licenses/*
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt %doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
%doc THANKS.txt licenses docs tools/editors %doc THANKS.txt docs tools/editors
%{_bindir}/* %{_bindir}/*
%{python_sitelib}/* %{python2_sitelib}/*
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-%{srcname} %files -n python3-%{srcname}
%doc BUGS.txt COPYING.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt %license COPYING.txt licenses/*
%doc THANKS.txt licenses docs tools/editors %doc BUGS.txt FAQ.txt HISTORY.txt README.txt RELEASE-NOTES.txt
%doc THANKS.txt docs tools/editors
%{python3_sitelib}/* %{python3_sitelib}/*
%endif %endif
%changelog %changelog
* Mon Jan 30 2017 Orion Poplawski <orion@cora.nwra.com> - 0.13.1-3
- Fix broken python-docutils provides (bug #1399655)
- Use %%license, python build macro
- Spec cleanup
* Sun Jan 29 2017 Kevin Fenzi <kevin@scrye.com> - 0.13.1-2 * Sun Jan 29 2017 Kevin Fenzi <kevin@scrye.com> - 0.13.1-2
- Rework packaging to make a python2 package and fix provides - Rework packaging to make a python2 package and fix provides