12 os
.path
.abspath(__file__
)))
15 def parse_ceph_release():
16 with
open(os
.path
.join(top_level
, 'src/ceph_release')) as f
:
18 assert(len(lines
) == 3)
20 version
, codename
, status
= [line
.strip() for line
in lines
]
21 return version
, codename
, status
24 def latest_stable_release():
25 with
open(os
.path
.join(top_level
, 'doc/releases/releases.yml')) as input:
26 releases
= yaml
.safe_load(input)['releases']
27 # get the first release
28 return next(iter(releases
.keys()))
31 def is_release_eol(codename
):
32 with
open(os
.path
.join(top_level
, 'doc/releases/releases.yml')) as input:
33 releases
= yaml
.safe_load(input)['releases']
34 return 'actual_eol' in releases
.get(codename
, {})
39 copyright
= ('2016, Ceph authors and contributors. '
40 'Licensed under Creative Commons Attribution Share Alike 3.0 '
42 version
, codename
, release
= parse_ceph_release()
43 pygments_style
= 'sphinx'
47 html_theme_path
= ['_themes']
48 html_title
= "Ceph Documentation"
49 html_logo
= 'logo.png'
50 html_context
= {'is_release_eol': is_release_eol(codename
)}
51 html_favicon
= 'favicon.ico'
52 html_show_sphinx
= False
53 html_static_path
= ["_static"]
55 '**': ['smarttoc.html', 'searchbox.html']
58 html_css_files
= ['css/custom.css']
60 # general configuration
61 templates_path
= ['_templates']
62 source_suffix
= '.rst'
63 exclude_patterns
= ['**/.#*',
65 'start/quick-common.rst',
67 if tags
.has('man'): # noqa: F821
68 master_doc
= 'man_index'
69 exclude_patterns
+= ['index.rst',
90 exclude_patterns
+= ['man_index.rst']
92 build_with_rtd
= os
.environ
.get('READTHEDOCS') == 'True'
94 sys
.path
.insert(0, os
.path
.abspath('_ext'))
98 'sphinx.ext.graphviz',
102 'sphinx_autodoc_typehints',
103 'sphinx_substitution_extensions',
107 'sphinxcontrib.openapi'
110 ditaa
= shutil
.which("ditaa")
111 if ditaa
is not None:
112 extensions
+= ['sphinxcontrib.ditaa']
114 extensions
+= ['plantweb.directive']
115 plantweb_defaults
= {
120 extensions
+= ['sphinx_search.extension']
122 # sphinx.ext.todo options
123 todo_include_todos
= True
125 # sphinx_substitution_extensions options
127 .. |stable-release| replace:: {latest_stable_release()}
131 breathe_default_project
= "Ceph"
132 # see $(top_srcdir)/Doxyfile
134 breathe_build_directory
= os
.path
.join(top_level
, "build-doc")
135 breathe_projects
= {"Ceph": os
.path
.join(top_level
, breathe_build_directory
)}
136 breathe_projects_source
= {
137 "Ceph": (os
.path
.join(top_level
, "src/include/rados"),
138 ["rados_types.h", "librados.h"])
140 breathe_domain_by_extension
= {'py': 'py',
142 'cc': 'cxx', 'hpp': 'cxx'}
143 breathe_doxygen_config_options
= {
144 'EXPAND_ONLY_PREDEF': 'YES',
145 'MACRO_EXPANSION': 'YES',
146 'PREDEFINED': 'CEPH_RADOS_API= '
149 # edit_on_github options
150 # the docs are rendered with github links pointing to master. the javascript
151 # snippet in _static/ceph.js rewrites the edit links when a page is loaded, to
152 # point to the correct branch.
153 edit_on_github_project
= 'ceph/ceph'
154 edit_on_github_branch
= 'master'
157 graphviz_output_format
= 'svg'
159 def generate_state_diagram(input_paths
, output_path
):
160 sys
.path
.append(os
.path
.join(top_level
, 'doc', 'scripts'))
161 from gen_state_diagram
import do_filter
, StateMachineRenderer
162 inputs
= [os
.path
.join(top_level
, fn
) for fn
in input_paths
]
163 output
= os
.path
.join(top_level
, output_path
)
166 with fileinput
.input(files
=inputs
) as f
:
168 render
= StateMachineRenderer()
169 render
.read_input(input)
170 with
open(output
, 'w') as dot_output
:
171 render
.emit_dot(dot_output
)
176 # mocking ceph_module offered by ceph-mgr. `ceph_module` is required by
179 def __getattr__(self
, _
):
180 return lambda *args
, **kwargs
: None
186 def __init__(self
, *args
, **kwargs
):
189 def __call__(self
, *args
, **kwargs
):
193 def __getattr__(cls
, name
):
194 mock
= type(name
, (Dummy
,), {})
195 mock
.__module
__ = __name__
200 sys
.modules
['ceph_module'] = Mock()
203 autodoc_mock_imports
= ['ceph']
204 pybinds
= ['pybind/mgr',
212 pybind
= os
.path
.join(top_level
, 'src', c
)
213 if pybind
not in sys
.path
:
214 sys
.path
.insert(0, pybind
)
217 # handles edit-on-github and old version warning display
219 app
.add_js_file('js/ceph.js')
221 # add "ditaa" as an alias of "diagram"
222 from plantweb
.directive
import DiagramDirective
223 app
.add_directive('ditaa', DiagramDirective
)
224 app
.connect('builder-inited',
225 generate_state_diagram(['src/osd/PeeringState.h',
226 'src/osd/PeeringState.cc'],
227 'doc/dev/peering_graph.generated.dot'))