Package ganeti :: Package build :: Module sphinx_ext
[hide private]
[frames] | no frames]

Module sphinx_ext

source code

Sphinx extension for building opcode documentation.

Classes [hide private]
  ReSTError
Custom class for generating errors in Sphinx.
  OpcodeError
  OpcodeParams
Custom directive for opcode parameters.
  OpcodeResult
Custom directive for opcode result.
  PythonAssert
Custom directive for writing assertions.
  _ManPageXRefRole
  _RapiHandlersForDocsHelper
  RapiAccessTable
Custom directive to generate table of all RAPI resources.
  RapiResourceDetails
Custom directive for RAPI resource details.
Functions [hide private]
 
_GetCommonParamNames()
Builds a list of parameters common to all opcodes.
source code
 
_SplitOption(text)
Split simple option list.
source code
dict
_ParseAlias(text)
Parse simple assignment option.
source code
 
_BuildOpcodeParams(op_id, include, exclude, alias)
Build opcode parameter documentation.
source code
 
_BuildOpcodeResult(op_id)
Build opcode result documentation.
source code
 
PythonEvalRole(role, rawtext, text, lineno, inliner, options={}, content=[])
Custom role to evaluate Python expressions.
source code
 
BuildQueryFields(fields)
Build query fields documentation.
source code
 
BuildValuesDoc(values)
Builds documentation for a list of values
source code
 
_ManPageNodeClass(*args, **kwargs)
Generates a pending XRef like a ":doc:`...`" reference.
source code
 
_ManPageRole(typ, rawtext, text, lineno, inliner, options={}, content=[])
Custom role for man page references.
source code
 
_EncodeRapiResourceLink(method, uri)
Encodes a RAPI resource URI for use as a link target.
source code
 
_MakeRapiResourceLink(method, uri)
Generates link target name for RAPI resource.
source code
list of strings
_GetHandlerMethods(handler)
Returns list of HTTP methods supported by handler class.
source code
string
_DescribeHandlerAccess(handler, method)
Returns textual description of required RAPI permissions.
source code
 
_BuildRapiAccessTable(res)
Build a table with access permissions needed for all RAPI resources.
source code
 
setup(app)
Sphinx extension callback.
source code
Variables [hide private]
  s_compat = sphinx.util.compat
  orig_manpage_role = docutils.parsers.rst.roles._roles ["manpage"]
  _MAN_RE = re.compile(r"^(?P<name>[-\w_]+)\((?P<section>\d+)\)$")
Regular expression for man page names
  _TAB_WIDTH = 2
  RAPI_URI_ENCODE_RE = re.compile("[^_a-z0-9]+", re.I)
  COMMON_PARAM_NAMES = _GetCommonParamNames()
  EVAL_NS = dict(compat= compat, constants= constants, utils= ut...
Namespace for evaluating expressions
  CV_ECODES_DOC = "ecodes"
  CV_ECODES_DOC_LIST = [(name, doc) for(_, name, doc) in constan...
  DOCUMENTED_CONSTANTS = {CV_ECODES_DOC: CV_ECODES_DOC_LIST,}
  _RAPI_RESOURCES_FOR_DOCS = _RapiHandlersForDocsHelper.Build()

Imports: re, StringIO, docutils, sphinx, _constants, constants, compat, errors, utils, opcodes, opcodes_base, ht, rapi, luxi, objects, http, ganeti


Function Details [hide private]

_SplitOption(text)

source code 

Split simple option list.

Parameters:
  • text (string) - Options, e.g. "foo, bar, baz"

_ParseAlias(text)

source code 

Parse simple assignment option.

Parameters:
  • text (string) - Assignments, e.g. "foo=bar, hello=world"
Returns: dict

_BuildOpcodeParams(op_id, include, exclude, alias)

source code 

Build opcode parameter documentation.

Parameters:
  • op_id (string) - Opcode ID

_BuildOpcodeResult(op_id)

source code 

Build opcode result documentation.

Parameters:
  • op_id (string) - Opcode ID

PythonEvalRole(role, rawtext, text, lineno, inliner, options={}, content=[])

source code 

Custom role to evaluate Python expressions.

The expression's result is included as a literal.

BuildQueryFields(fields)

source code 

Build query fields documentation.

Parameters:
  • fields (dict (field name as key, field details as value))

BuildValuesDoc(values)

source code 

Builds documentation for a list of values

Parameters:
  • values (list of tuples in the form (value, documentation))

_ManPageRole(typ, rawtext, text, lineno, inliner, options={}, content=[])

source code 

Custom role for man page references.

Converts man pages to links if enabled during the build.

_GetHandlerMethods(handler)

source code 

Returns list of HTTP methods supported by handler class.

Parameters:
Returns: list of strings

_DescribeHandlerAccess(handler, method)

source code 

Returns textual description of required RAPI permissions.

Parameters:
Returns: string

Variables Details [hide private]

EVAL_NS

Namespace for evaluating expressions

Value:
dict(compat= compat, constants= constants, utils= utils, errors= error\
s, rlib2= rapi.rlib2, luxi= luxi, rapi= rapi, objects= objects, http= \
http)

CV_ECODES_DOC_LIST

Value:
[(name, doc) for(_, name, doc) in constants.CV_ALL_ECODES]