Accepting request 501919 from devel:languages:python

- only emit rst2html5 alternatives for python 3
- switch the "docutils" provides to the python 3 package (all the comands live there)
  (this fixes bsc#1039394)

OBS-URL: https://build.opensuse.org/request/show/501919
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-docutils?expand=0&rev=22
This commit is contained in:
Dominique Leuenberger 2017-06-13 14:07:04 +00:00 committed by Git OBS Bridge
commit 109687e8d5
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jun 6 13:31:03 UTC 2017 - jmatejek@suse.com
- only emit rst2html5 alternatives for python 3
- switch the "docutils" provides to the python 3 package (all the comands live there)
(this fixes bsc#1039394)
-------------------------------------------------------------------
Mon May 1 19:33:19 UTC 2017 - toddrme2178@gmail.com

View File

@ -32,13 +32,13 @@ BuildRequires: %{python_module xml}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-xml
%ifpython2
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%ifpython3
Provides: docutils = %{version}
Obsoletes: docutils < %{version}
%endif
Requires(post): update-alternatives
Requires(preun): update-alternatives
BuildArch: noarch
%python_subpackages
%description
@ -47,12 +47,12 @@ such as HTML, XML, and LaTeX. For input Docutils supports reStructuredText, an
easy-to-read, what-you-see-is-what-you-get plaintext markup syntax.
%prep
%setup -n docutils-%{version}
%setup -q -n docutils-%{version}
# Remove useless ".py" ending from executables:
for i in tools/rst*; do mv "$i" "${i/.py}"; done
sed -i "s|'tools/\(rst.*\)\.py'|'tools/\1'|" setup.py
# Remove shebang from non-executable files
for i in {'code_analyzer','error_reporting','punctuation_chars','smartquotes','math/latex2mathml','math/math2html','math/tex2mathml_extern'}; do
for i in {'code_analyzer','error_reporting','punctuation_chars','smartquotes','math/latex2mathml','math/math2html','math/tex2mathml_extern'}; do
sed -i -e "1d" "docutils/utils/$i.py"
done
sed -i -e "1d" "docutils/writers/xetex/__init__.py" "docutils/writers/_html_base.py"
@ -68,13 +68,17 @@ sed -i -e "1d" "docutils/writers/xetex/__init__.py" "docutils/writers/_html_base
mv %{buildroot}%{_bindir}/rst2html5 %{buildroot}%{_bindir}/rst2html5-docutils
ln -s -f %{_sysconfdir}/alternatives/rst2html5 %{buildroot}%{_bindir}/rst2html5
%ifpython3
%post
update-alternatives --install %{_bindir}/rst2html5 rst2html5 %{_bindir}/rst2html5-docutils 15
%endif
%preun
%ifpython3
%postun
if [ ! -f %{_bindir}/rst2html5-docutils ] ; then
update-alternatives --remove rst2html5 %{_bindir}/rst2html5-docutils
fi
%endif
%check
%python_exec -c 'import subprocess; import sys; sys.exit(subprocess.call([sys.executable, "test/alltests.py" if sys.version_info[0] == 2 else "test3/alltests.py"]))'