Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/recommonmark/files/, dev-python/recommonmark/
Date: Sat, 06 Feb 2021 22:34:14
Message-Id: 1612650812.0c50d11118861065aabb2d61767cd89832babef2.sam@gentoo
1 commit: 0c50d11118861065aabb2d61767cd89832babef2
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 6 22:33:21 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 6 22:33:32 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c50d111
7
8 dev-python/recommonmark: fix tests with Sphinx 3
9
10 Thanks-to: Anon Emuss <abuslbea <AT> centurylink.net>
11 Bug: https://bugs.gentoo.org/769140
12 Bug: https://bugs.gentoo.org/720014
13 Closes: https://bugs.gentoo.org/723468
14 Package-Manager: Portage-3.0.14, Repoman-3.0.2
15 Signed-off-by: Sam James <sam <AT> gentoo.org>
16
17 .../files/recommonmark-0.6.0-sphinx3-1.patch | 122 +++++++++++++++++++++
18 .../files/recommonmark-0.6.0-sphinx3-2.patch | 63 +++++++++++
19 .../recommonmark/recommonmark-0.6.0-r1.ebuild | 30 +++++
20 3 files changed, 215 insertions(+)
21
22 diff --git a/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-1.patch b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-1.patch
23 new file mode 100644
24 index 00000000000..f628630c200
25 --- /dev/null
26 +++ b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-1.patch
27 @@ -0,0 +1,122 @@
28 +https://bugs.gentoo.org/723468#c4
29 +By Anon Emuss <abuslbea@×××××××××××.net>
30 +----
31 +Update tests for sphinx-3
32 +
33 +The deprecated source_parsers no longer works with sphinx-3. Modify
34 +conf.py files to use the recommonmark extension, which sphinx supports.
35 +
36 +Tested and appears to work with sphinx-2.4.4 and sphinx-3.2.1.
37 +
38 +diff --git a/tests/sphinx_code_block/conf.py b/tests/sphinx_code_block/conf.py
39 +index 6b0140e..ddfafd5 100644
40 +--- a/tests/sphinx_code_block/conf.py
41 ++++ b/tests/sphinx_code_block/conf.py
42 +@@ -1,11 +1,9 @@
43 +
44 + # -*- coding: utf-8 -*-
45 +
46 +-from recommonmark.parser import CommonMarkParser
47 +-
48 + templates_path = ['_templates']
49 +-source_suffix = '.md'
50 +-source_parsers = { '.md': CommonMarkParser }
51 ++extensions = ['recommonmark']
52 ++source_suffix = { '.md': 'markdown' }
53 + master_doc = 'index'
54 + project = u'sphinxproj'
55 + copyright = u'2015, rtfd'
56 +diff --git a/tests/sphinx_custom_md/conf.py b/tests/sphinx_custom_md/conf.py
57 +index b29157b..9073346 100644
58 +--- a/tests/sphinx_custom_md/conf.py
59 ++++ b/tests/sphinx_custom_md/conf.py
60 +@@ -1,12 +1,11 @@
61 +
62 + # -*- coding: utf-8 -*-
63 +
64 +-from recommonmark.parser import CommonMarkParser
65 + from recommonmark.transform import AutoStructify
66 +
67 + templates_path = ['_templates']
68 +-source_suffix = '.markdown'
69 +-source_parsers = { '.markdown': CommonMarkParser }
70 ++extensions = ['recommonmark']
71 ++source_suffix = { '.markdown': 'markdown' }
72 + master_doc = 'index'
73 + project = u'sphinxproj'
74 + copyright = u'2015, rtfd'
75 +diff --git a/tests/sphinx_generic/conf.py b/tests/sphinx_generic/conf.py
76 +index 6b0140e..ddfafd5 100644
77 +--- a/tests/sphinx_generic/conf.py
78 ++++ b/tests/sphinx_generic/conf.py
79 +@@ -1,11 +1,9 @@
80 +
81 + # -*- coding: utf-8 -*-
82 +
83 +-from recommonmark.parser import CommonMarkParser
84 +-
85 + templates_path = ['_templates']
86 +-source_suffix = '.md'
87 +-source_parsers = { '.md': CommonMarkParser }
88 ++extensions = ['recommonmark']
89 ++source_suffix = { '.md': 'markdown' }
90 + master_doc = 'index'
91 + project = u'sphinxproj'
92 + copyright = u'2015, rtfd'
93 +diff --git a/tests/sphinx_indented_code/conf.py b/tests/sphinx_indented_code/conf.py
94 +index f441071..90c5692 100644
95 +--- a/tests/sphinx_indented_code/conf.py
96 ++++ b/tests/sphinx_indented_code/conf.py
97 +@@ -1,11 +1,9 @@
98 +
99 + # -*- coding: utf-8 -*-
100 +
101 +-from recommonmark.parser import CommonMarkParser
102 +-
103 + templates_path = ['_templates']
104 +-source_suffix = '.md'
105 +-source_parsers = { '.md': CommonMarkParser }
106 ++extensions = ['recommonmark']
107 ++source_suffix = { '.md': 'markdown' }
108 + master_doc = 'index'
109 + project = u'sphinxproj'
110 + copyright = u'2015, rtfd'
111 +diff --git a/tests/sphinx_nested_header_block/conf.py b/tests/sphinx_nested_header_block/conf.py
112 +index 6b0140e..ddfafd5 100644
113 +--- a/tests/sphinx_nested_header_block/conf.py
114 ++++ b/tests/sphinx_nested_header_block/conf.py
115 +@@ -1,11 +1,9 @@
116 +
117 + # -*- coding: utf-8 -*-
118 +
119 +-from recommonmark.parser import CommonMarkParser
120 +-
121 + templates_path = ['_templates']
122 +-source_suffix = '.md'
123 +-source_parsers = { '.md': CommonMarkParser }
124 ++extensions = ['recommonmark']
125 ++source_suffix = { '.md': 'markdown' }
126 + master_doc = 'index'
127 + project = u'sphinxproj'
128 + copyright = u'2015, rtfd'
129 +diff --git a/tests/sphinx_xref/conf.py b/tests/sphinx_xref/conf.py
130 +index 443a026..acd840b 100644
131 +--- a/tests/sphinx_xref/conf.py
132 ++++ b/tests/sphinx_xref/conf.py
133 +@@ -1,14 +1,11 @@
134 +
135 + # -*- coding: utf-8 -*-
136 +
137 +-from recommonmark.parser import CommonMarkParser
138 +-
139 +-extensions = 'sphinx.ext.autosectionlabel']
140 ++extensions = ['sphinx.ext.autosectionlabel', 'recommonmark']
141 + autosectionlabel_prefix_document = True
142 +
143 + templates_path = ['_templates']
144 +-source_suffix = '.md'
145 +-source_parsers = { '.md': CommonMarkParser }
146 ++source_suffix = { '.md': 'markdown' }
147 + master_doc = 'index'
148 + project = u'sphinxproj'
149 + copyright = u'2015, rtfd'
150
151 diff --git a/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-2.patch b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-2.patch
152 new file mode 100644
153 index 00000000000..75d9b1c961c
154 --- /dev/null
155 +++ b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-2.patch
156 @@ -0,0 +1,63 @@
157 +https://bugs.gentoo.org/723468#c5
158 +By Anon Emuss <abuslbea@×××××××××××.net>
159 +----
160 +Fix minor HTML changes in tests
161 +
162 +Newer versions of sphinx now put <p> tags around various elements.
163 +Update the test_lists and CustomExtensionTests tests to expect that.
164 +Also do not expect a class="first" for the Contents in the
165 +CustomExtensionTests.
166 +
167 +Tested and appears to work with sphinx-2.4.4 and sphinx-3.2.1.
168 +
169 +diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py
170 +index 06078b1..8f4acb2 100644
171 +--- a/tests/test_sphinx.py
172 ++++ b/tests/test_sphinx.py
173 +@@ -142,17 +142,17 @@ class GenericTests(SphinxIntegrationTests):
174 + output = self.read_file('index.html')
175 + self.assertIn(
176 + ('<ul class="simple">\n'
177 +- '<li>Item A</li>\n'
178 +- '<li>Item B</li>\n'
179 +- '<li>Item C</li>\n'
180 ++ '<li><p>Item A</p></li>\n'
181 ++ '<li><p>Item B</p></li>\n'
182 ++ '<li><p>Item C</p></li>\n'
183 + '</ul>'),
184 + output
185 + )
186 + self.assertIn(
187 + ('<ol class="simple">\n'
188 +- '<li>Item 1</li>\n'
189 +- '<li>Item 2</li>\n'
190 +- '<li>Item 3</li>\n'
191 ++ '<li><p>Item 1</p></li>\n'
192 ++ '<li><p>Item 2</p></li>\n'
193 ++ '<li><p>Item 3</p></li>\n'
194 + '</ol>'),
195 + output
196 + )
197 +@@ -207,16 +207,17 @@ class CustomExtensionTests(SphinxIntegrationTests):
198 + def test_integration(self):
199 + output = self.read_file('index.html')
200 + self.assertIn('<table ', output)
201 +- self.assertIn('<th class="head">abc</th>', output)
202 +- self.assertIn('<th class="head">data</th>', output)
203 ++ self.assertIn('<th class="head"><p>abc</p></th>', output)
204 ++ self.assertIn('<th class="head"><p>data</p></th>', output)
205 + self.assertIn('</table>', output)
206 +
207 + self.assertIn(
208 + ('<div class="contents topic" id="contents">\n'
209 +- '<p class="topic-title first">Contents</p>\n'
210 ++ '<p class="topic-title">Contents</p>\n'
211 + '<ul class="simple">\n'
212 +- '<li><a class="reference internal" href="#header" id="id1">Header</a><ul>\n'
213 +- '<li><a class="reference internal" href="#header-2" id="id2">Header 2</a></li>\n'
214 ++ '<li><p><a class="reference internal" href="#header" id="id1">Header</a></p>\n'
215 ++ '<ul>\n'
216 ++ '<li><p><a class="reference internal" href="#header-2" id="id2">Header 2</a></p></li>\n'
217 + '</ul>\n</li>\n</ul>'),
218 + output
219 + )
220
221 diff --git a/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild b/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild
222 new file mode 100644
223 index 00000000000..e9b2fe6b79c
224 --- /dev/null
225 +++ b/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild
226 @@ -0,0 +1,30 @@
227 +# Copyright 1999-2021 Gentoo Authors
228 +# Distributed under the terms of the GNU General Public License v2
229 +
230 +EAPI=7
231 +
232 +DISTUTILS_USE_SETUPTOOLS=rdepend
233 +PYTHON_COMPAT=( python3_{7,8,9} )
234 +
235 +inherit distutils-r1
236 +
237 +DESCRIPTION="Python docutils-compatibility bridge to CommonMark"
238 +HOMEPAGE="https://recommonmark.readthedocs.io/"
239 +SRC_URI="https://github.com/rtfd/recommonmark/archive/${PV}.tar.gz -> ${P}.tar.gz"
240 +
241 +LICENSE="MIT"
242 +SLOT="0"
243 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
244 +
245 +RDEPEND="
246 + >=dev-python/commonmark-0.8.1[${PYTHON_USEDEP}]
247 + >=dev-python/docutils-0.14[${PYTHON_USEDEP}]
248 + dev-python/sphinx[${PYTHON_USEDEP}]
249 +"
250 +
251 +PATCHES=(
252 + "${FILESDIR}/${PN}-0.6.0-sphinx3-1.patch"
253 + "${FILESDIR}/${PN}-0.6.0-sphinx3-2.patch"
254 +)
255 +
256 +distutils_enable_tests pytest