Accepting request 791944 from devel:languages:python

- Fix the condition to really generate the direct binaries

- Remove %python3_only and use full alternatives.

- Add patch to fix build with pygments 2.4 and newer:
  * pygments25.patch

OBS-URL: https://build.opensuse.org/request/show/791944
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-docutils?expand=0&rev=30
This commit is contained in:
Dominique Leuenberger 2020-04-19 19:48:52 +00:00 committed by Git OBS Bridge
commit b40a97cbb8
3 changed files with 148 additions and 41 deletions

107
pygments25.patch Normal file
View File

@ -0,0 +1,107 @@
Index: docutils/test/test_parsers/test_rst/test_directives/test_code.py
===================================================================
--- docutils/test/test_parsers/test_rst/test_directives/test_code.py (revision 8494)
+++ docutils/test/test_parsers/test_rst/test_directives/test_code.py (revision 8495)
@@ -98,7 +98,7 @@
totest['code-parsing'] = [
["""\
-.. code:: python
+.. code:: python3
:class: testclass
print('hello world') # to stdout
@@ -105,9 +105,9 @@
""",
"""\
<document source="test data">
- <literal_block classes="code python testclass" xml:space="preserve">
+ <literal_block classes="code python3 testclass" xml:space="preserve">
\n\
- <inline classes="keyword">
+ <inline classes="name builtin">
print
<inline classes="punctuation">
(
@@ -120,7 +120,7 @@
# to stdout
"""],
["""\
-.. code:: python
+.. code:: python3
:class: testclass
:name: my_function
:number-lines: 7
@@ -134,7 +134,7 @@
""",
"""\
<document source="test data">
- <literal_block classes="code python testclass" ids="my-function" names="my_function" xml:space="preserve">
+ <literal_block classes="code python3 testclass" ids="my-function" names="my_function" xml:space="preserve">
<inline classes="ln">
7 \n\
<inline classes="keyword">
@@ -167,7 +167,7 @@
<inline classes="ln">
12 \n\
\n\
- <inline classes="keyword">
+ <inline classes="name builtin">
print
<inline classes="punctuation">
(
Index: docutils/test/test_parsers/test_rst/test_directives/test_code_long.py
===================================================================
--- docutils/test/test_parsers/test_rst/test_directives/test_code_long.py (revision 8494)
+++ docutils/test/test_parsers/test_rst/test_directives/test_code_long.py (revision 8495)
@@ -24,7 +24,7 @@
totest['code-parsing-long'] = [
["""\
-.. code:: python
+.. code:: python3
:number-lines: 7
def my_function():
@@ -36,7 +36,7 @@
""",
"""\
<document source="test data">
- <literal_block classes="code python" xml:space="preserve">
+ <literal_block classes="code python3" xml:space="preserve">
<inline classes="ln">
7 \n\
<inline classes="keyword">
@@ -69,7 +69,7 @@
<inline classes="ln">
12 \n\
\n\
- <inline classes="keyword">
+ <inline classes="name builtin">
print
<inline classes="punctuation">
(
Index: docutils/test/test_parsers/test_rst/test_interpreted.py
===================================================================
--- docutils/test/test_parsers/test_rst/test_interpreted.py (revision 8494)
+++ docutils/test/test_parsers/test_rst/test_interpreted.py (revision 8495)
@@ -271,7 +271,7 @@
Custom role based on code role:
.. role:: python(code)
- :language: python
+ :language: python3
:class: testclass
Python code :python:`print("The end")`.
@@ -282,8 +282,8 @@
Custom role based on code role:
<paragraph>
Python code \n\
- <literal classes="code testclass python">
- <inline classes="keyword">
+ <literal classes="code testclass python3">
+ <inline classes="name builtin">
print
<inline classes="punctuation">
(

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Tue Apr 7 09:31:55 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix the condition to really generate the direct binaries
-------------------------------------------------------------------
Mon Apr 6 15:57:17 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Remove %python3_only and use full alternatives.
-------------------------------------------------------------------
Sat Mar 14 09:56:02 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Add patch to fix build with pygments 2.4 and newer:
* pygments25.patch
-------------------------------------------------------------------
Wed Jan 15 10:56:28 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -30,10 +30,10 @@ Version: 0.16
Release: 0
Summary: Python Documentation Utilities
License: Python-2.0 AND BSD-2-Clause AND GPL-2.0-or-later AND GPL-3.0-or-later AND SUSE-Public-Domain
Group: Development/Languages/Python
URL: https://pypi.python.org/pypi/docutils/
Source: https://files.pythonhosted.org/packages/source/d/docutils/docutils-%{version}.tar.gz
Source99: python-docutils-rpmlintrc
Patch0: pygments25.patch
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module xml}
BuildRequires: fdupes
@ -63,6 +63,7 @@ easy-to-read, what-you-see-is-what-you-get plaintext markup syntax.
%prep
%setup -q -n docutils-%{version}
%patch0 -p1
# 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
@ -79,30 +80,9 @@ sed -i -e "1d" "docutils/writers/xetex/__init__.py" "docutils/writers/_html_base
%if !%{with test}
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# To avoid conflicts with the rst2html4 package
mv %{buildroot}%{_bindir}/rst2html4 %{buildroot}%{_bindir}/rst2html4-docutils
ln -s -f %{_sysconfdir}/alternatives/rst2html4 %{buildroot}%{_bindir}/rst2html4
# To avoid conflicts with the rst2html5 package
mv %{buildroot}%{_bindir}/rst2html5 %{buildroot}%{_bindir}/rst2html5-docutils
ln -s -f %{_sysconfdir}/alternatives/rst2html5 %{buildroot}%{_bindir}/rst2html5
%endif
%ifpython3
%post
update-alternatives --install %{_bindir}/rst2html4 rst2html4 %{_bindir}/rst2html4-docutils 15
update-alternatives --install %{_bindir}/rst2html5 rst2html5 %{_bindir}/rst2html5-docutils 15
%endif
%ifpython3
%postun
if [ ! -f %{_bindir}/rst2html4-docutils ] ; then
update-alternatives --remove rst2html4 %{_bindir}/rst2html4-docutils
fi
if [ ! -f %{_bindir}/rst2html5-docutils ] ; then
update-alternatives --remove rst2html5 %{_bindir}/rst2html5-docutils
fi
for binary in rst2html rst2latex rst2man rst2odt rst2odt_prepstyles rst2pseudoxml rst2s5 rst2xetex rst2xml rstpep2html rst2html4 rst2html5 ; do
%python_clone -a %{buildroot}%{_bindir}/$binary
done
%endif
%check
@ -110,26 +90,30 @@ fi
%python_exec test/alltests.py
%endif
%if !%{with test}
%post
%{python_install_alternative rst2html rst2latex rst2man rst2odt rst2odt_prepstyles rst2pseudoxml rst2s5 rst2xetex rst2xml rstpep2html rst2html4 rst2html5}
%postun
%{python_uninstall_alternative rst2html rst2latex rst2man rst2odt rst2odt_prepstyles rst2pseudoxml rst2s5 rst2xetex rst2xml rstpep2html rst2html4 rst2html5}
%endif
%if !%{with test}
%files %{python_files}
%license COPYING.txt licenses/*.txt
%doc FAQ.txt HISTORY.txt README.txt THANKS.txt BUGS.txt docs/*
%python3_only %{_bindir}/rst2html
%python3_only %{_bindir}/rst2latex
%python3_only %{_bindir}/rst2man
%python3_only %{_bindir}/rst2odt
%python3_only %{_bindir}/rst2odt_prepstyles
%python3_only %{_bindir}/rst2pseudoxml
%python3_only %{_bindir}/rst2s5
%python3_only %{_bindir}/rst2xetex
%python3_only %{_bindir}/rst2xml
%python3_only %{_bindir}/rstpep2html
%python3_only %{_bindir}/rst2html4
%python3_only %{_bindir}/rst2html4-docutils
%python3_only %{_bindir}/rst2html5
%python3_only %{_bindir}/rst2html5-docutils
%python3_only %ghost %{_sysconfdir}/alternatives/rst2html4
%python3_only %ghost %{_sysconfdir}/alternatives/rst2html5
%python_alternative %{_bindir}/rst2html
%python_alternative %{_bindir}/rst2latex
%python_alternative %{_bindir}/rst2man
%python_alternative %{_bindir}/rst2odt
%python_alternative %{_bindir}/rst2odt_prepstyles
%python_alternative %{_bindir}/rst2pseudoxml
%python_alternative %{_bindir}/rst2s5
%python_alternative %{_bindir}/rst2xetex
%python_alternative %{_bindir}/rst2xml
%python_alternative %{_bindir}/rstpep2html
%python_alternative %{_bindir}/rst2html4
%python_alternative %{_bindir}/rst2html5
%{python_sitelib}/docutils/
%{python_sitelib}/docutils-%{version}-py%{python_version}.egg-info
%endif