remove warnings from using deprecated methods of Sphinx application
Use the sphinx wrapper around logging instead of app.info(). Add a -v option to sphinx-build to see the output. Change-Id: Ia698929c252a2a19da812e399011341a41976540 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
0d86361c37
commit
7d3fc1b7a1
@ -7,8 +7,11 @@ from docutils.io import FileOutput
|
|||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.parsers import rst
|
from docutils.parsers import rst
|
||||||
import icalendar
|
import icalendar
|
||||||
|
from sphinx.util import logging
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PendingICS(nodes.Element):
|
class PendingICS(nodes.Element):
|
||||||
|
|
||||||
@ -87,7 +90,7 @@ def doctree_resolved(app, doctree, docname):
|
|||||||
series_name = node._series_name
|
series_name = node._series_name
|
||||||
data = node._data
|
data = node._data
|
||||||
|
|
||||||
app.info('building {} calendar'.format(series_name))
|
LOG.info('building {} calendar'.format(series_name))
|
||||||
|
|
||||||
cal = icalendar.Calendar()
|
cal = icalendar.Calendar()
|
||||||
cal.add('prodid', '-//releases.openstack.org//EN')
|
cal.add('prodid', '-//releases.openstack.org//EN')
|
||||||
@ -111,7 +114,7 @@ def doctree_resolved(app, doctree, docname):
|
|||||||
# ugly, but given the complexity of the expression
|
# ugly, but given the complexity of the expression
|
||||||
# above there are a bunch of ways things might
|
# above there are a bunch of ways things might
|
||||||
# fail.
|
# fail.
|
||||||
app.info('could not get title for {}: {}'.format(item, e))
|
LOG.info('could not get title for {}: {}'.format(item, e))
|
||||||
title = item
|
title = item
|
||||||
summary.append(title)
|
summary.append(title)
|
||||||
if summary:
|
if summary:
|
||||||
@ -159,7 +162,7 @@ def doctree_resolved(app, doctree, docname):
|
|||||||
destination_path=output_full_name,
|
destination_path=output_full_name,
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
)
|
)
|
||||||
app.info('generating {}'.format(output_full_name))
|
LOG.info('generating {}'.format(output_full_name))
|
||||||
destination.write(cal.to_ical())
|
destination.write(cal.to_ical())
|
||||||
|
|
||||||
# Remove the node that the writer won't understand.
|
# Remove the node that the writer won't understand.
|
||||||
@ -181,12 +184,12 @@ def build_finished(app, exception):
|
|||||||
destination_path=output_full_name,
|
destination_path=output_full_name,
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
)
|
)
|
||||||
app.info('generating {}'.format(output_full_name))
|
LOG.info('generating {}'.format(output_full_name))
|
||||||
destination.write(_global_calendar.to_ical())
|
destination.write(_global_calendar.to_ical())
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.info('initializing ICS extension')
|
LOG.info('initializing ICS extension')
|
||||||
app.add_directive('ics', ICS)
|
app.add_directive('ics', ICS)
|
||||||
app.connect('doctree-resolved', doctree_resolved)
|
app.connect('doctree-resolved', doctree_resolved)
|
||||||
app.connect('build-finished', build_finished)
|
app.connect('build-finished', build_finished)
|
||||||
|
@ -4,6 +4,10 @@ import datetime
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from sphinx.util import logging
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# 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
|
# 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.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
@ -90,5 +94,5 @@ def builder_inited(app):
|
|||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
app.info('initializing from conf.py')
|
LOG.info('initializing from conf.py')
|
||||||
app.connect('builder-inited', builder_inited)
|
app.connect('builder-inited', builder_inited)
|
||||||
|
@ -21,6 +21,7 @@ from docutils import nodes
|
|||||||
from docutils.parsers import rst
|
from docutils.parsers import rst
|
||||||
from docutils.parsers.rst import directives
|
from docutils.parsers.rst import directives
|
||||||
from docutils.statemachine import ViewList
|
from docutils.statemachine import ViewList
|
||||||
|
from sphinx.util import logging
|
||||||
from sphinx.util.nodes import nested_parse_with_titles
|
from sphinx.util.nodes import nested_parse_with_titles
|
||||||
|
|
||||||
from openstack_releases import deliverable
|
from openstack_releases import deliverable
|
||||||
@ -28,6 +29,7 @@ from openstack_releases import governance
|
|||||||
from openstack_releases import links
|
from openstack_releases import links
|
||||||
from openstack_releases import series_status
|
from openstack_releases import series_status
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
_TEAM_DATA = governance.get_team_data()
|
_TEAM_DATA = governance.get_team_data()
|
||||||
_PHASE_DOC_URL = 'https://docs.openstack.org/project-team-guide/stable-branches.html#maintenance-phases' # noqa
|
_PHASE_DOC_URL = 'https://docs.openstack.org/project-team-guide/stable-branches.html#maintenance-phases' # noqa
|
||||||
@ -73,9 +75,11 @@ def _get_category(deliv):
|
|||||||
_deliverables = None
|
_deliverables = None
|
||||||
|
|
||||||
|
|
||||||
def _initialize_deliverable_data(app):
|
def _initialize_deliverable_data():
|
||||||
global _deliverables
|
global _deliverables
|
||||||
|
|
||||||
|
LOG.info('Loading deliverable data...')
|
||||||
|
|
||||||
series_status_data = series_status.SeriesStatus.from_directory(
|
series_status_data = series_status.SeriesStatus.from_directory(
|
||||||
'deliverables')
|
'deliverables')
|
||||||
deliverable.Deliverable.init_series_status_data(series_status_data)
|
deliverable.Deliverable.init_series_status_data(series_status_data)
|
||||||
@ -100,9 +104,6 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
env = self.state.document.settings.env
|
|
||||||
app = env.app
|
|
||||||
|
|
||||||
# The series value is optional for some directives. If it is
|
# The series value is optional for some directives. If it is
|
||||||
# present but an empty string, convert to None so the
|
# present but an empty string, convert to None so the
|
||||||
# Deliverables class will treat it like a wildcard.
|
# Deliverables class will treat it like a wildcard.
|
||||||
@ -131,7 +132,6 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
None,
|
None,
|
||||||
d,
|
d,
|
||||||
s,
|
s,
|
||||||
app,
|
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -160,14 +160,13 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
]
|
]
|
||||||
for category in self._CATEGORY_ORDER:
|
for category in self._CATEGORY_ORDER:
|
||||||
if category not in by_category:
|
if category not in by_category:
|
||||||
app.info('No %r for %s' % (category,
|
LOG.info('[sphinxext] No %r for %s', category,
|
||||||
(self.team_name, series)))
|
(self.team_name, series))
|
||||||
continue
|
continue
|
||||||
self._add_deliverables(
|
self._add_deliverables(
|
||||||
category,
|
category,
|
||||||
by_category[category],
|
by_category[category],
|
||||||
series,
|
series,
|
||||||
app,
|
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -189,7 +188,7 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
'tempest-plugin': 'Tempest Plugins',
|
'tempest-plugin': 'Tempest Plugins',
|
||||||
}
|
}
|
||||||
|
|
||||||
def _add_deliverables(self, type_tag, deliverables, series, app, result):
|
def _add_deliverables(self, type_tag, deliverables, series, result):
|
||||||
source_name = '<' + __name__ + '>'
|
source_name = '<' + __name__ + '>'
|
||||||
|
|
||||||
# expand any generators passed in and filter out deliverables
|
# expand any generators passed in and filter out deliverables
|
||||||
@ -220,7 +219,7 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
# Determine the most recent release that is not an EOL
|
# Determine the most recent release that is not an EOL
|
||||||
# tag.
|
# tag.
|
||||||
for r in reversed(deliv.releases):
|
for r in reversed(deliv.releases):
|
||||||
if not r.is_eol:
|
if not (r.is_eol or r.is_em):
|
||||||
recent_version = r.version
|
recent_version = r.version
|
||||||
break
|
break
|
||||||
ref = ':ref:`%s-%s`' % (series, deliv.name)
|
ref = ':ref:`%s-%s`' % (series, deliv.name)
|
||||||
@ -275,8 +274,8 @@ class DeliverableDirectiveBase(rst.Directive):
|
|||||||
|
|
||||||
_title(deliv.name, '=')
|
_title(deliv.name, '=')
|
||||||
|
|
||||||
app.info('[deliverables] rendering %s (%s)' %
|
LOG.info('[deliverables] rendering %s (%s)',
|
||||||
(deliv.name, series))
|
deliv.name, series)
|
||||||
|
|
||||||
release_notes = deliv.release_notes
|
release_notes = deliv.release_notes
|
||||||
if not release_notes:
|
if not release_notes:
|
||||||
@ -388,10 +387,10 @@ class TeamDirective(rst.Directive):
|
|||||||
return node.children
|
return node.children
|
||||||
|
|
||||||
|
|
||||||
def _generate_team_pages(app):
|
def _generate_team_pages():
|
||||||
teams_with_deliverables = list(sorted(_deliverables.get_teams()))
|
teams_with_deliverables = list(sorted(_deliverables.get_teams()))
|
||||||
for team_name in teams_with_deliverables:
|
for team_name in teams_with_deliverables:
|
||||||
app.info('[team page] %s' % team_name)
|
LOG.info('[team page] %s', team_name)
|
||||||
slug = team_name.lower().replace('-', '_').replace(' ', '_')
|
slug = team_name.lower().replace('-', '_').replace(' ', '_')
|
||||||
base_file = slug + '.rst'
|
base_file = slug + '.rst'
|
||||||
with open(os.path.join('doc/source/teams', base_file), 'w') as f:
|
with open(os.path.join('doc/source/teams', base_file), 'w') as f:
|
||||||
@ -428,15 +427,12 @@ class HighlightsDirective(rst.Directive):
|
|||||||
return series_highlights
|
return series_highlights
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
env = self.state.document.settings.env
|
|
||||||
app = env.app
|
|
||||||
|
|
||||||
# Get the series we are reporting on
|
# Get the series we are reporting on
|
||||||
series = self.options.get('series')
|
series = self.options.get('series')
|
||||||
if not series:
|
if not series:
|
||||||
raise self.error('series value must be set to a valid cycle name.')
|
raise self.error('series value must be set to a valid cycle name.')
|
||||||
|
|
||||||
app.info('[series-highlights] gathering highlights for {}'.format(
|
LOG.info('[series-highlights] gathering highlights for {}'.format(
|
||||||
series))
|
series))
|
||||||
|
|
||||||
result = ViewList()
|
result = ViewList()
|
||||||
@ -444,8 +440,8 @@ class HighlightsDirective(rst.Directive):
|
|||||||
source_name = '<{}>'.format(__name__)
|
source_name = '<{}>'.format(__name__)
|
||||||
|
|
||||||
for team in sorted(series_highlights.keys(), key=lambda x: x.lower()):
|
for team in sorted(series_highlights.keys(), key=lambda x: x.lower()):
|
||||||
app.info('[highlights] rendering %s highlights for %s' %
|
LOG.info('[highlights] rendering %s highlights for %s',
|
||||||
(team.title(), series))
|
team.title(), series)
|
||||||
|
|
||||||
tdata = _TEAM_DATA.get(team, {})
|
tdata = _TEAM_DATA.get(team, {})
|
||||||
title = team.title()
|
title = team.title()
|
||||||
@ -472,10 +468,10 @@ class HighlightsDirective(rst.Directive):
|
|||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
_initialize_deliverable_data(app)
|
_initialize_deliverable_data()
|
||||||
app.add_directive('deliverable', DeliverableDirective)
|
app.add_directive('deliverable', DeliverableDirective)
|
||||||
app.add_directive('independent-deliverables',
|
app.add_directive('independent-deliverables',
|
||||||
IndependentDeliverablesDirective)
|
IndependentDeliverablesDirective)
|
||||||
app.add_directive('team', TeamDirective)
|
app.add_directive('team', TeamDirective)
|
||||||
app.add_directive('serieshighlights', HighlightsDirective)
|
app.add_directive('serieshighlights', HighlightsDirective)
|
||||||
_generate_team_pages(app)
|
_generate_team_pages()
|
||||||
|
2
tox.ini
2
tox.ini
@ -66,7 +66,7 @@ deps =
|
|||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/doc/requirements.txt
|
-r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
|
sphinx-build -v -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html
|
||||||
whereto {toxinidir}/doc/source/_extra/.htaccess {toxinidir}/doc/test/redirect-tests.txt
|
whereto {toxinidir}/doc/source/_extra/.htaccess {toxinidir}/doc/test/redirect-tests.txt
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
|
Loading…
Reference in New Issue
Block a user