Update sphinx extension logging

Sphinx 1.6 deprecated using the application object to perform logging
and it will be removed in the upcoming 2.0 release. This updates our
extensions to use the recommended sphinx.util.logging instead.

Change-Id: Ibf9f1c84171b73bb620f8df9a26ae97a8545b4b2
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-10-16 14:08:46 -05:00
parent b635df1cd0
commit 83ba960797
6 changed files with 30 additions and 17 deletions

View File

@ -20,9 +20,12 @@ from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import tables
from docutils.utils import SystemMessagePropagation
from sphinx.util import logging
import projects
LOG = logging.getLogger(__name__)
class ExtraATCsTable(tables.Table):
"""List the extra ATCs for the given project.
@ -136,5 +139,5 @@ _PATTERN = re.compile('(?P<project>.+):\s+(?P<name>.+)\s\((?P<email>.+)\)\s\[(?P
def setup(app):
app.info('loading atcs extension')
LOG.info('loading atcs extension')
app.add_directive('extraatcstable', ExtraATCsTable)

View File

@ -14,14 +14,16 @@
Generate badges for the projects
"""
from itertools import chain
from itertools import zip_longest
import os
from itertools import chain
from itertools import zip_longest
from PIL import ImageFont
from sphinx.util import logging
import projects
LOG = logging.getLogger(__name__)
PADDING = 8
BASE_TAGS_URL = 'https://governance.openstack.org/tc/reference/tags/'
@ -162,7 +164,7 @@ def _to_svg(badges):
def _generate_teams_badges(app, exception=None):
app.info('Generating team badges')
LOG.info('Generating team badges')
all_teams = projects.get_project_data()
files = []
@ -178,7 +180,7 @@ def _generate_teams_badges(app, exception=None):
files.append(filename)
for team, info in all_teams.items():
app.info('generating team badge for %s' % team)
LOG.info('generating team badge for %s' % team)
for name, deliverable in info['deliverables'].items():
tags = info.get('tags', []) + deliverable.get('tags', [])
@ -200,5 +202,5 @@ def _generate_teams_badges(app, exception=None):
def setup(app):
app.info('loading badges extension')
LOG.info('loading badges extension')
app.connect('build-finished', _generate_teams_badges)

View File

@ -17,9 +17,12 @@ from docutils import nodes
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import tables
from docutils.utils import SystemMessagePropagation
from sphinx.util import logging
from openstack_governance import members
LOG = logging.getLogger(__name__)
class MembersTable(tables.Table):
"""Insert the members table using the referenced file as source.
@ -129,5 +132,5 @@ class MembersTable(tables.Table):
def setup(app):
app.info('loading members extension')
LOG.info('loading members extension')
app.add_directive('memberstable', MembersTable)

View File

@ -17,6 +17,9 @@ import copy
import os.path
from openstack_governance import projects
from sphinx.util import logging
LOG = logging.getLogger(__name__)
_projects_yaml = {}
@ -35,5 +38,5 @@ def setup(app):
global _projects_yaml
filename = os.path.abspath('reference/projects.yaml')
app.info('reading %s' % filename)
LOG.info('reading %s' % filename)
_projects_yaml = projects.load_project_file(filename)

View File

@ -16,10 +16,13 @@
from docutils import nodes
from docutils.parsers import rst
from docutils import statemachine
from sphinx.util import logging
from sphinx.util.nodes import nested_parse_with_titles
import projects
LOG = logging.getLogger(__name__)
_projects_by_tag = {}
@ -30,11 +33,8 @@ class TaggedProjectsDirective(rst.Directive):
has_content = True
def run(self):
env = self.state.document.settings.env
app = env.app
tagname = ' '.join(self.content)
app.info('building list of projects tagged %r' % tagname)
LOG.info('building list of projects tagged %r' % tagname)
if not tagname:
error = self.state_machine.reporter.error(
'No tagname in tagged-projects directive',
@ -82,6 +82,6 @@ def _build_projects_by_tag():
def setup(app):
app.info('loading tags extension')
LOG.info('loading tags extension')
_build_projects_by_tag()
app.add_directive('tagged-projects', TaggedProjectsDirective)

View File

@ -16,10 +16,12 @@
from docutils import nodes
from docutils.parsers import rst
from docutils import statemachine
from sphinx.util import logging
from sphinx.util.nodes import nested_parse_with_titles
import projects
LOG = logging.getLogger(__name__)
IRC_LOG_URL_BASE = 'http://eavesdrop.openstack.org/irclogs/%23'
@ -96,13 +98,13 @@ def _team_to_rst(name, info):
yield ''
def _write_team_pages(app):
def _write_team_pages():
all_teams = projects.get_project_data()
files = []
for team, info in all_teams.items():
slug = projects.slugify(team)
filename = 'reference/projects/%s.rst' % slug
app.info('generating team page for %s' % team)
LOG.info('generating team page for %s' % team)
with open(filename, 'w', encoding='utf-8') as f:
f.write('\n'.join(_team_to_rst(team, info)))
files.append(filename)
@ -132,6 +134,6 @@ class TeamsListDirective(rst.Directive):
def setup(app):
app.info('loading teams extension')
LOG.info('loading teams extension')
app.add_directive('teamslist', TeamsListDirective)
_write_team_pages(app)
_write_team_pages()