• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Sphinx Read the Docs theme.
3
4From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
5"""
6
7from os import path
8
9import sphinx
10
11
12__version__ = '0.5.0'
13__version_full__ = __version__
14
15
16def get_html_theme_path():
17    """Return list of HTML theme paths."""
18    cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
19    return cur_dir
20
21
22# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
23def setup(app):
24    if sphinx.version_info >= (1, 6, 0):
25        # Register the theme that can be referenced without adding a theme path
26        app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
27
28    if sphinx.version_info >= (1, 8, 0):
29        # Add Sphinx message catalog for newer versions of Sphinx
30        # See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
31        rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
32        app.add_message_catalog('sphinx', rtd_locale_path)
33
34    return {'parallel_read_safe': True, 'parallel_write_safe': True}
35