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
|
|
|
|
from shutil import copyfile
|
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.
|
2020-04-20 11:48:19 +00:00
|
|
|
extensions = ["sphinx.ext.graphviz", "sphinx.ext.autodoc"]
|
2020-07-03 08:59:12 +00:00
|
|
|
autodoc_mock_imports = ["celery", "django_auth_ldap", "ldap", "persisting_theory", "rest_framework"]
|
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
|
|
|
|
|
|
|
# The master toctree document.
|
2018-06-24 21:42:38 +00:00
|
|
|
master_doc = "index"
|
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.
|
|
|
|
#
|
|
|
|
# The short X.Y version.
|
2018-02-27 12:18:49 +00:00
|
|
|
version = funkwhale_api.__version__
|
2019-01-21 15:44:57 +00:00
|
|
|
if "-dev" in version:
|
|
|
|
version = "develop"
|
2017-06-25 17:05:31 +00:00
|
|
|
# The full version, including alpha/beta/rc tags.
|
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.
|
|
|
|
#
|
2021-06-17 12:56:05 +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",
|
|
|
|
"gitlab_version": "master",
|
|
|
|
"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".
|
2021-06-17 12:56:05 +00:00
|
|
|
# html_static_path = ["_static"]
|
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 = [
|
2018-06-24 21:42:38 +00:00
|
|
|
(master_doc, "funkwhale.tex", "funkwhale Documentation", "Eliot Berriot", "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).
|
2018-06-24 21:42:38 +00:00
|
|
|
man_pages = [(master_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
|
|
|
(
|
|
|
|
master_doc,
|
|
|
|
"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
|
|
|
|
|
|
|
|
redirect_files = [
|
2020-03-02 16:23:03 +00:00
|
|
|
("importing-music.html", "admin/importing-music.html"),
|
|
|
|
("architecture.html", "developers/architecture.html"),
|
|
|
|
("troubleshooting.html", "admin/troubleshooting.html"),
|
|
|
|
("configuration.html", "admin/configuration.html"),
|
|
|
|
("upgrading/index.html", "../admin/upgrading.html"),
|
|
|
|
("upgrading/0.17.html", "../admin/0.17.html"),
|
|
|
|
("users/django.html", "../admin/django.html"),
|
2021-06-17 12:56:05 +00:00
|
|
|
("cli/index.html", "../users/cli.html"),
|
|
|
|
("cli/examples.html", "../users/cli.html#examples"),
|
|
|
|
("installation/ldap.html", "../admin/ldap.html"),
|
|
|
|
("installation/optimization.html", "../admin/optimization.html"),
|
|
|
|
("installation/external_dependencies.html", "debian.html"),
|
|
|
|
("installation/systemd.html", "debian.html#systemd-unit-file"),
|
|
|
|
("backup.html", "../admin/backup.html"),
|
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":
|
2019-03-13 08:55:03 +00:00
|
|
|
for html_src_path, new in redirect_files:
|
|
|
|
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)
|