#
+# Conditional build:
+%bcond_without python2 # CPython 2.x version
+%bcond_without python3 # CPython 3.x version
+%bcond_without tests # unit tests
+
Summary: Documentation Utilities
Summary(pl.UTF-8): Narzędzia do tworzenia dokumentacji
Name: docutils
-Version: 0.7
+Version: 0.15
Release: 1
-License: Public Domain, BSD, GPL (see COPYING.txt)
+License: Public Domain, BSD, GPL v3 (see COPYING.txt)
Group: Development/Tools
-Source0: http://dl.sourceforge.net/docutils/%{name}-%{version}.tar.gz
-# Source0-md5: 9aec716baf15d06b5aa57cf8d5591c15
+Source0: http://downloads.sourceforge.net/docutils/%{name}-%{version}.tar.gz
+# Source0-md5: f51729f19e70a9dc4837433193a5e798
URL: http://docutils.sourceforge.net/
-BuildRequires: python-devel
+%if %{with python2}
+BuildRequires: python-devel >= 1:2.6
+%endif
+%if %{with python3}
+BuildRequires: python3-2to3 >= 1:3.4
+BuildRequires: python3-devel >= 1:3.4
+%endif
BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.219
+BuildRequires: rpmbuild(macros) >= 1.714
Requires: python-%{name} = %{version}-%{release}
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
markup language.
%description -l pl.UTF-8
-Narzędzia do ogólnego i specjalnego dokumentowania, włączając
-autodokumentację modułów pythona. Zawiera reStructuredText, łatwy do
-odczytania, łatwy w użyciu, WYSIWYG język opisu tekstu.
+Narzędzia do dokumentowania ogólnego i specjalnego zastosowania, w tym
+autodokumentacji modułów Pythona. Zawierają reStructuredText - łatwy
+do odczytania, łatwy w użyciu język opisu tekstu typu WYSIWYG.
%package -n python-%{name}
-Summary: Text documents processing modules for Python
-Summary(pl.UTF-8): Moduły Pythona do przetwarzania dokumentów tekstowych
+Summary: Text documents processing modules for Python 2.x
+Summary(pl.UTF-8): Moduły Pythona 2.x do przetwarzania dokumentów tekstowych
Group: Development/Languages/Python
%pyrequires_eq python-libs
%description -n python-%{name}
Docutils are utilities for general- and special-purpose documentation,
-including autodocumentation of Python modules. Includes reStructuredText, the
-easy to read, easy to use, what-you-see-is-what-you-get plaintext markup
-language.
+including autodocumentation of Python modules. Includes
+reStructuredText, the easy to read, easy to use,
+what-you-see-is-what-you-get plaintext markup language.
-This package provides the Docutils python modules.
+This package provides the Docutils modules for Python 2.
%description -n python-%{name} -l pl.UTF-8
-Docutils to narzędzia do ogólnego i specjalnego dokumentowania, włączając
-autodokumentację modułów pythona. Zawiera reStructuredText, łatwy do
-odczytania, łatwy w użyciu, WYSIWYG język opisu tekstu.
+Narzędzia do dokumentowania ogólnego i specjalnego zastosowania, w tym
+autodokumentacji modułów Pythona. Zawierają reStructuredText - łatwy
+do odczytania, łatwy w użyciu język opisu tekstu typu WYSIWYG.
+
+Ten pakiet dostarcza moduły Docutils dla Pythona 2.
+
+%package 3
+Summary: Documentation Utilities for Python 3.x
+Summary(pl.UTF-8): Narzędzia do tworzenia dokumentacji dla Pythona 3.x
+Group: Development/Tools
+Requires: python3-%{name} = %{version}-%{release}
+
+%description 3
+Utilities for general- and special-purpose documentation, including
+autodocumentation of Python modules. Includes reStructuredText, the
+easy to read, easy to use, what-you-see-is-what-you-get plaintext
+markup language.
+
+This package provides the Docutils for Python 3.
+
+%description 3 -l pl.UTF-8
+Narzędzia do dokumentowania ogólnego i specjalnego zastosowania, w tym
+autodokumentacji modułów Pythona. Zawierają reStructuredText - łatwy
+do odczytania, łatwy w użyciu język opisu tekstu typu WYSIWYG.
+
+Ten pakiet zawiera Docutils dla Pythona 3.
+
+%package -n python3-%{name}
+Summary: Text documents processing modules for Python 3.x
+Summary(pl.UTF-8): Moduły Pythona 3.x do przetwarzania dokumentów tekstowych
+Group: Development/Languages/Python
+
+%description -n python3-%{name}
+Docutils are utilities for general- and special-purpose documentation,
+including autodocumentation of Python modules. Includes
+reStructuredText, the easy to read, easy to use,
+what-you-see-is-what-you-get plaintext markup language.
+
+This package provides the Docutils modules for Python 3.
-Ten pakiet dostarcza modułów pythona Docutils.
+%description -n python3-%{name} -l pl.UTF-8
+Narzędzia do dokumentowania ogólnego i specjalnego zastosowania, w tym
+autodokumentacji modułów Pythona. Zawierają reStructuredText - łatwy
+do odczytania, łatwy w użyciu język opisu tekstu typu WYSIWYG.
+
+Ten pakiet dostarcza moduły Docutils dla Pythona 3.
%prep
%setup -q
%build
-python setup.py config
-python setup.py build
+%if %{with python2}
+%{__python} setup.py config build -b build-2
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/build-2/lib \
+%{__python} test/alltests.py
+%endif
+%endif
+
+%if %{with python3}
+%{__python3} setup.py config build -b build-3
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/build-3/lib \
+%{__python3} test3/alltests.py
+%endif
+%endif
%install
rm -rf $RPM_BUILD_ROOT
-python setup.py install \
- --optimize=2 \
- --root=$RPM_BUILD_ROOT
+%if %{with python2}
+%py_install
for f in $RPM_BUILD_ROOT%{_bindir}/*.py ; do
- mv "${f}" "${f%.py}"
+ %{__mv} "${f}" "${f%.py}"
done
-install extras/roman.py $RPM_BUILD_ROOT%{py_sitescriptdir}
-
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+
+for f in $RPM_BUILD_ROOT%{_bindir}/*.py ; do
+ %{__mv} "${f}" "${f%.py}-3"
+done
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
+%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc PKG-INFO *.txt docs
-%attr(755,root,root) %{_bindir}/*
+%attr(755,root,root) %{_bindir}/rst2html
+%attr(755,root,root) %{_bindir}/rst2html4
+%attr(755,root,root) %{_bindir}/rst2html5
+%attr(755,root,root) %{_bindir}/rst2latex
+%attr(755,root,root) %{_bindir}/rst2man
+%attr(755,root,root) %{_bindir}/rst2odt
+%attr(755,root,root) %{_bindir}/rst2odt_prepstyles
+%attr(755,root,root) %{_bindir}/rst2pseudoxml
+%attr(755,root,root) %{_bindir}/rst2s5
+%attr(755,root,root) %{_bindir}/rst2xetex
+%attr(755,root,root) %{_bindir}/rst2xml
+%attr(755,root,root) %{_bindir}/rstpep2html
%files -n python-%{name}
%defattr(644,root,root,755)
-%{py_sitescriptdir}/*.py[oc]
-%{py_sitescriptdir}/%{name}
-%{py_sitescriptdir}/%{name}*.egg-info
+%doc BUGS.txt COPYING.txt README.txt RELEASE-NOTES.txt THANKS.txt docs
+%{py_sitescriptdir}/docutils
+%{py_sitescriptdir}/docutils-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files 3
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/rst*-3
+
+%files -n python3-%{name}
+%defattr(644,root,root,755)
+%doc BUGS.txt COPYING.txt README.txt RELEASE-NOTES.txt THANKS.txt docs
+%{py3_sitescriptdir}/docutils
+%{py3_sitescriptdir}/docutils-%{version}-py*.egg-info
+%endif