Debian Codegraph @

doc/source/conf.py

raw
1 # -*- coding: utf-8 -*-
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at
5 #
6 # http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11 # implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import os
16 import re
17 import sys
18
19 from recommonmark.transform import AutoStructify
20
21 # --
22 # Copy README.md, CONTRIBUTING.md to source/ directory and replace
23 # all paths to point github files.
24 def _copy_with_converting_link_to_repo(filename, new_filename):
25 base_url = 'https://github.com/kubernetes-client/python/blob/master/'
26
27 def subf(subs):
28 label, url = subs.groups()
29 if not url.startswith('http://') and not url.startswith('https://'):
30 url = base_url + url
31 return label + '(' + url + ')'
32
33 with open(filename, "r") as r:
34 data = re.sub("(\[[^\]]+\])\(([^\)]+)\)", subf, r.read())
35
36 with open(new_filename, "w") as w:
37 w.write(data)
38
39 _copy_with_converting_link_to_repo("../../README.md", "README.md")
40 _copy_with_converting_link_to_repo("../../CONTRIBUTING.md", "CONTRIBUTING.md")
41 # --
42
43 sys.path.insert(0, os.path.abspath('../..'))
44 # -- General configuration ----------------------------------------------------
45
46 source_suffix = ['.rst', '.md']
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 ones.
50 extensions = [
51 'sphinx_markdown_tables',
52 'recommonmark',
53 'sphinx.ext.autodoc',
54 #'sphinx.ext.intersphinx',
55 ]
56
57 # autodoc generation is a bit aggressive and a nuisance when doing heavy
58 # text edit cycles.
59 # execute "export SPHINX_DEBUG=1" in your terminal to disable
60
61 # The suffix of source filenames.
62 source_suffix = '.rst'
63
64 # The master toctree document.
65 master_doc = 'index'
66
67 # General information about the project.
68 project = u'kubernetes-python-client'
69 copyright = u'2017, Kubernetes'
70
71 # If true, '()' will be appended to :func: etc. cross-reference text.
72 add_function_parentheses = True
73
74 # If true, the current module name will be prepended to all description
75 # unit titles (such as .. function::).
76 add_module_names = True
77
78 # The name of the Pygments (syntax highlighting) style to use.
79 pygments_style = 'sphinx'
80
81 # -- Options for HTML output --------------------------------------------------
82
83 # The theme to use for HTML and HTML Help pages. Major themes that come with
84 # Sphinx are currently 'default' and 'sphinxdoc'.
85 # html_theme_path = ["."]
86 # html_theme = '_theme'
87 # html_static_path = ['static']
88
89 # Output file base name for HTML help builder.
90 htmlhelp_basename = '%sdoc' % project
91
92 # Grouping the document tree into LaTeX files. List of tuples
93 # (source start file, target name, title, author, documentclass
94 # [howto/manual]).
95 latex_documents = [
96 ('index',
97 '%s.tex' % project,
98 u'%s Documentation' % project,
99 u'Kubernetes', 'manual'),
100 ]
101
102 # Example configuration for intersphinx: refer to the Python standard library.
103 #intersphinx_mapping = {'http://docs.python.org/': None}
104 def setup(app):
105 app.add_config_value('recommonmark_config', {
106 'auto_toc_tree_section': 'Contents',
107 'enable_eval_rst': True,
108 }, True)
109 app.add_transform(AutoStructify)
110