Author: anatoly techtonik <techto...@gmail.com>
Branch: 
Changeset: r71586:07e82d634df6
Date: 2014-04-17 17:08 +0300
http://bitbucket.org/pypy/pypy/changeset/07e82d634df6/

Log:    docs: Use read the docs theme if available

diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -18,6 +18,24 @@
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.append(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 
-----------------------------------------------------
 
 # Add any Sphinx extension module names here, as strings. They can be 
extensions
@@ -91,7 +109,7 @@
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-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
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to