1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 DISTUTILS_USE_SETUPTOOLS=rdepend
7 PYTHON_COMPAT=( python3_{6,7,8} pypy3 )
8 PYTHON_REQ_USE="threads(+)"
12 DESCRIPTION="Python documentation generator"
13 HOMEPAGE="https://www.sphinx-doc.org/
14 https://github.com/sphinx-doc/sphinx"
15 SRC_URI="mirror://pypi/S/${PN^}/${P^}.tar.gz"
19 KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris"
21 RESTRICT="!test? ( test )"
24 <dev-python/alabaster-0.8[${PYTHON_USEDEP}]
25 dev-python/Babel[${PYTHON_USEDEP}]
26 dev-python/docutils[${PYTHON_USEDEP}]
27 dev-python/imagesize[${PYTHON_USEDEP}]
28 dev-python/jinja[${PYTHON_USEDEP}]
29 dev-python/pygments[${PYTHON_USEDEP}]
30 dev-python/requests[${PYTHON_USEDEP}]
31 dev-python/snowballstemmer[${PYTHON_USEDEP}]
32 dev-python/sphinxcontrib-applehelp[${PYTHON_USEDEP}]
33 dev-python/sphinxcontrib-devhelp[${PYTHON_USEDEP}]
34 dev-python/sphinxcontrib-jsmath[${PYTHON_USEDEP}]
35 dev-python/sphinxcontrib-htmlhelp[${PYTHON_USEDEP}]
36 dev-python/sphinxcontrib-serializinghtml[${PYTHON_USEDEP}]
37 dev-python/sphinxcontrib-qthelp[${PYTHON_USEDEP}]
38 dev-python/packaging[${PYTHON_USEDEP}]
39 $(python_gen_cond_dep '
40 dev-python/typed-ast[${PYTHON_USEDEP}]
43 dev-texlive/texlive-latexextra
44 dev-texlive/texlive-luatex
48 dev-python/setuptools[${PYTHON_USEDEP}]
50 dev-python/sphinxcontrib-websupport[${PYTHON_USEDEP}]
54 dev-python/html5lib[${PYTHON_USEDEP}]
55 dev-python/pytest[${PYTHON_USEDEP}]
56 virtual/imagemagick-tools[jpeg,png,svg]
57 dev-texlive/texlive-fontsextra
58 dev-texlive/texlive-latexextra
59 dev-texlive/texlive-luatex
65 python_prepare_all() {
66 # remove tests that fail due to network-sandbox
67 rm tests/test_build_linkcheck.py || die "Failed to remove web tests"
68 sed -i -e 's:test_latex_images:_&:' tests/test_build_latex.py || die
70 # fail under pypy3 (some because of missing typed-ast)
71 # revisit when pypy3 becomes pypy3.8
72 sed -i -e '/def test_partialfunction/i\
73 @pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="broken on pypy3")' \
74 -e '/def test_autodoc_typed_instance_variables/i\
75 @pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="broken on pypy3")' \
76 tests/test_autodoc.py || die
77 sed -i -e '11aimport sys' \
78 -e '/def test_autodoc_typehints_signature/i\
79 @pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="broken on pypy3")' \
80 tests/test_ext_autodoc_configs.py || die
81 sed -i -e '/def test_annotated_assignment_py36/i\
82 @pytest.mark.skipif(hasattr(sys, "pypy_version_info"), reason="broken on pypy3")' \
83 tests/test_pycode_parser.py || die
85 distutils-r1_python_prepare_all
89 distutils-r1_python_compile
91 # Generate the grammar. It will be caught by install somehow.
92 # Note that the tests usually do it for us. However, I don't want
93 # to trust USE=test really running all the tests, especially
94 # with FEATURES=test-fail-continue.
95 pushd "${BUILD_DIR}"/lib >/dev/null || die
96 "${EPYTHON}" -m sphinx.pycode.__init__ || die "Grammar generation failed."
97 popd >/dev/null || die
100 python_compile_all() {
102 esetup.py build_sphinx
103 HTML_DOCS=( "${BUILD_DIR}"/sphinx/html/. )
108 mkdir -p "${BUILD_DIR}/sphinx_tempdir" || die
109 local -x SPHINX_TEST_TEMPDIR="${BUILD_DIR}/sphinx_tempdir"
110 pytest -vv || die "Tests fail with ${EPYTHON}"