From 57b2f1f5d83b5f2bca8b02a06afe78cf6d658a1b Mon Sep 17 00:00:00 2001 From: vladimirhasko Date: Thu, 16 Feb 2023 07:44:26 +0000 Subject: [PATCH] Update tox.ini && conf.py file Performed-by: gitea/infra/otc-metadata/tools/generate_doc_confpy.py --- api-ref/source/conf.py | 113 ++++++++++++++++---------- doc/requirements.txt | 4 +- tox.ini | 175 ++++++++++++++++++++++++++--------------- umn/source/conf.py | 113 ++++++++++++++++---------- 4 files changed, 256 insertions(+), 149 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index ca99e5d..f820a15 100755 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -1,75 +1,106 @@ -# -*- coding: utf-8 -*- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# !!! +# This file is generated out of template in doc-exports repository. +# Beware overwriting it locally. import os import sys -sys.path.insert(0, os.path.abspath('../..')) +extensions = [ + 'otcdocstheme' +] + +otcdocs_auto_name = False +otcdocs_auto_version = False + +project = 'Distributed Database Middleware' +otcdocs_repo_name = 'docs/distributed-database-middleware' +# Those variables are required for edit/bug links +otcdocs_git_fqdn = 'gitea.eco.tsi-dev.otc-service.com' +otcdocs_git_type = 'gitea' + +# 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. +sys.path.insert(0, os.path.abspath('../../')) +sys.path.insert(0, os.path.abspath('../')) +sys.path.insert(0, os.path.abspath('./')) + # -- General configuration ---------------------------------------------------- +# https://docutils.sourceforge.io/docs/user/smartquotes.html - it does not +# what it is expected +smartquotes = False # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - 'otcdocstheme', -] - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' +# The encoding of source files. +# +source_encoding = 'utf-8' + # The master toctree document. master_doc = 'index' # General information about the project. -project = 'distributed-database-middleware' -copyright = '2022, Open Telekom Cloud Developers' +copyright = u'2022-present, Open Telekom Cloud' -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +language = 'en' -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'native' +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = False # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] html_theme = 'otcdocs' -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +# 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. +html_theme_options = { + "disable_search": True, + "site_name": "Internal Documentation Portal", + "logo_url": "https://docs-int.otc-service.com", +} -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". + +html_title = "Distributed Database Middleware - API Reference" + + +# 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". +html_static_path = ['_static'] + +# Do not include sources into the rendered results +html_copy_source = False + +# -- Options for PDF output -------------------------------------------------- latex_documents = [ ('index', - '%s.tex' % project, - '%s Documentation' % project, - 'Open Telekom Cloud Developers', 'manual'), + 'ddm-api-ref.tex', + u'Distributed Database Middleware - API Reference', + u'OpenTelekomCloud', 'manual'), ] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/requirements.txt b/doc/requirements.txt index 23b871f..ea68e86 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,4 +1,4 @@ sphinx>=2.0.0,!=2.1.0 # BSD -otcdocstheme>=1.0.0 # Apache-2.0 +otcdocstheme # Apache-2.0 # releasenotes -reno>=3.1.0 # Apache-2.0 +reno>=3.1.0 # Apache-2.0 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 5a5506d..130e82a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.1 -envlist = py310,pep8 +envlist = py39,pep8 skipsdist = True ignore_basepython_conflict = True @@ -8,88 +8,133 @@ ignore_basepython_conflict = True usedevelop = True install_command = pip install {opts} {packages} deps = - -r{toxinidir}/requirements.txt + -r{toxinidir}/requirements.txt commands = stestr run {posargs} - stestr slowest + stestr slowest [testenv:pep8] commands = - doc8 doc/source README.rst + doc8 doc/source README.rst [testenv:venv] deps = - -r{toxinidir}/requirements.txt + -r{toxinidir}/requirements.txt commands = {posargs} +# This env is invoked in the periodic pipeline and is therefore responsible to +# build all relevant docs at once. [testenv:docs] -deps = - -r{toxinidir}/doc/requirements.txt +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + mkdir + cp + sh commands = - sphinx-build -W --keep-going -b html doc/source/ doc/build/html + {[testenv:api-ref]commands} + {[testenv:json-api-ref]commands} + {[testenv:umn]commands} + {[testenv:json-umn]commands} -[testenv:api-ref] -# This environment is called from CI scripts to test and publish -# the API Ref to docs.otc-service.com -deps = - -r{toxinidir}/requirements.txt -whitelist_externals = rm -commands = - rm -rf api-ref/build - sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html - -[testenv:api-ref-pdf-docs] -deps = {[testenv:api-ref]deps} -envdir = {toxworkdir}/api-ref -whitelist_externals = - rm - make -commands = - rm -rf api-ref/build/pdf - sphinx-build -a -E -W -b latex api-ref/source api-ref/build/pdf - make -C api-ref/build/pdf - -[testenv:umn] -# This environment is called from CI scripts to test and publish -# the UMN to docs.otc-service.com -deps = - -r{toxinidir}/requirements.txt -whitelist_externals = rm -commands = - rm -rf umn/build - sphinx-build -W -b html -d umn/build/doctrees umn/source umn/build/html - -[testenv:umn-pdf-docs] -deps = {[testenv:umn]deps} -envdir = {toxworkdir}/umn -whitelist_externals = +[testenv:docs-pdf] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = rm + mkdir make bash + cp +commands = + mkdir -p doc/build/pdf + {[testenv:api-ref-pdf-docs]commands} + {[testenv:umn-pdf-docs]commands} + + +# HTML version +[testenv:api-ref] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + cp + mkdir +commands = + sphinx-build -W --keep-going -b html api-ref/source doc/build/html/api-ref + mkdir -p api-ref/build/html + cp -av doc/build/html/api-ref api-ref/build/html + +# Json version (for search) +[testenv:json-api-ref] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + cp + mkdir + sh +commands = + sphinx-build -W --keep-going -b json api-ref/source doc/build/json/api-ref + # Drop data useless for the search - wrap it also with sh/xargs due to bugs + # in tox + sh -c "find doc/build/json -type d -and '(' -name '_images' -or -name '_static' -or -name '_sources' ')' -print0 | xargs -0 rm -rf" + mkdir -p api-ref/build/json + cp -av doc/build/json/api-ref api-ref/build/json + +# PDF version +[testenv:api-ref-pdf-docs] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + rm + mkdir + make + bash + cp +commands = + rm -rf api-ref/build/pdf + sphinx-build -W --keep-going -b latex api-ref/source api-ref/build/pdf/ + bash -c "for f in api-ref/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" + bash -c "for f in api-ref/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" + make -C api-ref/build/pdf + mkdir -p doc/build/pdf + cp api-ref/build/pdf/ddm-api-ref.pdf doc/build/pdf/ + + +# HTML version +[testenv:umn] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + cp + mkdir +commands = + sphinx-build -W --keep-going -b html umn/source doc/build/html/umn + mkdir -p umn/build/html + cp -av doc/build/html/umn umn/build/html + +# Json version (for search) +[testenv:json-umn] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + cp + mkdir + sh +commands = + sphinx-build -W --keep-going -b json umn/source doc/build/json/umn + # Drop data useless for the search - wrap it also with sh/xargs due to bugs + # in tox + sh -c "find doc/build/json -type d -and '(' -name '_images' -or -name '_static' -or -name '_sources' ')' -print0 | xargs -0 rm -rf" + mkdir -p umn/build/json + cp -av doc/build/json/umn umn/build/json + +# PDF version +[testenv:umn-pdf-docs] +deps = -r{toxinidir}/doc/requirements.txt +allowlist_externals = + rm + mkdir + make + bash + cp commands = rm -rf umn/build/pdf - sphinx-build -a -E -W -b latex umn/source umn/build/pdf + sphinx-build -W --keep-going -b latex umn/source umn/build/pdf/ bash -c "for f in umn/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true" bash -c "for f in umn/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done" make -C umn/build/pdf + mkdir -p doc/build/pdf + cp umn/build/pdf/ddm-umn.pdf doc/build/pdf/ -[testenv:dev-guide] -# This environment is called from CI scripts to test and publish -# the Developer Guide to docs.otc-service.com -deps = - -r{toxinidir}/requirements.txt -whitelist_externals = rm -commands = - rm -rf dev_guide/build - sphinx-build -W -b html -d dev_guide/build/doctrees dev_guide/source dev_guide/build/html - -[testenv:dev-guide-pdf-docs] -deps = {[testenv:dev-guide]deps} -envdir = {toxworkdir}/dev_guide -whitelist_externals = - rm - make - sh -commands = - rm -rf dev_guide/build/pdf - sphinx-build -a -E -W -b latex dev_guide/source dev_guide/build/pdf - make -C dev_guide/build/pdf diff --git a/umn/source/conf.py b/umn/source/conf.py index ca99e5d..86ecdee 100755 --- a/umn/source/conf.py +++ b/umn/source/conf.py @@ -1,75 +1,106 @@ -# -*- coding: utf-8 -*- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# !!! +# This file is generated out of template in doc-exports repository. +# Beware overwriting it locally. import os import sys -sys.path.insert(0, os.path.abspath('../..')) +extensions = [ + 'otcdocstheme' +] + +otcdocs_auto_name = False +otcdocs_auto_version = False + +project = 'Distributed Database Middleware' +otcdocs_repo_name = 'docs/distributed-database-middleware' +# Those variables are required for edit/bug links +otcdocs_git_fqdn = 'gitea.eco.tsi-dev.otc-service.com' +otcdocs_git_type = 'gitea' + +# 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. +sys.path.insert(0, os.path.abspath('../../')) +sys.path.insert(0, os.path.abspath('../')) +sys.path.insert(0, os.path.abspath('./')) + # -- General configuration ---------------------------------------------------- +# https://docutils.sourceforge.io/docs/user/smartquotes.html - it does not +# what it is expected +smartquotes = False # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - 'otcdocstheme', -] - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' +# The encoding of source files. +# +source_encoding = 'utf-8' + # The master toctree document. master_doc = 'index' # General information about the project. -project = 'distributed-database-middleware' -copyright = '2022, Open Telekom Cloud Developers' +copyright = u'2022-present, Open Telekom Cloud' -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +language = 'en' -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'native' +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +show_authors = False # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] html_theme = 'otcdocs' -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project +# 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. +html_theme_options = { + "disable_search": True, + "site_name": "Internal Documentation Portal", + "logo_url": "https://docs-int.otc-service.com", +} -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". + +html_title = "Distributed Database Middleware - User Guide" + + +# 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". +html_static_path = ['_static'] + +# Do not include sources into the rendered results +html_copy_source = False + +# -- Options for PDF output -------------------------------------------------- latex_documents = [ ('index', - '%s.tex' % project, - '%s Documentation' % project, - 'Open Telekom Cloud Developers', 'manual'), + 'ddm-umn.tex', + u'Distributed Database Middleware - User Guide', + u'OpenTelekomCloud', 'manual'), ] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None}