update scripts for latest templates

This commit is contained in:
2022-11-09 17:14:49 +01:00
parent 338c58e5fa
commit a4dd457062
7 changed files with 241 additions and 43 deletions

View File

@ -27,12 +27,12 @@ otcdocs_auto_version = False
project = '{{ project }}'
otcdocs_repo_name = '{{ repo_name }}'
# Those variables are required for edit/bug links
{% if git_fqdn -%}
{%- if git_fqdn %}
otcdocs_git_fqdn = '{{ git_fqdn }}'
{% endif %}
{% if git_type -%}
{%- endif %}
{%- if git_type %}
otcdocs_git_type = '{{ git_type }}'
{% endif %}
{%- endif %}
# 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
@ -82,6 +82,15 @@ html_theme = 'otcdocs'
# further. For a list of options available for each theme, see the
# documentation.
html_theme_options = {
{%- if html_options is defined -%}
{%- for (k, v) in html_options.items() %}
{%- if v is boolean %}
"{{ k }}": {{ v }},
{%- else %}
"{{ k }}": "{{ v }}",
{%- endif %}
{%- endfor %}
{%- endif %}
}
# The name for this set of Sphinx documents. If None, it defaults to
@ -97,10 +106,11 @@ html_static_path = ['_static']
# -- Options for PDF output --------------------------------------------------
latex_documents = [
{% if pdf_name is defined -%}
{%- if pdf_name is defined %}
('index',
'{{ pdf_name }}.tex',
u'{{ title }}',
u'OpenTelekomCloud', 'manual'),
{% endif -%}
]

View File

@ -0,0 +1,4 @@
sphinx>=2.0.0,!=2.1.0 # BSD
otcdocstheme # Apache-2.0
# releasenotes
reno>=3.1.0 # Apache-2.0

View File

@ -0,0 +1,77 @@
[tox]
minversion = 3.1
envlist = py39,pep8
skipsdist = True
ignore_basepython_conflict = True
[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
deps =
-r{toxinidir}/requirements.txt
commands = stestr run {posargs}
stestr slowest
[testenv:pep8]
commands =
doc8 doc/source README.rst
[testenv:venv]
deps =
-r{toxinidir}/requirements.txt
commands = {posargs}
[testenv:docs]
commands =
{%- for doc in docs %}
{[testenv:{{ doc.type }}]commands}
{%- endfor %}
[testenv:docs-pdf]
whitelist_externals =
mkdir
commands =
mkdir -p doc/build/pdf
{%- for doc in docs %}
{%- if doc.pdf_name %}
{[testenv:{{ doc.type }}-pdf-docs]commands}
{%- endif %}
{%- endfor %}
{% for doc in docs -%}
{% set loc = doc.rst_location | replace('/source', '') %}
[testenv:{{ doc.type }}]
whitelist_externals =
cp
mkdir
commands =
sphinx-build -W --keep-going -b html {{ loc }}/source doc/build/html/{{ doc.type }}
{%- if doc.type == 'api-ref' %}
mkdir -p api-ref/build/html
cp -av doc/build/html/api-ref api-ref/build/html
{%- elif doc.type == 'umn' %}
mkdir -p umn/build/html
cp -av doc/build/html/umn umn/build/html
{%- elif doc.type == 'dev-guide' %}
mkdir -p dev_guide/build/html
cp -av doc/build/html/dev-guide dev_guide/build/html
{%- endif %}
{% if doc.pdf_name -%}
[testenv:{{ doc.type }}-pdf-docs]
whitelist_externals =
rm
mkdir
make
bash
cp
commands =
rm -rf {{ loc }}/build/pdf
sphinx-build -W --keep-going -b latex {{ loc }}/source {{ loc }}/build/pdf/
bash -c "for f in {{ loc }}/build/pdf/*.gif; do convert $f $\{f/%gif/png\}; done || true"
bash -c "for f in {{ loc }}/build/pdf/*.tex; do sed -iorig 's/\.gif//g' $f; done"
make -C {{ loc }}/build/pdf
mkdir -p doc/build/pdf
cp {{ loc }}/build/pdf/{{ doc.pdf_name }}.pdf doc/build/pdf/
{% endif %}
{% endfor %}