From 07b3c97d7d993fe916a0ec5b60973f112e577239 Mon Sep 17 00:00:00 2001 From: gtema Date: Mon, 9 Jan 2023 08:27:08 +0000 Subject: [PATCH] Update tox template Reviewed-by: Goncharov, Artem Co-authored-by: gtema Co-committed-by: gtema --- otc_metadata/templates/conf.py.j2 | 3 +++ otc_metadata/templates/tox.ini.j2 | 17 ++++++++++++++--- tools/generate_doc_confpy.py | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/otc_metadata/templates/conf.py.j2 b/otc_metadata/templates/conf.py.j2 index 1e04e55a..859d3b87 100644 --- a/otc_metadata/templates/conf.py.j2 +++ b/otc_metadata/templates/conf.py.j2 @@ -104,6 +104,9 @@ html_title = "{{ title }}" # 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 = [ {%- if pdf_name is defined %} diff --git a/otc_metadata/templates/tox.ini.j2 b/otc_metadata/templates/tox.ini.j2 index e909ce5a..f8316308 100644 --- a/otc_metadata/templates/tox.ini.j2 +++ b/otc_metadata/templates/tox.ini.j2 @@ -21,8 +21,14 @@ deps = -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 +allowlist_externals = + mkdir + cp + sh commands = {%- for doc in docs %} {[testenv:{{ doc.type }}]commands} @@ -32,7 +38,11 @@ commands = [testenv:docs-pdf] deps = -r{toxinidir}/doc/requirements.txt allowlist_externals = + rm mkdir + make + bash + cp commands = mkdir -p doc/build/pdf {%- for doc in docs %} @@ -68,11 +78,12 @@ deps = -r{toxinidir}/doc/requirements.txt allowlist_externals = cp mkdir - find + sh commands = sphinx-build -W --keep-going -b json {{ loc }}/source doc/build/json/{{ doc.type }} - # Drop data useless for the search - find doc/build/json -type d -and ( -name '_images' -or -name '_static' -or -name '_sources' ) -exec rm {:} ; + # 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" {%- if doc.type == 'api-ref' %} mkdir -p api-ref/build/json cp -av doc/build/json/api-ref api-ref/build/json diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 511e4750..58f657a1 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -201,7 +201,7 @@ def process_repositories(args, service): repo_to.git.push(*push_args) if "github" in url_to: subprocess.run( - args=["gh", "pr", "create", "-f"], cwd=copy_to, check=True + args=["gh", "pr", "create", "-f"], cwd=copy_to, check=False ) elif "gitea" in url_to and args.token: open_pr(