summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-02-06 22:33:21 +0000
committerSam James <sam@gentoo.org>2021-02-06 22:33:32 +0000
commit0c50d11118861065aabb2d61767cd89832babef2 (patch)
tree2085b77151610b5a26df045149e50a242c462811 /dev-python/recommonmark
parentdev-python/lxml: add launchpad bugs-to (diff)
downloadgentoo-0c50d11118861065aabb2d61767cd89832babef2.tar.gz
gentoo-0c50d11118861065aabb2d61767cd89832babef2.tar.bz2
gentoo-0c50d11118861065aabb2d61767cd89832babef2.zip
dev-python/recommonmark: fix tests with Sphinx 3
Thanks-to: Anon Emuss <abuslbea@centurylink.net> Bug: https://bugs.gentoo.org/769140 Bug: https://bugs.gentoo.org/720014 Closes: https://bugs.gentoo.org/723468 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-python/recommonmark')
-rw-r--r--dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-1.patch122
-rw-r--r--dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-2.patch63
-rw-r--r--dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild30
3 files changed, 215 insertions, 0 deletions
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
new file mode 100644
index 000000000000..f628630c2009
--- /dev/null
+++ b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-1.patch
@@ -0,0 +1,122 @@
+https://bugs.gentoo.org/723468#c4
+By Anon Emuss <abuslbea@centurylink.net>
+----
+Update tests for sphinx-3
+
+The deprecated source_parsers no longer works with sphinx-3. Modify
+conf.py files to use the recommonmark extension, which sphinx supports.
+
+Tested and appears to work with sphinx-2.4.4 and sphinx-3.2.1.
+
+diff --git a/tests/sphinx_code_block/conf.py b/tests/sphinx_code_block/conf.py
+index 6b0140e..ddfafd5 100644
+--- a/tests/sphinx_code_block/conf.py
++++ b/tests/sphinx_code_block/conf.py
+@@ -1,11 +1,9 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+-
+ templates_path = ['_templates']
+-source_suffix = '.md'
+-source_parsers = { '.md': CommonMarkParser }
++extensions = ['recommonmark']
++source_suffix = { '.md': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
+diff --git a/tests/sphinx_custom_md/conf.py b/tests/sphinx_custom_md/conf.py
+index b29157b..9073346 100644
+--- a/tests/sphinx_custom_md/conf.py
++++ b/tests/sphinx_custom_md/conf.py
+@@ -1,12 +1,11 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+ from recommonmark.transform import AutoStructify
+
+ templates_path = ['_templates']
+-source_suffix = '.markdown'
+-source_parsers = { '.markdown': CommonMarkParser }
++extensions = ['recommonmark']
++source_suffix = { '.markdown': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
+diff --git a/tests/sphinx_generic/conf.py b/tests/sphinx_generic/conf.py
+index 6b0140e..ddfafd5 100644
+--- a/tests/sphinx_generic/conf.py
++++ b/tests/sphinx_generic/conf.py
+@@ -1,11 +1,9 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+-
+ templates_path = ['_templates']
+-source_suffix = '.md'
+-source_parsers = { '.md': CommonMarkParser }
++extensions = ['recommonmark']
++source_suffix = { '.md': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
+diff --git a/tests/sphinx_indented_code/conf.py b/tests/sphinx_indented_code/conf.py
+index f441071..90c5692 100644
+--- a/tests/sphinx_indented_code/conf.py
++++ b/tests/sphinx_indented_code/conf.py
+@@ -1,11 +1,9 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+-
+ templates_path = ['_templates']
+-source_suffix = '.md'
+-source_parsers = { '.md': CommonMarkParser }
++extensions = ['recommonmark']
++source_suffix = { '.md': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
+diff --git a/tests/sphinx_nested_header_block/conf.py b/tests/sphinx_nested_header_block/conf.py
+index 6b0140e..ddfafd5 100644
+--- a/tests/sphinx_nested_header_block/conf.py
++++ b/tests/sphinx_nested_header_block/conf.py
+@@ -1,11 +1,9 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+-
+ templates_path = ['_templates']
+-source_suffix = '.md'
+-source_parsers = { '.md': CommonMarkParser }
++extensions = ['recommonmark']
++source_suffix = { '.md': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
+diff --git a/tests/sphinx_xref/conf.py b/tests/sphinx_xref/conf.py
+index 443a026..acd840b 100644
+--- a/tests/sphinx_xref/conf.py
++++ b/tests/sphinx_xref/conf.py
+@@ -1,14 +1,11 @@
+
+ # -*- coding: utf-8 -*-
+
+-from recommonmark.parser import CommonMarkParser
+-
+-extensions = 'sphinx.ext.autosectionlabel']
++extensions = ['sphinx.ext.autosectionlabel', 'recommonmark']
+ autosectionlabel_prefix_document = True
+
+ templates_path = ['_templates']
+-source_suffix = '.md'
+-source_parsers = { '.md': CommonMarkParser }
++source_suffix = { '.md': 'markdown' }
+ master_doc = 'index'
+ project = u'sphinxproj'
+ copyright = u'2015, rtfd'
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
new file mode 100644
index 000000000000..75d9b1c961cb
--- /dev/null
+++ b/dev-python/recommonmark/files/recommonmark-0.6.0-sphinx3-2.patch
@@ -0,0 +1,63 @@
+https://bugs.gentoo.org/723468#c5
+By Anon Emuss <abuslbea@centurylink.net>
+----
+Fix minor HTML changes in tests
+
+Newer versions of sphinx now put <p> tags around various elements.
+Update the test_lists and CustomExtensionTests tests to expect that.
+Also do not expect a class="first" for the Contents in the
+CustomExtensionTests.
+
+Tested and appears to work with sphinx-2.4.4 and sphinx-3.2.1.
+
+diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py
+index 06078b1..8f4acb2 100644
+--- a/tests/test_sphinx.py
++++ b/tests/test_sphinx.py
+@@ -142,17 +142,17 @@ class GenericTests(SphinxIntegrationTests):
+ output = self.read_file('index.html')
+ self.assertIn(
+ ('<ul class="simple">\n'
+- '<li>Item A</li>\n'
+- '<li>Item B</li>\n'
+- '<li>Item C</li>\n'
++ '<li><p>Item A</p></li>\n'
++ '<li><p>Item B</p></li>\n'
++ '<li><p>Item C</p></li>\n'
+ '</ul>'),
+ output
+ )
+ self.assertIn(
+ ('<ol class="simple">\n'
+- '<li>Item 1</li>\n'
+- '<li>Item 2</li>\n'
+- '<li>Item 3</li>\n'
++ '<li><p>Item 1</p></li>\n'
++ '<li><p>Item 2</p></li>\n'
++ '<li><p>Item 3</p></li>\n'
+ '</ol>'),
+ output
+ )
+@@ -207,16 +207,17 @@ class CustomExtensionTests(SphinxIntegrationTests):
+ def test_integration(self):
+ output = self.read_file('index.html')
+ self.assertIn('<table ', output)
+- self.assertIn('<th class="head">abc</th>', output)
+- self.assertIn('<th class="head">data</th>', output)
++ self.assertIn('<th class="head"><p>abc</p></th>', output)
++ self.assertIn('<th class="head"><p>data</p></th>', output)
+ self.assertIn('</table>', output)
+
+ self.assertIn(
+ ('<div class="contents topic" id="contents">\n'
+- '<p class="topic-title first">Contents</p>\n'
++ '<p class="topic-title">Contents</p>\n'
+ '<ul class="simple">\n'
+- '<li><a class="reference internal" href="#header" id="id1">Header</a><ul>\n'
+- '<li><a class="reference internal" href="#header-2" id="id2">Header 2</a></li>\n'
++ '<li><p><a class="reference internal" href="#header" id="id1">Header</a></p>\n'
++ '<ul>\n'
++ '<li><p><a class="reference internal" href="#header-2" id="id2">Header 2</a></p></li>\n'
+ '</ul>\n</li>\n</ul>'),
+ output
+ )
diff --git a/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild b/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild
new file mode 100644
index 000000000000..e9b2fe6b79ce
--- /dev/null
+++ b/dev-python/recommonmark/recommonmark-0.6.0-r1.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_SETUPTOOLS=rdepend
+PYTHON_COMPAT=( python3_{7,8,9} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python docutils-compatibility bridge to CommonMark"
+HOMEPAGE="https://recommonmark.readthedocs.io/"
+SRC_URI="https://github.com/rtfd/recommonmark/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ >=dev-python/commonmark-0.8.1[${PYTHON_USEDEP}]
+ >=dev-python/docutils-0.14[${PYTHON_USEDEP}]
+ dev-python/sphinx[${PYTHON_USEDEP}]
+"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.6.0-sphinx3-1.patch"
+ "${FILESDIR}/${PN}-0.6.0-sphinx3-2.patch"
+)
+
+distutils_enable_tests pytest