salt/doc/conf.py

201 lines
5.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2012-01-16 05:33:44 +00:00
import sys
import os
import types
2012-01-16 05:33:44 +00:00
class Mock(object):
'''
Mock out specified imports
This allows autodoc to do it's thing without having oodles of req'd
installed libs. This doesn't work with ``import *`` imports.
http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
'''
def __init__(self, *args, **kwargs):
pass
def __call__(self, *args, **kwargs):
return Mock()
@classmethod
def __getattr__(self, name):
if name in ('__file__', '__path__'):
return '/dev/null'
elif name[0] == name[0].upper():
return type(name, (), {})
else:
return Mock()
MOCK_MODULES = [
# salt core
'yaml',
'yaml.nodes',
'yaml.constructor',
2012-01-21 03:36:16 +00:00
'msgpack',
2012-01-16 05:33:44 +00:00
'zmq',
'Crypto',
'Crypto.Cipher',
'Crypto.Hash',
'Crypto.PublicKey',
'Crypto.Random',
'M2Crypto',
2012-01-16 05:33:44 +00:00
# modules, renderers, states, returners, et al
'MySQLdb',
'MySQLdb.cursors',
'psutil',
'libvirt',
'yum',
'mako',
'mako.template',
'pymongo',
'redis',
'rpm',
'rpmUtils',
'rpmUtils.arch',
'pycassa',
2012-01-16 05:33:44 +00:00
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = Mock()
# -- Add paths to PYTHONPATH ---------------------------------------------------
docs_basepath = os.path.abspath(os.path.dirname(__file__))
addtl_paths = (
2012-01-16 05:33:44 +00:00
os.pardir, # salt itself (for autodoc)
'_ext', # custom Sphinx extensions
)
for path in addtl_paths:
sys.path.insert(0, os.path.abspath(os.path.join(docs_basepath, path)))
2012-01-16 05:33:44 +00:00
from salt.version import __version__
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# -- General configuration -----------------------------------------------------
2012-06-04 22:40:34 +00:00
project = 'Salt'
copyright = '2012, Thomas S. Hatch'
version = __version__
release = version
master_doc = 'contents'
2011-10-11 01:23:39 +00:00
templates_path = ['_templates']
exclude_patterns = ['_build']
extensions = ['saltdocs', 'sphinx.ext.autodoc', 'sphinx.ext.extlinks',
'sphinx.ext.autosummary']
2011-10-11 01:23:39 +00:00
modindex_common_prefix = ['salt.']
autosummary_generate = True
2011-10-11 01:23:39 +00:00
# Define a substitution for linking to the latest release tarball
rst_prolog = """\
.. _`installation`: http://saltstack.org/install/
.. |saltrepo| replace:: https://github.com/saltstack/salt
.. |latest| replace:: https://github.com/downloads/saltstack/salt/salt-%s.tar.gz
2011-10-11 01:23:39 +00:00
""" % __version__
# A shortcut for linking to tickets on the GitHub issue tracker
extlinks = {
'blob': ('https://github.com/saltstack/salt/blob/v%s/%%s' % __version__, None),
'download': ('https://github.com/downloads/saltstack/salt/%s', None),
'issue': ('https://github.com/saltstack/salt/issues/%s', 'issue '),
}
2011-10-11 01:23:39 +00:00
### HTML options
html_theme = 'default'
2011-10-11 01:23:39 +00:00
html_title = None
html_short_title = 'Salt'
html_static_path = ['_static']
html_logo = 'salt-vert.png'
2011-10-17 05:54:11 +00:00
html_favicon = 'favicon.ico'
html_use_smartypants = False
html_additional_pages = {
'404': '404.html',
}
html_sidebars = {
'ref/**/all/salt.*': [
'autosummarysidebar.html',
'localtoc.html',
'relations.html',
'sourcelink.html',
'searchbox.html',
],
}
html_context = {
'github_base': 'https://github.com/saltstack/salt',
'github_issues': 'https://github.com/saltstack/salt/issues',
'github_downloads': 'https://github.com/saltstack/salt/downloads',
}
html_use_index = False
2011-10-11 01:23:39 +00:00
html_last_updated_fmt = '%b %d, %Y'
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True
#html_use_opensearch = ''
2011-10-11 01:23:39 +00:00
### Latex options
latex_documents = [
2012-06-04 22:40:34 +00:00
('contents', 'Salt.tex', 'Salt Documentation', 'Thomas Hatch', 'manual'),
]
latex_logo = '_static/salt-vert.png'
2011-10-11 01:23:39 +00:00
### Manpage options
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
authors = [
2012-06-04 22:40:34 +00:00
'Thomas S. Hatch <thatch@gmail.com> and many others, please see the Authors file',
]
man_pages = [
2012-06-04 22:40:34 +00:00
('ref/cli/salt', 'salt', 'salt', authors, 1),
('contents', 'salt', 'Salt Documentation', authors, 7),
('ref/cli/salt-master', 'salt-master', 'salt-master Documentation', authors, 1),
('ref/cli/salt-minion', 'salt-minion', 'salt-minion Documentation', authors, 1),
('ref/cli/salt-key', 'salt-key', 'salt-key Documentation', authors, 1),
('ref/cli/salt-cp', 'salt-cp', 'salt-cp Documentation', authors, 1),
('ref/cli/salt-call', 'salt-call', 'salt-call Documentation', authors, 1),
('ref/cli/salt-syndic', 'salt-syndic', 'salt-syndic Documentation', authors, 1),
('ref/cli/salt-run', 'salt-run', 'salt-run Documentation', authors, 1),
]
2011-11-07 02:16:34 +00:00
### epub options
2012-06-04 22:40:34 +00:00
epub_title = 'Salt Documentation'
epub_author = 'Thomas S. Hatch'
2011-11-07 02:16:34 +00:00
epub_publisher = epub_author
2012-06-04 22:40:34 +00:00
epub_copyright = '2012, Thomas S. Hatch'
2011-11-07 02:16:34 +00:00
epub_scheme = 'URL'
epub_identifier = 'http://saltstack.org/'
#epub_tocdepth = 3
def skip_mod_init_member(app, what, name, obj, skip, options):
if isinstance(obj, types.FunctionType) and obj.__name__ == 'mod_init':
return True
return False
def setup(app):
app.connect('autodoc-skip-member', skip_mod_init_member)