[ovs-dev] [PATCH] doc: Use ovs theme

Stephen Finucane stephen at that.guru
Tue Jan 3 21:33:05 UTC 2017


The recently published 'ovs' theme [1] copies the styling of the Open
vSwitch website. Start using this, with fallbacks for users who do not
have the package installed.

This extends support for building docs to users of Sphinx 1.2 as the
previous theme - bizstyle - was only available in 1.3+.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 Documentation/conf.py          | 20 ++++++++++++++++----
 Documentation/requirements.txt |  3 ++-
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Documentation/conf.py b/Documentation/conf.py
index 63f5877..c0b68c1 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -19,12 +19,18 @@
 # import os
 # import sys
 # sys.path.insert(0, os.path.abspath('.'))
+try:
+    import ovs_sphinx_theme
+    use_ovs_theme = True
+except ImportError:
+    print("Cannot find 'ovs_sphinx' package. Falling back to default theme.")
+    use_ovs_theme = False
 
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
 #
-# needs_sphinx = '1.0'
+needs_sphinx = '1.2'
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -102,7 +108,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
 # show_authors = False
 
 # The name of the Pygments (syntax highlighting) style to use.
-pygments_style = 'sphinx'
+# pygments_style = 'friendly'
 
 # A list of ignored prefixes for module index sorting.
 # modindex_common_prefix = []
@@ -119,7 +125,10 @@ todo_include_todos = False
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-html_theme = 'bizstyle'
+if use_ovs_theme:
+    html_theme = 'ovs'
+else:
+    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
@@ -128,7 +137,10 @@ html_theme = 'bizstyle'
 # html_theme_options = {}
 
 # Add any paths that contain custom themes here, relative to this directory.
-# html_theme_path = []
+if use_ovs_theme:
+    html_theme_path = [ovs_sphinx_theme.get_theme_dir()]
+else:
+    html_theme_path = []
 
 # The name for this set of Sphinx documents.
 # "<project> v<release> documentation" by default.
diff --git a/Documentation/requirements.txt b/Documentation/requirements.txt
index 354d3d0..fcc02fd 100644
--- a/Documentation/requirements.txt
+++ b/Documentation/requirements.txt
@@ -1 +1,2 @@
-sphinx>=1.3
+sphinx>=1.2,<2.0
+ovs_sphinx_theme>=1.0,<1.1
-- 
2.9.3



More information about the dev mailing list