1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# Bareos Main Reference documentation build configuration file, created by
5# sphinx-quickstart on Wed Feb 21 16:41:30 2018.
6#
7# This file is execfile()d with the current directory set to its
8# containing dir.
9#
10# Note that not all possible configuration values are present in this
11# autogenerated file.
12#
13# All configuration values have a default; values that are commented out
14# serve to show the default.
15
16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the
18# documentation root, use os.path.abspath to make it absolute, like shown here.
19#
20import os
21import sys
22
23sys.path.insert(0, os.path.abspath("./_extensions"))
24
25import datetime
26
27# -- General configuration ------------------------------------------------
28
29# Substitutions have been CamelCase in the past.
30# Now they are all lowercase.
31# CamelCase version can be removed,
32# when they are no longer required.
33
34# about <isonum.txt>, see
35# http://docutils.sourceforge.net/docs/ref/rst/definitions.html#substitution-definitions
36# http://docutils.sourceforge.net/docutils/parsers/rst/include/isonum.txt
37rst_epilog = """
38.. include:: <isonum.txt>
39.. |checkmark| unicode:: U+2713
40
41.. |configCharsToQuote| replace:: ``&<>()@^|``
42
43.. |bareosFd| replace:: Bareos File Daemon
44.. |fd| replace:: Bareos File Daemon
45.. |bareosSd| replace:: Bareos Storage Daemon
46.. |sd| replace:: Bareos Storage Daemon
47.. |bareosDir| replace:: Bareos Director
48.. |dir| replace:: Bareos Director
49.. |bconsole| replace:: Bareos Console
50.. |bareosTraymonitor| replace:: Bareos Traymonitor
51.. |traymonitor| replace:: Bareos Traymonitor
52.. |bareosWebui| replace:: Bareos Webui
53.. |webui| replace:: Bareos WebUI
54.. |mysql| replace:: MySQL/MariaDB
55.. |postgresql| replace:: PostgreSQL
56.. |sqlite| replace:: Sqlite
57.. |vmware| replace:: VMware
58.. |vsphere| replace:: VMware vSphere
59
60.. |ndmpbareos| replace:: :ref:`section-NdmpBareos`
61.. |ndmpnative| replace:: :ref:`section-NdmpNative`
62
63"""
64
65
66# If your documentation needs a minimal Sphinx version, state it here.
67#
68# needs_sphinx = '1.0'
69
70# Add any Sphinx extension module names here, as strings. They can be
71# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
72# ones.
73extensions = [
74    "bareos-ext",
75    "limitation",
76    "sphinx_issues",
77    "sphinx.ext.autosectionlabel",
78    "sphinx.ext.coverage",
79    "sphinx.ext.todo",
80    "sphinxcontrib.actdiag",
81    "sphinxcontrib.blockdiag",
82    "sphinxcontrib.nwdiag",
83    "sphinxcontrib.plantuml",
84    "sphinxcontrib.seqdiag",
85    "crate.sphinx.csv",
86]
87
88#    'limitation',
89# extensions.append('limitation')
90
91
92# True to prefix each section label with the name of the document it is in, followed by a colon.
93# For example, index:Introduction for a section called Introduction that appears in document index.rst.
94# Useful for avoiding ambiguity when the same section heading appears in different documents.
95autosectionlabel_prefix_document = True
96
97issues_github_path = "bareos/bareos"
98# issues_uri = 'https://bugs.bareos.org/view.php?id={issue}'
99# issues_pr_uri = 'https://github.com/bareos/bareos/pull/{pr}'
100
101
102# Add any paths that contain templates here, relative to this directory.
103templates_path = ["_templates"]
104
105# The suffix(es) of source filenames.
106# You can specify multiple suffix as a list of string:
107#
108# source_suffix = ['.rst', '.md']
109source_suffix = ".rst"
110
111# The master toctree document.
112master_doc = "index"
113
114# General information about the project.
115project = "Bareos Documentation"
116copyright = str(datetime.datetime.now().year) + " Bareos GmbH & Co. KG and others."
117author = "Bareos GmbH & Co. KG"
118
119# The language for content autogenerated by Sphinx. Refer to documentation
120# for a list of supported languages.
121#
122# This is also used if you do content translation via gettext catalogs.
123# Usually you set "language" from the command line for these cases.
124language = None
125
126# List of patterns, relative to source directory, that match files and
127# directories to ignore when looking for source files.
128# This patterns also effect to html_static_path and html_extra_path
129exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
130
131# The name of the Pygments (syntax highlighting) style to use.
132pygments_style = "sphinx"
133
134# If true, `todo` and `todoList` produce output, else they produce nothing.
135todo_include_todos = True
136
137
138# -- Options for HTML output ----------------------------------------------
139
140# The theme to use for HTML and HTML Help pages.  See the documentation for
141# a list of builtin themes.
142#
143html_theme = "sphinx_rtd_theme"
144
145# Theme options are theme-specific and customize the look and feel of a theme
146# further.  For a list of options available for each theme, see the
147# documentation.
148#
149# html_theme_options = {}
150
151# html_theme_options = {
152#    'canonical_url': '',
153#    'analytics_id': '',
154#    'logo_only': False,
155#    'display_version': True,
156#    'prev_next_buttons_location': 'bottom',
157#    'style_external_links': False,
158#    'vcs_pageview_mode': '',
159#    # Toc options
160#    'collapse_navigation': False,
161#    'sticky_navigation': True,
162#    'navigation_depth': 4,
163#    'includehidden': True,
164#    'titles_only': False
165# }
166
167# Enable link of 'View page source'
168# html_show_sourcelink = False
169# Add 'Edit on Github' link instead of 'View page source'
170# reference:https://docs.readthedocs.io/en/latest/vcs.html
171html_context = {
172    # Enable the "Edit in GitHub link within the header of each page.
173    "display_github": True,
174    # Set the following variables to generate the resulting github URL for each page.
175    # Format Template: https://{{ github_host|default("github.com") }}/{{ github_user }}
176    # /{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}
177    # https://github.com/runawayhorse001/SphinxGithub/blob/master/doc/index.rst
178    "github_user": "bareos",
179    "github_repo": "bareos",
180    "conf_py_path": "/docs/manuals/source/",
181    "READTHEDOCS": True,
182    "commit": datetime.date.today().strftime("%B %d, %Y"),
183}
184
185# Add any paths that contain custom static files (such as style sheets) here,
186# relative to this directory. They are copied after the builtin static files,
187# so a file named "default.css" will overwrite the builtin "default.css".
188# html_static_path = ['_static']
189
190# Custom sidebar templates, must be a dictionary that maps document names
191# to template names.
192#
193# This is required for the alabaster theme
194# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
195html_sidebars = {
196    "**": [
197        "relations.html",  # needs 'show_related': True theme option to display
198        "searchbox.html",
199    ]
200}
201
202# -- Options for HTMLHelp output ------------------------------------------
203
204# Output file base name for HTML help builder.
205htmlhelp_basename = "BareosDocumentation"
206
207
208# -- Options for LaTeX output ---------------------------------------------
209
210latex_elements = {
211    # The paper size ('letterpaper' or 'a4paper').
212    #
213    # 'papersize': 'letterpaper',
214    # The font size ('10pt', '11pt' or '12pt').
215    #
216    # 'pointsize': '10pt',
217    # Additional stuff for the LaTeX preamble.
218    #
219    # 'preamble': '',
220    # Latex figure (float) alignment
221    #
222    # 'figure_align': 'htbp',
223}
224
225# Grouping the document tree into LaTeX files. List of tuples
226# (source start file, target name, title,
227#  author, documentclass [howto, manual, or own class]).
228latex_documents = [
229    (
230        master_doc,
231        "BareosMainReference.tex",
232        "Bareos Main Reference Documentation",
233        "Bareos GmbH & Co. KG",
234        "manual",
235    )
236]
237
238
239# -- Options for manual page output ---------------------------------------
240
241man_bareos_dbcopy = "man/bareos-dbcopy"
242
243# One entry per manual page. List of tuples
244# (source start file, name, description, authors, manual section).
245man_pages = [(man_bareos_dbcopy, "bareos-dbcopy", "Copy the Bareos catalog database between catalog backends", [author], 8)]
246
247
248# -- Options for Texinfo output -------------------------------------------
249
250# Grouping the document tree into Texinfo files. List of tuples
251# (source start file, target name, title, author,
252#  dir menu entry, description, category)
253texinfo_documents = [
254    (
255        master_doc,
256        "BareosDocumentation",
257        "Bareos Documentation",
258        author,
259        "BareosDocumenation",
260        "One line description of project.",
261        "Miscellaneous",
262    )
263]
264
265
266import re
267
268# settings for sphinxcontrib-versioning
269scv_whitelist_branches = (
270    re.compile(r"^master$"),
271    re.compile(r"^bareos-18.2$"),
272    re.compile(r"^bareos-19.2$"),
273)
274scv_whitelist_tags = (re.compile(r"^not-exisiting-tag$"),)
275scv_show_banner = True
276scv_priority = "branches"
277scv_root_ref = "bareos-19.2"
278scv_banner_main_ref = "bareos-19.2"
279
280
281plantuml_output_format = "svg_img"
282
283
284#
285# code-block highlighting
286#
287from sphinx.highlighting import lexers
288from bareos_lexers import *
289
290lexers["bareosconfig"] = BareosConfigLexer()
291lexers["bconsole"] = BareosConsoleLexer()
292lexers["bareoslog"] = BareosLogLexer()
293lexers["bareosmessage"] = BareosMessageLexer()
294
295
296# generate rst.inc files from json files
297import subprocess
298import os
299
300os.chdir("..")
301subprocess.call(["pwd"])
302subprocess.call(
303    [
304        "scripts/generate-resoure-descriptions.py",
305        "--sphinx",
306        "source/include/autogenerated/bareos-dir-config-schema.json",
307    ]
308)
309subprocess.call(
310    [
311        "scripts/generate-resoure-descriptions.py",
312        "--sphinx",
313        "source/include/autogenerated/bareos-sd-config-schema.json",
314    ]
315)
316subprocess.call(
317    [
318        "scripts/generate-resoure-descriptions.py",
319        "--sphinx",
320        "source/include/autogenerated/bareos-fd-config-schema.json",
321    ]
322)
323subprocess.call(
324    [
325        "scripts/generate-resoure-descriptions.py",
326        "--sphinx",
327        "source/include/autogenerated/bconsole-config-schema.json",
328    ]
329)
330subprocess.call(
331    [
332        "scripts/generate-resoure-descriptions.py",
333        "--sphinx",
334        "source/include/autogenerated/bareos-tray-monitor-config-schema.json",
335    ]
336)
337subprocess.call(
338    "scripts/generate-bareos-package-info.py --out source/include/autogenerated/ source/data/bareos-*-packages.json",
339    shell=True,
340)
341