Browse Source

Add zuul-sphinx as a requirement

This renames the internal sphinx domain from zuul to zuuldoc.  This
is a temporary measure to avoid colliding with the domain defined
in zuul-sphinx (because of the initial data required, it's not
easy for us to simply add new directives/roles without at least
porting *some* of the framework into zuul-sphinx).

I expect to do that when this has stabilized.

Change-Id: I26be542a6d4f6266f7843ada5939172656b8b847
Depends-On: I8a1534f7c2614ee11411cf228de38931257fc970
changes/29/491129/2
James E. Blair 4 years ago
parent
commit
bbaf222aa4
3 changed files with 19 additions and 17 deletions
  1. +2
    -1
      doc/source/conf.py
  2. +1
    -0
      test-requirements.txt
  3. +16
    -16
      zuul/sphinx/zuul.py

+ 2
- 1
doc/source/conf.py View File

@ -30,13 +30,14 @@ extensions = [
'sphinx.ext.graphviz',
'sphinxcontrib.blockdiag',
'sphinxcontrib.programoutput',
'zuul_sphinx',
'zuul.sphinx.ansible',
'zuul.sphinx.zuul',
]
#extensions = ['sphinx.ext.intersphinx']
#intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)}
primary_domain = 'zuul'
primary_domain = 'zuuldoc'
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']


+ 1
- 0
test-requirements.txt View File

@ -14,3 +14,4 @@ sphinxcontrib-programoutput
mock
PyMySQL
mypy
zuul-sphinx

+ 16
- 16
zuul/sphinx/zuul.py View File

@ -29,10 +29,10 @@ class ZuulConfigObject(ObjectDescription):
}
def get_path(self):
return self.env.ref_context.get('zuul:attr_path', [])
return self.env.ref_context.get('zuuldoc:attr_path', [])
def get_display_path(self):
return self.env.ref_context.get('zuul:display_attr_path', [])
return self.env.ref_context.get('zuuldoc:display_attr_path', [])
@property
def parent_pathname(self):
@ -50,7 +50,7 @@ class ZuulConfigObject(ObjectDescription):
signode['ids'].append(targetname)
signode['first'] = (not self.names)
self.state.document.note_explicit_target(signode)
objects = self.env.domaindata['zuul']['objects']
objects = self.env.domaindata['zuuldoc']['objects']
if targetname in objects:
self.state_machine.reporter.warning(
'duplicate object description of %s, ' % targetname +
@ -80,16 +80,16 @@ class ZuulAttrDirective(ZuulConfigObject):
}
def before_content(self):
path = self.env.ref_context.setdefault('zuul:attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:attr_path', [])
path.append(self.names[-1])
path = self.env.ref_context.setdefault('zuul:display_attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:display_attr_path', [])
path.append(self.names[-1])
def after_content(self):
path = self.env.ref_context.get('zuul:attr_path')
path = self.env.ref_context.get('zuuldoc:attr_path')
if path:
path.pop()
path = self.env.ref_context.get('zuul:display_attr_path')
path = self.env.ref_context.get('zuuldoc:display_attr_path')
if path:
path.pop()
@ -141,18 +141,18 @@ class ZuulVarDirective(ZuulConfigObject):
return ''
def before_content(self):
path = self.env.ref_context.setdefault('zuul:attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:attr_path', [])
element = self.names[-1]
path.append(element)
path = self.env.ref_context.setdefault('zuul:display_attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:display_attr_path', [])
element = self.names[-1] + self.get_type_str()
path.append(element)
def after_content(self):
path = self.env.ref_context.get('zuul:attr_path')
path = self.env.ref_context.get('zuuldoc:attr_path')
if path:
path.pop()
path = self.env.ref_context.get('zuul:display_attr_path')
path = self.env.ref_context.get('zuuldoc:display_attr_path')
if path:
path.pop()
@ -176,18 +176,18 @@ class ZuulStatDirective(ZuulConfigObject):
}
def before_content(self):
path = self.env.ref_context.setdefault('zuul:attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:attr_path', [])
element = self.names[-1]
path.append(element)
path = self.env.ref_context.setdefault('zuul:display_attr_path', [])
path = self.env.ref_context.setdefault('zuuldoc:display_attr_path', [])
element = self.names[-1]
path.append(element)
def after_content(self):
path = self.env.ref_context.get('zuul:attr_path')
path = self.env.ref_context.get('zuuldoc:attr_path')
if path:
path.pop()
path = self.env.ref_context.get('zuul:display_attr_path')
path = self.env.ref_context.get('zuuldoc:display_attr_path')
if path:
path.pop()
@ -216,7 +216,7 @@ class ZuulAbbreviatedXRefRole(XRefRole):
class ZuulDomain(Domain):
name = 'zuul'
name = 'zuuldoc'
label = 'Zuul'
directives = {


Loading…
Cancel
Save