Make openstackdocstheme an optional doc dependency

stevedore 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: Ic8cc577e617e5da699f9dc43830183005bd2ee66
This commit is contained in:
Thomas Bechtold 2017-08-23 08:30:23 +02:00
parent e3e406b39a
commit f9503f1a30
4 changed files with 23 additions and 3 deletions

View File

@ -14,6 +14,16 @@
import datetime
import subprocess
# make openstackdocstheme an optional dependency. stevedore 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
# documentation root, use os.path.abspath to make it absolute, like shown here.
@ -31,9 +41,10 @@ extensions = [
'sphinx.ext.todo',
'sphinx.ext.graphviz',
'sphinx.ext.extlinks',
'openstackdocstheme',
'stevedore.sphinxext',
]
if has_openstackdocstheme:
extensions.append('openstackdocstheme')
# openstackdocstheme options
repository_name = 'openstack/stevedore'
@ -108,7 +119,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

View File

@ -16,6 +16,14 @@ classifier =
Intended Audience :: Developers
Environment :: Console
[extras]
docs =
# make openstackdocstheme an optional dependency. stevedore 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

@ -7,5 +7,4 @@ sphinx>=1.6.2 # BSD
mock>=2.0.0 # BSD
coverage!=4.4,>=4.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
openstackdocstheme>=1.16.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0

View File

@ -10,6 +10,7 @@ setenv =
install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
deps =
-r{toxinidir}/test-requirements.txt
.[docs]
distribute = False
commands = python setup.py testr --testr-args='{posargs}'