14 os
.path
.abspath(__file__
)))
16 pybind_rgw_mod
= __import__('rgw', globals(), locals(), [], 0)
17 sys
.modules
['pybind_rgw_mod'] = pybind_rgw_mod
20 def parse_ceph_release():
21 with
open(os
.path
.join(top_level
, 'src/ceph_release')) as f
:
23 assert(len(lines
) == 3)
25 version
, codename
, status
= [line
.strip() for line
in lines
]
26 return version
, codename
, status
29 def latest_stable_release():
30 with
open(os
.path
.join(top_level
, 'doc/releases/releases.yml')) as input:
31 releases
= yaml
.safe_load(input)['releases']
32 # get the first release
33 return next(iter(releases
.keys()))
36 def is_release_eol(codename
):
37 with
open(os
.path
.join(top_level
, 'doc/releases/releases.yml')) as input:
38 releases
= yaml
.safe_load(input)['releases']
39 return 'actual_eol' in releases
.get(codename
, {})
44 copyright
= ('2016, Ceph authors and contributors. '
45 'Licensed under Creative Commons Attribution Share Alike 3.0 '
47 version
, codename
, release
= parse_ceph_release()
48 pygments_style
= 'sphinx'
52 html_theme_options
= {
54 'display_version': False,
55 'prev_next_buttons_location': 'bottom',
56 'style_external_links': False,
57 'vcs_pageview_mode': 'edit',
58 'style_nav_header_background': '#eee',
60 'collapse_navigation': True,
61 'sticky_navigation': True,
62 'navigation_depth': 4,
63 'includehidden': True,
66 html_theme_path
= ['_themes']
67 html_title
= "Ceph Documentation"
68 html_logo
= 'logo.png'
69 html_context
= {'is_release_eol': is_release_eol(codename
)}
70 html_favicon
= 'favicon.ico'
71 html_show_sphinx
= False
72 html_static_path
= ["_static"]
74 '**': ['smarttoc.html', 'searchbox.html']
77 html_css_files
= ['css/custom.css']
79 # general configuration
80 templates_path
= ['_templates']
81 source_suffix
= '.rst'
82 exclude_patterns
= ['**/.#*',
84 'start/quick-common.rst',
86 if tags
.has('man'): # noqa: F821
87 master_doc
= 'man_index'
88 exclude_patterns
+= ['index.rst',
109 exclude_patterns
+= ['man_index.rst']
111 build_with_rtd
= os
.environ
.get('READTHEDOCS') == 'True'
113 sys
.path
.insert(0, os
.path
.abspath('_ext'))
115 smartquotes_action
= "qe"
118 'sphinx.ext.autodoc',
119 'sphinx.ext.graphviz',
120 'sphinx.ext.mathjax',
123 'sphinx_autodoc_typehints',
124 'sphinx_substitution_extensions',
129 'sphinxcontrib.mermaid',
130 'sphinxcontrib.openapi',
131 'sphinxcontrib.seqdiag',
134 ditaa
= shutil
.which("ditaa")
135 if ditaa
is not None:
136 # in case we don't have binfmt_misc enabled or jar is not registered
137 ditaa_args
= ['-jar', ditaa
]
139 extensions
+= ['sphinxcontrib.ditaa']
141 extensions
+= ['plantweb.directive']
142 plantweb_defaults
= {
147 extensions
+= ['sphinx_search.extension']
149 # sphinx.ext.todo options
150 todo_include_todos
= True
152 # sphinx_substitution_extensions options
154 .. |stable-release| replace:: {latest_stable_release()}
158 breathe_default_project
= "Ceph"
159 # see $(top_srcdir)/Doxyfile
161 breathe_build_directory
= os
.path
.join(top_level
, "build-doc")
162 breathe_projects
= {"Ceph": os
.path
.join(top_level
, breathe_build_directory
)}
163 breathe_projects_source
= {
164 "Ceph": (os
.path
.join(top_level
, "src/include/rados"),
165 ["rados_types.h", "librados.h"])
167 breathe_domain_by_extension
= {'py': 'py',
169 'cc': 'cxx', 'hpp': 'cxx'}
170 breathe_doxygen_config_options
= {
171 'EXPAND_ONLY_PREDEF': 'YES',
172 'MACRO_EXPANSION': 'YES',
173 'PREDEFINED': 'CEPH_RADOS_API= ',
174 'WARN_IF_UNDOCUMENTED': 'NO',
178 graphviz_output_format
= 'svg'
180 def generate_state_diagram(input_paths
, output_path
):
181 sys
.path
.append(os
.path
.join(top_level
, 'doc', 'scripts'))
182 from gen_state_diagram
import do_filter
, StateMachineRenderer
183 inputs
= [os
.path
.join(top_level
, fn
) for fn
in input_paths
]
184 output
= os
.path
.join(top_level
, output_path
)
187 with fileinput
.input(files
=inputs
) as f
:
189 render
= StateMachineRenderer()
190 render
.read_input(input)
191 with
open(output
, 'w') as dot_output
:
192 render
.emit_dot(dot_output
)
197 # mocking ceph_module offered by ceph-mgr. `ceph_module` is required by
200 def __getattr__(self
, _
):
201 return lambda *args
, **kwargs
: None
207 def __init__(self
, *args
, **kwargs
):
210 def __call__(self
, *args
, **kwargs
):
214 def __getattr__(cls
, name
):
215 mock
= type(name
, (Dummy
,), {})
216 mock
.__module
__ = __name__
221 sys
.modules
['ceph_module'] = Mock()
224 autodoc_mock_imports
= ['ceph']
225 pybinds
= ['pybind/mgr',
233 pybind
= os
.path
.join(top_level
, 'src', c
)
234 if pybind
not in sys
.path
:
235 sys
.path
.insert(0, pybind
)
238 openapi_logger
= sphinx
.util
.logging
.getLogger('sphinxcontrib.openapi.openapi30')
239 openapi_logger
.setLevel(logging
.WARNING
)
242 seqdiag_antialias
= True
243 seqdiag_html_image_format
= 'SVG'
246 ceph_confval_imports
= glob
.glob(os
.path
.join(top_level
,
247 'src/common/options',
249 ceph_confval_mgr_module_path
= 'src/pybind/mgr'
250 ceph_confval_mgr_python_path
= 'src/pybind'
252 # handles edit-on-github and old version warning display
255 # add "ditaa" as an alias of "diagram"
256 from plantweb
.directive
import DiagramDirective
257 app
.add_directive('ditaa', DiagramDirective
)
258 app
.connect('builder-inited',
259 generate_state_diagram(['src/osd/PeeringState.h',
260 'src/osd/PeeringState.cc'],
261 'doc/dev/peering_graph.generated.dot'))