Make openstackdocstheme an optional doc dependency

cliff is a library that is used outside of OpenStack, too. Having
a build requirement that needs something OpenStack specific makes
life in cases (eg. for downstream packagers) more difficult.
So let's make openstackdocstheme an optional requirement.

Change-Id: I0f94a431be083b8b4baec850b1885ba07b5bf5c2
This commit is contained in:
Thomas Bechtold 2017-08-07 09:28:04 +02:00
parent 8ba1b04086
commit 5c37935139
4 changed files with 23 additions and 5 deletions

View File

@ -15,7 +15,15 @@
import datetime
import subprocess
import openstackdocstheme
# make openstackdocstheme an optional dependency. cliff is a low level lib
# that is used outside of OpenStack. Not having something OpenStack specific
# as build requirement is a good thing.
try:
import openstackdocstheme
except ImportError:
has_openstackdocstheme = False
else:
has_openstackdocstheme = True
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -32,8 +40,9 @@ import openstackdocstheme
# ones.
extensions = [
'sphinx.ext.autodoc',
'openstackdocstheme',
]
if has_openstackdocstheme:
extensions.append('openstackdocstheme')
# openstackdocstheme options
repository_name = 'openstack/cliff'
@ -109,7 +118,8 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'default'
html_theme = 'openstackdocs'
if has_openstackdocstheme:
html_theme = 'openstackdocs'
# 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
@ -118,7 +128,8 @@ html_theme = 'openstackdocs'
# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
html_theme_path = [openstackdocstheme.get_html_theme_path()]
if has_openstackdocstheme:
html_theme_path = [openstackdocstheme.get_html_theme_path()]
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".

View File

@ -16,6 +16,13 @@ classifier =
Intended Audience :: Developers
Environment :: Console
[extras]
docs =
# make openstackdocstheme an optional dependency. cliff is a low level lib
# that is used outside of OpenStack. Not having something OpenStack specific
# as build requirement is a good thing.
openstackdocstheme>=1.16.0 # Apache-2.0
[global]
setup-hooks =
pbr.hooks.setup_hook

View File

@ -12,4 +12,3 @@ coverage!=4.4,>=4.0 # Apache-2.0
# this is required for the docs build jobs
sphinx>=1.6.2 # BSD
openstackdocstheme>=1.16.0 # Apache-2.0

View File

@ -15,6 +15,7 @@ commands =
python setup.py test --coverage --coverage-package-name=cliff --slowest --testr-args='{posargs}'
coverage report --show-missing
deps = -r{toxinidir}/test-requirements.txt
.[docs]
[testenv:pep8]
deps = flake8