Support Sphinx >=1.3 new protoype and warnings

Sphinx >= 1.3 changes:
- Prototypes for init_values() requires a handle to warnings.warn
- New warning for setting the html_theme in conf.py to 'default':
   sphinx.errors.SphinxWarning: WARNING: 'default' html theme has been
   renamed to 'classic'. Please change your html_theme setting either
   to the new 'alabaster' default theme, or to 'classic' to keep using
   the old default.

This change deals with the above sphinx updates by adding the handle to
init_values() and setting pbr to _not_ fail on warnings when building the
docs.

Change-Id: Iba92628263e20efca84aeada0e19000f4c9b1fac
This commit is contained in:
Timothy Chavez 2015-04-07 12:31:55 -05:00 committed by Khai Do
parent 1e4d883684
commit e19572e2d1
1 changed files with 9 additions and 2 deletions

View File

@ -17,7 +17,9 @@
from distutils import log from distutils import log
import fnmatch import fnmatch
import os import os
import pkg_resources
import sys import sys
import warnings
try: try:
import cStringIO import cStringIO
@ -130,14 +132,19 @@ class LocalBuildDoc(setup_command.BuildDoc):
if self.today: if self.today:
confoverrides['today'] = self.today confoverrides['today'] = self.today
sphinx_config = config.Config(self.config_dir, 'conf.py', {}, []) sphinx_config = config.Config(self.config_dir, 'conf.py', {}, [])
sphinx_config.init_values() sphinx_ver = pkg_resources.get_distribution("sphinx").version
if pkg_resources.parse_version(sphinx_ver) >= \
pkg_resources.parse_version('1.3.1'):
sphinx_config.init_values(warnings.warn)
else:
sphinx_config.init_values()
if self.builder == 'man' and len(sphinx_config.man_pages) == 0: if self.builder == 'man' and len(sphinx_config.man_pages) == 0:
return return
app = application.Sphinx( app = application.Sphinx(
self.source_dir, self.config_dir, self.source_dir, self.config_dir,
self.builder_target_dir, self.doctree_dir, self.builder_target_dir, self.doctree_dir,
self.builder, confoverrides, status_stream, self.builder, confoverrides, status_stream,
freshenv=self.fresh_env, warningiserror=True) freshenv=self.fresh_env, warningiserror=False)
try: try:
app.build(force_all=self.all_files) app.build(force_all=self.all_files)