summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-03-27 16:40:45 +0100
committerMonty Taylor <mordred@inaugust.com>2013-03-27 16:45:30 +0100
commitd0b083d28f3299c163058ea27b47654bd40c5e8a (patch)
tree3d3dcc0a11cf62785b95d2b946a83cb429fcf8b1
parentd539c3d76b80dcdb833240057306e54bc41f8d37 (diff)
downloadpbr-d0b083d28f3299c163058ea27b47654bd40c5e8a.tar.gz
Add support for configuring pbr sphinx options.
Change-Id: Idfdd1c8850433bf3ea2439f939756f5c60bb88a1
-rw-r--r--pbr/packaging.py12
-rw-r--r--setup.cfg3
2 files changed, 9 insertions, 6 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py
index 6d9d114..ed4c73b 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -236,19 +236,16 @@ try:
def __init__(self, *args, **kwargs):
kwargs['warningiserror'] = True
super(LocalSphinx, self).__init__(*args, **kwargs)
- sphinx.application.Sphinx = LocalSphinx
-
class LocalBuildDoc(setup_command.BuildDoc):
command_name = 'build_sphinx'
builders = ['html', 'man']
- def generate_autoindex(self):
+ def generate_autoindex(self, option_dict):
log.info("[pbr] Autodocumenting from %s"
% os.path.abspath(os.curdir))
modules = {}
- option_dict = self.distribution.get_option_dict('build_sphinx')
source_dir = os.path.join(option_dict['source_dir'][1], 'api')
if not os.path.exists(source_dir):
os.makedirs(source_dir)
@@ -278,8 +275,11 @@ try:
autoindex.write(" %s.rst\n" % module)
def run(self):
- if not os.getenv('SPHINX_DEBUG'):
- self.generate_autoindex()
+ option_dict = self.distribution.get_option_dict('build_sphinx')
+ if 'autoindex' in option_dict and not os.getenv('SPHINX_DEBUG'):
+ self.generate_autoindex(option_dict)
+ if 'warnerrors' in option_dict:
+ application.Sphinx = LocalSphinx
for builder in self.builders:
self.builder = builder
diff --git a/setup.cfg b/setup.cfg
index a9b3626..3df1ed3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -23,3 +23,6 @@ packages =
[global]
setup-hooks =
pbr.hooks.setup_hook
+
+[build_sphinx]
+warnerrors = True