2017-06-25 17:05:31 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# funkwhale documentation build configuration file, created by
|
|
|
|
# sphinx-quickstart on Sun Jun 25 18:49:23 2017.
|
|
|
|
#
|
|
|
|
# This file is execfile()d with the current directory set to its
|
|
|
|
# containing dir.
|
|
|
|
#
|
|
|
|
# Note that not all possible configuration values are present in this
|
|
|
|
# autogenerated file.
|
|
|
|
#
|
|
|
|
# All configuration values have a default; values that are commented out
|
|
|
|
# serve to show the default.
|
|
|
|
|
|
|
|
# If extensions (or modules to document with autodoc) are in another directory,
|
|
|
|
# add these directories to sys.path here. If the directory is relative to the
|
|
|
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
|
|
|
#
|
2017-07-17 20:00:32 +00:00
|
|
|
import os
|
|
|
|
import sys
|
2019-03-13 08:55:03 +00:00
|
|
|
import datetime
|
2017-06-25 17:05:31 +00:00
|
|
|
|
2018-06-24 21:42:38 +00:00
|
|
|
sys.path.insert(0, os.path.abspath("../api"))
|
2020-07-03 08:59:12 +00:00
|
|
|
sys.path.insert(0, os.path.abspath("../api/config"))
|
2017-07-17 20:00:32 +00:00
|
|
|
|
|
|
|
import funkwhale_api # NOQA
|
2017-06-25 17:05:31 +00:00
|
|
|
|
2020-04-20 11:48:19 +00:00
|
|
|
FUNKWHALE_CONFIG = {
|
|
|
|
"FUNKWHALE_URL": "mypod.funkwhale",
|
|
|
|
"FUNKWHAL_PROTOCOL": "https",
|
|
|
|
"DATABASE_URL": "postgres://localhost:5432/db",
|
2020-07-03 08:59:12 +00:00
|
|
|
"AWS_ACCESS_KEY_ID": "my_access_key",
|
|
|
|
"AWS_SECRET_ACCESS_KEY": "my_secret_key",
|
|
|
|
"AWS_STORAGE_BUCKET_NAME": "my_bucket",
|
2020-04-20 11:48:19 +00:00
|
|
|
}
|
|
|
|
for key, value in FUNKWHALE_CONFIG.items():
|
|
|
|
os.environ[key] = value
|
2017-06-25 17:05:31 +00:00
|
|
|
# -- General configuration ------------------------------------------------
|
|
|
|
|
|
|
|
# If your documentation needs a minimal Sphinx version, state it here.
|
|
|
|
#
|
|
|
|
# needs_sphinx = '1.0'
|
|
|
|
|
|
|
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
|
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
|
|
|
# ones.
|
2022-01-19 18:49:46 +00:00
|
|
|
extensions = [
|
|
|
|
"sphinx.ext.graphviz",
|
|
|
|
"sphinx.ext.autodoc",
|
|
|
|
"myst_parser",
|
2022-07-23 13:32:35 +00:00
|
|
|
"sphinx_design",
|
2022-03-02 13:00:44 +00:00
|
|
|
"sphinx_multiversion",
|
2022-01-19 18:49:46 +00:00
|
|
|
]
|
2022-01-09 11:40:49 +00:00
|
|
|
autodoc_mock_imports = [
|
|
|
|
"celery",
|
|
|
|
"django_auth_ldap",
|
|
|
|
"ldap",
|
|
|
|
"persisting_theory",
|
|
|
|
"rest_framework",
|
2022-07-23 13:32:35 +00:00
|
|
|
"drf_spectacular",
|
2022-01-09 11:40:49 +00:00
|
|
|
]
|
2020-04-20 11:48:19 +00:00
|
|
|
add_module_names = False
|
2017-06-25 17:05:31 +00:00
|
|
|
# Add any paths that contain templates here, relative to this directory.
|
2018-06-24 21:42:38 +00:00
|
|
|
templates_path = ["_templates"]
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# The suffix(es) of source filenames.
|
|
|
|
# You can specify multiple suffix as a list of string:
|
|
|
|
#
|
|
|
|
# source_suffix = ['.rst', '.md']
|
2018-06-24 21:42:38 +00:00
|
|
|
source_suffix = ".rst"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
2021-09-21 11:36:16 +00:00
|
|
|
# The root toctree document.
|
|
|
|
root_doc = "index"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
2022-07-23 13:32:35 +00:00
|
|
|
# Enable colon fences
|
|
|
|
myst_enable_extensions = ["colon_fence"]
|
|
|
|
|
2022-07-01 09:02:29 +00:00
|
|
|
# Autogenerate anchors
|
|
|
|
|
|
|
|
myst_heading_anchors = 3
|
|
|
|
|
2017-06-25 17:05:31 +00:00
|
|
|
# General information about the project.
|
2019-03-13 08:55:03 +00:00
|
|
|
year = datetime.datetime.now().year
|
2018-06-24 21:42:38 +00:00
|
|
|
project = "funkwhale"
|
2021-06-17 12:56:05 +00:00
|
|
|
copyright = "{}, The Funkwhale Collective".format(year)
|
|
|
|
author = "The Funkwhale Collective"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# The version info for the project you're documenting, acts as replacement for
|
|
|
|
# |version| and |release|, also used in various other places throughout the
|
|
|
|
# built documents.
|
2022-03-21 11:01:29 +00:00
|
|
|
# Read version from the API
|
|
|
|
version = funkwhale_api.__version__
|
2017-07-17 20:00:32 +00:00
|
|
|
release = version
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
|
|
|
# for a list of supported languages.
|
|
|
|
#
|
|
|
|
# This is also used if you do content translation via gettext catalogs.
|
|
|
|
# Usually you set "language" from the command line for these cases.
|
|
|
|
language = None
|
|
|
|
|
|
|
|
# List of patterns, relative to source directory, that match files and
|
|
|
|
# directories to ignore when looking for source files.
|
|
|
|
# This patterns also effect to html_static_path and html_extra_path
|
2018-06-24 21:42:38 +00:00
|
|
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# The name of the Pygments (syntax highlighting) style to use.
|
2018-06-24 21:42:38 +00:00
|
|
|
pygments_style = "sphinx"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
|
|
|
todo_include_todos = False
|
|
|
|
|
|
|
|
# -- Options for HTML output ----------------------------------------------
|
|
|
|
|
|
|
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
|
|
|
# a list of builtin themes.
|
|
|
|
#
|
2019-10-02 14:27:59 +00:00
|
|
|
html_theme = "sphinx_rtd_theme"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# Theme options are theme-specific and customize the look and feel of a theme
|
|
|
|
# further. For a list of options available for each theme, see the
|
|
|
|
# documentation.
|
|
|
|
#
|
2022-01-09 11:40:49 +00:00
|
|
|
# html_theme_options = {}
|
2019-10-02 14:27:59 +00:00
|
|
|
html_context = {
|
2020-03-02 16:23:03 +00:00
|
|
|
"display_gitlab": True,
|
|
|
|
"gitlab_host": "dev.funkwhale.audio",
|
|
|
|
"gitlab_repo": "funkwhale",
|
|
|
|
"gitlab_user": "funkwhale",
|
2021-09-21 11:36:16 +00:00
|
|
|
"gitlab_version": "stable",
|
2020-03-02 16:23:03 +00:00
|
|
|
"conf_py_path": "/docs/",
|
2021-06-17 12:56:05 +00:00
|
|
|
"gitlab_url": "https://dev.funkwhale.audio/funkwhale/funkwhale",
|
2019-10-02 14:27:59 +00:00
|
|
|
}
|
2020-03-02 16:23:03 +00:00
|
|
|
html_logo = "logo.svg"
|
2021-06-17 12:56:05 +00:00
|
|
|
html_favicon = "../front/public/favicon.png"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# Add any paths that contain custom static files (such as style sheets) here,
|
|
|
|
# relative to this directory. They are copied after the builtin static files,
|
|
|
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
2022-04-26 12:04:02 +00:00
|
|
|
html_static_path = ["_static"]
|
|
|
|
html_css_files = [
|
|
|
|
"css/translation-hint.css",
|
|
|
|
]
|
|
|
|
html_js_files = [
|
|
|
|
"js/translation-hint.js",
|
|
|
|
]
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
# -- Options for HTMLHelp output ------------------------------------------
|
|
|
|
|
|
|
|
# Output file base name for HTML help builder.
|
2018-06-24 21:42:38 +00:00
|
|
|
htmlhelp_basename = "funkwhaledoc"
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -- Options for LaTeX output ---------------------------------------------
|
|
|
|
|
|
|
|
latex_elements = {
|
|
|
|
# The paper size ('letterpaper' or 'a4paper').
|
|
|
|
#
|
|
|
|
# 'papersize': 'letterpaper',
|
|
|
|
# The font size ('10pt', '11pt' or '12pt').
|
|
|
|
#
|
|
|
|
# 'pointsize': '10pt',
|
|
|
|
# Additional stuff for the LaTeX preamble.
|
|
|
|
#
|
|
|
|
# 'preamble': '',
|
|
|
|
# Latex figure (float) alignment
|
|
|
|
#
|
|
|
|
# 'figure_align': 'htbp',
|
|
|
|
}
|
|
|
|
|
|
|
|
# Grouping the document tree into LaTeX files. List of tuples
|
|
|
|
# (source start file, target name, title,
|
|
|
|
# author, documentclass [howto, manual, or own class]).
|
|
|
|
latex_documents = [
|
2022-01-09 11:40:49 +00:00
|
|
|
(
|
|
|
|
root_doc,
|
|
|
|
"funkwhale.tex",
|
|
|
|
"funkwhale Documentation",
|
|
|
|
"The Funkwhale Collective",
|
|
|
|
"manual",
|
|
|
|
)
|
2017-06-25 17:05:31 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
# -- Options for manual page output ---------------------------------------
|
|
|
|
|
|
|
|
# One entry per manual page. List of tuples
|
|
|
|
# (source start file, name, description, authors, manual section).
|
2021-09-21 11:36:16 +00:00
|
|
|
man_pages = [(root_doc, "funkwhale", "funkwhale Documentation", [author], 1)]
|
2017-06-25 17:05:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -- Options for Texinfo output -------------------------------------------
|
|
|
|
|
|
|
|
# Grouping the document tree into Texinfo files. List of tuples
|
|
|
|
# (source start file, target name, title, author,
|
|
|
|
# dir menu entry, description, category)
|
|
|
|
texinfo_documents = [
|
2018-06-24 21:42:38 +00:00
|
|
|
(
|
2021-09-21 11:36:16 +00:00
|
|
|
root_doc,
|
2018-06-24 21:42:38 +00:00
|
|
|
"funkwhale",
|
|
|
|
"funkwhale Documentation",
|
|
|
|
author,
|
|
|
|
"funkwhale",
|
|
|
|
"One line description of project.",
|
|
|
|
"Miscellaneous",
|
|
|
|
)
|
2017-06-25 17:05:31 +00:00
|
|
|
]
|
2019-03-13 08:55:03 +00:00
|
|
|
|
|
|
|
# -- Build legacy redirect files -------------------------------------------
|
|
|
|
|
|
|
|
# Define list of redirect files to be build in the Sphinx build process
|
|
|
|
|
2022-07-01 09:02:29 +00:00
|
|
|
redirect_list = []
|
|
|
|
with open("redirects.txt", "r") as fp:
|
|
|
|
data_list = [tuple(line.strip().split(",")) for line in fp]
|
2019-03-13 08:55:03 +00:00
|
|
|
|
|
|
|
# Generate redirect template
|
|
|
|
|
|
|
|
redirect_template = """\
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="refresh" content="1; url={new}" />
|
|
|
|
<script>
|
|
|
|
window.location.href = "{new}"
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
</html>
|
|
|
|
"""
|
|
|
|
|
|
|
|
# Tell Sphinx to copy the files
|
|
|
|
|
2020-03-02 16:23:03 +00:00
|
|
|
|
2019-03-13 08:55:03 +00:00
|
|
|
def copy_legacy_redirects(app, docname):
|
2020-03-02 16:23:03 +00:00
|
|
|
if app.builder.name == "html":
|
2022-07-01 09:02:29 +00:00
|
|
|
for html_src_path, new in data_list:
|
2019-03-13 08:55:03 +00:00
|
|
|
page = redirect_template.format(new=new)
|
2020-03-02 16:23:03 +00:00
|
|
|
target_path = app.outdir + "/" + html_src_path
|
2019-03-13 08:55:03 +00:00
|
|
|
if not os.path.exists(os.path.dirname(target_path)):
|
2020-03-02 16:23:03 +00:00
|
|
|
os.makedirs(os.path.dirname(target_path))
|
|
|
|
with open(target_path, "w") as f:
|
|
|
|
f.write(page)
|
2019-03-13 08:55:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def setup(app):
|
2020-03-02 16:23:03 +00:00
|
|
|
app.connect("build-finished", copy_legacy_redirects)
|
2022-03-02 13:00:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
smv_tag_whitelist = None
|
|
|
|
smv_branch_whitelist = r"(stable|develop)$"
|
2022-04-26 12:04:02 +00:00
|
|
|
|
|
|
|
# Internationalization settings
|
|
|
|
locale_dirs = ["locales/"]
|
|
|
|
gettext_compact = False
|