Author: Manuel Jacob
Branch: improve-docs
Changeset: r72508:8e884ef6d1d1
Date: 2014-07-26 15:17 +0200
http://bitbucket.org/pypy/pypy/changeset/8e884ef6d1d1/

Log:    RPython docs: Use read the docs theme locally if available (copied
        from PyPy docs configuration).

diff --git a/rpython/doc/conf.py b/rpython/doc/conf.py
--- a/rpython/doc/conf.py
+++ b/rpython/doc/conf.py
@@ -18,6 +18,24 @@
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #sys.path.insert(0, os.path.abspath('.'))
 
+
+# -- Read The Docs theme config 
------------------------------------------------
+
+# on_rtd is whether we are on readthedocs.org, this line of code grabbed from 
docs.readthedocs.org
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+
+if not on_rtd:  # only import and set the theme if we're building docs locally
+    try:
+        import sphinx_rtd_theme
+        html_theme = 'sphinx_rtd_theme'
+        html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+    except ImportError:
+        print('sphinx_rtd_theme is not installed')
+        html_theme = 'default'
+
+# otherwise, readthedocs.org uses their theme by default, so no need to 
specify it
+
+
 # -- General configuration 
-----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
@@ -91,7 +109,7 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+#html_theme = 'default'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to