vFW and vDNS support added to azure-plugin
[multicloud/azure.git] / azure / aria / aria-extension-cloudify / src / aria / docs / conf.py
1 # -*- coding: utf-8 -*-
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # ARIA TOSCA documentation build configuration file.
19 #
20 # This file is execfile()d with the current directory set to its
21 # containing dir.
22 #
23 # Note that not all possible configuration values are present in this
24 # autogenerated file.
25 #
26 # All configuration values have a default; values that are commented out
27 # serve to show the default.
28
29 # If extensions (or modules to document with autodoc) are in another directory,
30 # add these directories to sys.path here. If the directory is relative to the
31 # documentation root, use os.path.abspath to make it absolute, like shown here.
32 #
33 import os
34 import sys
35
36 sys.path.append(os.path.abspath('../aria'))
37 sys.path.append(os.path.abspath('../extensions'))
38
39 with open('../VERSION') as f:
40     version = f.readline()
41
42 # -- General configuration ------------------------------------------------
43
44 # If your documentation needs a minimal Sphinx version, state it here.
45 #
46 # needs_sphinx = '1.0'
47
48 # Add any Sphinx extension module names here, as strings. They can be
49 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
50 # ones.
51 extensions = [
52     'sphinx.ext.autodoc',
53     'sphinx.ext.autosummary',
54     'sphinx.ext.intersphinx',
55     'sphinx_click.ext'
56 ]
57
58 # Add any paths that contain templates here, relative to this directory.
59 templates_path = ['_templates']
60
61 # The suffix(es) of source filenames.
62 # You can specify multiple suffix as a list of string:
63 #
64 # source_suffix = ['.rst', '.md']
65 source_suffix = '.rst'
66
67 # The encoding of source files.
68 #
69 # source_encoding = 'utf-8-sig'
70
71 # The master toctree document.
72 master_doc = 'index'
73
74 # General information about the project.
75 project = u'ARIA TOSCA'
76 copyright = u'2016-2017, Apache Software Foundation' # @ReservedAssignment
77 author = u'Apache Software Foundation'
78
79 # The version info for the project you're documenting, acts as replacement for
80 # |version| and |release|, also used in various other places throughout the
81 # built documents.
82 #
83 # The short X.Y version.
84 #version = u'0.0'
85 # The full version, including alpha/beta/rc tags.
86 release = version # @UndefinedVariable
87
88 # The language for content autogenerated by Sphinx. Refer to documentation
89 # for a list of supported languages.
90 #
91 # This is also used if you do content translation via gettext catalogs.
92 # Usually you set "language" from the command line for these cases.
93 language = None
94
95 # There are two options for replacing |today|: either, you set today to some
96 # non-false value, then it is used:
97 #
98 # today = ''
99 #
100 # Else, today_fmt is used as the format for a strftime call.
101 #
102 # today_fmt = '%B %d, %Y'
103
104 # List of patterns, relative to source directory, that match files and
105 # directories to ignore when looking for source files.
106 # This patterns also effect to html_static_path and html_extra_path
107 exclude_patterns = []
108
109 # The reST default role (used for this markup: `text`) to use for all
110 # documents.
111 #
112 # default_role = None
113
114 # If true, '()' will be appended to :func: etc. cross-reference text.
115 #
116 # add_function_parentheses = True
117
118 # If true, the current module name will be prepended to all description
119 # unit titles (such as .. function::).
120 #
121 # add_module_names = True
122
123 # If true, sectionauthor and moduleauthor directives will be shown in the
124 # output. They are ignored by default.
125 #
126 # show_authors = False
127
128 # The name of the Pygments (syntax highlighting) style to use.
129 pygments_style = 'sphinx'
130
131 # A list of ignored prefixes for module index sorting.
132 # modindex_common_prefix = []
133
134 # If true, keep warnings as "system message" paragraphs in the built documents.
135 # keep_warnings = False
136
137 # If true, `todo` and `todoList` produce output, else they produce nothing.
138 todo_include_todos = False
139
140
141 # -- Options for HTML output ----------------------------------------------
142
143 # The theme to use for HTML and HTML Help pages.  See the documentation for
144 # a list of builtin themes.
145 #
146 html_theme = 'sphinx_rtd_theme'
147
148 # Theme options are theme-specific and customize the look and feel of a theme
149 # further.  For a list of options available for each theme, see the
150 # documentation.
151 #
152 # html_theme_options = {}
153
154 # Add any paths that contain custom themes here, relative to this directory.
155 #html_theme_path = []
156
157 # The name for this set of Sphinx documents.
158 # "<project> v<release> documentation" by default.
159 #
160 # html_title = u'ARIA TOSCA v0.1.0'
161
162 # A shorter title for the navigation bar.  Default is the same as html_title.
163 #
164 # html_short_title = None
165
166 # The name of an image file (relative to this directory) to place at the top
167 # of the sidebar.
168 #
169 # html_logo = None
170
171 # The name of an image file (relative to this directory) to use as a favicon of
172 # the docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
173 # pixels large.
174 #
175 # html_favicon = None
176
177 # Add any paths that contain custom static files (such as style sheets) here,
178 # relative to this directory. They are copied after the builtin static files,
179 # so a file named "default.css" will overwrite the builtin "default.css".
180 html_static_path = ['_static']
181
182 # Add any extra paths that contain custom files (such as robots.txt or
183 # .htaccess) here, relative to this directory. These files are copied
184 # directly to the root of the documentation.
185 #
186 # html_extra_path = []
187
188 # If not None, a 'Last updated on:' timestamp is inserted at every page
189 # bottom, using the given strftime format.
190 # The empty string is equivalent to '%b %d, %Y'.
191 #
192 # html_last_updated_fmt = None
193
194 # If true, SmartyPants will be used to convert quotes and dashes to
195 # typographically correct entities.
196 #
197 # html_use_smartypants = True
198
199 # Custom sidebar templates, maps document names to template names.
200 #
201 # html_sidebars = {}
202
203 # Additional templates that should be rendered to pages, maps page names to
204 # template names.
205 #
206 # html_additional_pages = {}
207
208 # If false, no module index is generated.
209 #
210 # html_domain_indices = True
211
212 # If false, no index is generated.
213 #
214 # html_use_index = True
215
216 # If true, the index is split into individual pages for each letter.
217 #
218 # html_split_index = False
219
220 # If true, links to the reST sources are added to the pages.
221 #
222 # html_show_sourcelink = True
223
224 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
225 #
226 # html_show_sphinx = True
227
228 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
229 #
230 # html_show_copyright = True
231
232 # If true, an OpenSearch description file will be output, and all pages will
233 # contain a <link> tag referring to it.  The value of this option must be the
234 # base URL from which the finished HTML is served.
235 #
236 # html_use_opensearch = ''
237
238 # This is the file name suffix for HTML files (e.g. ".xhtml").
239 # html_file_suffix = None
240
241 # Language to be used for generating the HTML full-text search index.
242 # Sphinx supports the following languages:
243 #   'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
244 #   'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
245 #
246 # html_search_language = 'en'
247
248 # A dictionary with options for the search language support, empty by default.
249 # 'ja' uses this config value.
250 # 'zh' user can custom change `jieba` dictionary path.
251 #
252 # html_search_options = {'type': 'default'}
253
254 # The name of a javascript file (relative to the configuration directory) that
255 # implements a search results scorer. If empty, the default will be used.
256 #
257 # html_search_scorer = 'scorer.js'
258
259 # Output file base name for HTML help builder.
260 htmlhelp_basename = 'ARIATOSCAdoc'
261
262 # -- Options for LaTeX output ---------------------------------------------
263
264 latex_elements = {
265      # The paper size ('letterpaper' or 'a4paper').
266      #
267      # 'papersize': 'letterpaper',
268
269      # The font size ('10pt', '11pt' or '12pt').
270      #
271      # 'pointsize': '10pt',
272
273      # Additional stuff for the LaTeX preamble.
274      #
275      # 'preamble': '',
276
277      # Latex figure (float) alignment
278      #
279      # 'figure_align': 'htbp',
280 }
281
282 # Grouping the document tree into LaTeX files. List of tuples
283 # (source start file, target name, title,
284 #  author, documentclass [howto, manual, or own class]).
285 latex_documents = [
286     (master_doc, 'ARIATOSCA.tex', u'ARIA TOSCA',
287      u'Apache Software Foundation', 'manual'),
288 ]
289
290 # The name of an image file (relative to this directory) to place at the top of
291 # the title page.
292 #
293 # latex_logo = None
294
295 # For "manual" documents, if this is true, then toplevel headings are parts,
296 # not chapters.
297 #
298 # latex_use_parts = False
299
300 # If true, show page references after internal links.
301 #
302 # latex_show_pagerefs = False
303
304 # If true, show URL addresses after external links.
305 #
306 # latex_show_urls = False
307
308 # Documents to append as an appendix to all manuals.
309 #
310 # latex_appendices = []
311
312 # If false, no module index is generated.
313 #
314 # latex_domain_indices = True
315
316
317 # -- Options for manual page output ---------------------------------------
318
319 # One entry per manual page. List of tuples
320 # (source start file, name, description, authors, manual section).
321 man_pages = [
322     (master_doc, 'aria', u'ARIA TOSCA',
323      [author], 1)
324 ]
325
326 # If true, show URL addresses after external links.
327 #
328 # man_show_urls = False
329
330
331 # -- Options for Texinfo output -------------------------------------------
332
333 # Grouping the document tree into Texinfo files. List of tuples
334 # (source start file, target name, title, author,
335 #  dir menu entry, description, category)
336 texinfo_documents = [
337     (master_doc, 'ARIATOSCA', u'ARIA TOSCA',
338      author, 'ARIA TOSCA', 'an open, light, CLI-driven library of orchestration tools that other '
339      'open projects can consume to easily build TOSCA-based orchestration solutions.',
340      'Miscellaneous'),
341 ]
342
343 # Documents to append as an appendix to all manuals.
344 #
345 # texinfo_appendices = []
346
347 # If false, no module index is generated.
348 #
349 # texinfo_domain_indices = True
350
351 # How to display URL addresses: 'footnote', 'no', or 'inline'.
352 #
353 # texinfo_show_urls = 'footnote'
354
355 # If true, do not generate a @detailmenu in the "Top" node's menu.
356 #
357 # texinfo_no_detailmenu = False
358
359
360 # -- Options for InterSphinx
361
362 intersphinx_mapping = {
363     'python': ('https://docs.python.org/2.7', None)
364 }
365
366 # -- Options for Python domain
367
368 # Append __init__ docstring into class docstring
369 autoclass_content = 'both'
370
371 # Default to everything important
372 autodoc_default_flags = [
373     'members',
374     'undoc-members',
375     'show-inheritance'
376 ]
377
378 SKIP_MEMBERS = (
379     'FIELDS',
380     'ALLOW_UNKNOWN_FIELDS',
381     'SHORT_FORM_FIELD',
382     'INSTRUMENTATION_FIELDS'
383 )
384
385 SKIP_MEMBER_SUFFIXES = (
386     '_fk',
387 )
388
389 NEVER_SKIP_MEMBERS = (
390     '__evaluate__',
391 )
392
393 SKIP_DOCUMENTS = ()
394
395 from sphinx import addnodes
396 from sphinx.domains.python import PythonDomain
397
398 try:
399     import fabric
400 except:
401     # Note: "exclude_patterns" is not good enough for us, because we still have a TOC entry.
402     # Unfortunately, there is no way to conditionally exclude a TOC entry, and TOC entries without
403     # matching documents emit an error. So, we will have to manipulate the doctree directly!
404     SKIP_DOCUMENTS = ('aria.orchestrator.execution_plugin.ssh',)
405
406 def on_autodoc_skip_member(app, what, name, obj, skip, options):
407     if name in NEVER_SKIP_MEMBERS:
408         return False
409     if name in SKIP_MEMBERS: 
410         return True
411     for suffix in SKIP_MEMBER_SUFFIXES:
412         if name.endswith(suffix):
413             return True
414     return skip
415
416 def on_source_read(app, docname, source):
417     # Empty out source
418     if docname in SKIP_DOCUMENTS:
419         source[0] = ''
420
421 def on_doctree_read(app, doctree):
422     # Remove TOC entry (see: https://gist.github.com/kakawait/9215487)
423     for toctreenode in doctree.traverse(addnodes.toctree):
424         for e in toctreenode['entries']:
425             ref = str(e[1])
426             if ref in SKIP_DOCUMENTS:
427                 toctreenode['entries'].remove(e)    
428
429 class PatchedPythonDomain(PythonDomain):
430     # See: https://github.com/sphinx-doc/sphinx/issues/3866
431     def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
432         if 'refspecific' in node:
433             del node['refspecific']
434         return super(PatchedPythonDomain, self).resolve_xref(
435             env, fromdocname, builder, typ, target, node, contnode)
436
437 def setup(app):
438     app.connect('autodoc-skip-member', on_autodoc_skip_member)
439     app.connect('source-read', on_source_read)
440     app.connect('doctree-read', on_doctree_read)
441     app.override_domain(PatchedPythonDomain)