From bbaf222aa499f4ac1e949e334a1c5b1b2ccce490 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 4 Aug 2017 16:05:19 -0700 Subject: [PATCH] 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 --- doc/source/conf.py | 3 ++- test-requirements.txt | 1 + zuul/sphinx/zuul.py | 32 ++++++++++++++++---------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index ca9c9b059e..fa00593409 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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'] diff --git a/test-requirements.txt b/test-requirements.txt index dcc67e250f..bf8b979463 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -14,3 +14,4 @@ sphinxcontrib-programoutput mock PyMySQL mypy +zuul-sphinx diff --git a/zuul/sphinx/zuul.py b/zuul/sphinx/zuul.py index 0ac33b8ea8..575bcb27dc 100644 --- a/zuul/sphinx/zuul.py +++ b/zuul/sphinx/zuul.py @@ -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 = {