import os
import sys
def getstatusoutput(cmd):
"""Return (status, output) of executing cmd in a shell."""
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
text = pipe.read()
sts = pipe.close()
if sts is None:
sts = 0
if text[-1:] == '\n':
text = text[:-1]
return sts, text
class DocBuildError(Exception):
pass
root_path = os.path.abspath(os.path.join("..", ".."))
sys.path.insert(0, root_path)
_sphinx_apidoc = getstatusoutput('which sphinx-apidoc')[1].strip()
_output_dir = os.path.join(root_path, 'docs', 'source', 'api')
_api_dir = os.path.join(root_path, 'virttest')
_status, _output = getstatusoutput("%s -o %s %s" % (_sphinx_apidoc, _output_dir, _api_dir))
if _status:
raise DocBuildError("API rst auto generation failed: %s" % _output)
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage']
master_doc = 'index'
project = u'Avocado VT'
copyright = u'2014, Red Hat'
version_file = os.path.join(root_path, 'VERSION')
VERSION = open(version_file, 'r').read().strip()
version = VERSION
release = VERSION
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd:
try:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
except ImportError:
html_theme = 'default'
htmlhelp_basename = 'avocadodoc'
latex_documents = [
('index', 'avocado.tex',
u'Avocado Virt Test Compatibility Layer Documentation',
u'Lucas Meneghel Rodrigues', 'manual'),
]
man_pages = [
('index', 'avocado', u'Avocado Virt Test Compatibility Layer Documentation',
[u'Lucas Meneghel Rodrigues'], 1)
]
texinfo_documents = [
('index', 'avocado', u'Avocado Virt Test Compatibility Layer',
u'Lucas Meneghel Rodrigues', 'avocado',
'Avocado Virtualization Testing (VT) plugin',
'Testing'),
]
intersphinx_mapping = {'http://docs.python.org/': None,
'http://avocado-framework.readthedocs.org/en/latest/': None}
autoclass_content = 'both'
highlight_language = 'none'