14
0

- only emit rst2html5 alternatives for python 3

- switch the "docutils" provides to the python 3 package (all the comands live ther)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-docutils?expand=0&rev=42
This commit is contained in:
Jan Matejek
2017-06-08 10:30:51 +00:00
committed by Git OBS Bridge
parent e62867ea5f
commit f3a5c9d375
2 changed files with 17 additions and 7 deletions

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"
@@ -69,12 +69,16 @@ mv %{buildroot}%{_bindir}/rst2html5 %{buildroot}%{_bindir}/rst2html5-docutils
ln -s -f %{_sysconfdir}/alternatives/rst2html5 %{buildroot}%{_bindir}/rst2html5
%post
%ifpython3
update-alternatives --install %{_bindir}/rst2html5 rst2html5 %{_bindir}/rst2html5-docutils 15
%endif
%preun
%postun
%ifpython3
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"]))'