From 53aba4f0c1f169f6f337eb35a15788171badbb26 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Thu, 21 Dec 2023 10:29:13 +0100 Subject: [PATCH] No sphinx-multiversion test --- .github/workflows/docs.yml | 3 +- doc/_templates/versions.html | 20 +++---- doc/conf.py | 108 +++++++++++++++++++---------------- doc/index.rst | 2 - doc/requirements.txt | 1 - doc/versions.txt | 1 + 6 files changed, 70 insertions(+), 65 deletions(-) create mode 100644 doc/versions.txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3855ad8ed..820f60e9b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -45,7 +45,8 @@ jobs: export ROOT_INCLUDE_PATH=$(pwd)/install/include echo -e "::endgroup::\n::group::build doc" - sphinx-multiversion doc doc_output + export GIT_CURRENT_REF=${{ github.ref_name }} + sphinx-build -M html doc doc_output - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/doc/_templates/versions.html b/doc/_templates/versions.html index a7888e030..94b3cbaa5 100644 --- a/doc/_templates/versions.html +++ b/doc/_templates/versions.html @@ -1,22 +1,20 @@ -{%- if current_version %}
Other Versions - v: {{ current_version.name }} + v: {{ current_version }}
- {%- if versions.tags or version.branches%}
Versions
- {%- for item in versoin.branches %} -
{{ item.name }}
- {%- endfor -%} - {%- for item in versions.tags %} -
{{ item.name }}
- {%- endfor %} +
master
+ + + {% for version in versions %} +
{{ version }}
+ {% endfor %} + +
- {%- endif %}
-{%- endif %} diff --git a/doc/conf.py b/doc/conf.py index 0dae9276d..494056304 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -91,70 +91,78 @@ "prev_next_buttons_location": None, # no navigation buttons } -# -- Doxygen integration with Breathe ----------------------------------------- +# # -- Doxygen integration with Breathe ----------------------------------------- -breathe_projects = {"PODIO": "_build/cpp/doxygen-xml"} -breathe_default_project = "PODIO" -breathe_domain_by_extension = {"h": "cpp", "cc": "cpp", "ipp": "cpp"} -breathe_default_members = ("members", "undoc-members") +# breathe_projects = {"PODIO": "_build/cpp/doxygen-xml"} +# breathe_default_project = "PODIO" +# breathe_domain_by_extension = {"h": "cpp", "cc": "cpp", "ipp": "cpp"} +# breathe_default_members = ("members", "undoc-members") -# -- Automatic API documentation (c++) ---------------------------------------- +# # -- Automatic API documentation (c++) ---------------------------------------- -print(f"Executing doxygen in {doc_dir}") -doxygen_version = subprocess.check_output(["doxygen", "--version"], encoding="utf-8") -print(f"Doxygen version: {doxygen_version}") +# print(f"Executing doxygen in {doc_dir}") +# doxygen_version = subprocess.check_output(["doxygen", "--version"], encoding="utf-8") +# print(f"Doxygen version: {doxygen_version}") -env = os.environ.copy() -env["DOXYGEN_WARN_AS_ERROR"] = "NO" +# env = os.environ.copy() +# env["DOXYGEN_WARN_AS_ERROR"] = "NO" -os.makedirs("_build/cpp", exist_ok=True) +# os.makedirs("_build/cpp", exist_ok=True) -subprocess.check_call( - ["doxygen", "Doxyfile"], stdout=subprocess.PIPE, cwd=doc_dir, env=env - ) +# subprocess.check_call( +# ["doxygen", "Doxyfile"], stdout=subprocess.PIPE, cwd=doc_dir, env=env +# ) -cpp_api_index_target = doc_dir / "cpp_api/api.rst" +# cpp_api_index_target = doc_dir / "cpp_api/api.rst" -print(f"Executing breath apidoc in {doc_dir}") -subprocess.check_call( - [sys.executable, "-m", "breathe.apidoc", "_build/cpp/doxygen-xml", "-o", "cpp_api"], - stdout=subprocess.PIPE, - cwd=doc_dir, - env=env, - ) +# print(f"Executing breath apidoc in {doc_dir}") +# subprocess.check_call( +# [sys.executable, "-m", "breathe.apidoc", "_build/cpp/doxygen-xml", "-o", "cpp_api"], +# stdout=subprocess.PIPE, +# cwd=doc_dir, +# env=env, +# ) -if not cpp_api_index_target.exists(): - shutil.copyfile(doc_dir / "cpp_api.rst", cpp_api_index_target) +# if not cpp_api_index_target.exists(): +# shutil.copyfile(doc_dir / "cpp_api.rst", cpp_api_index_target) -print("Done with c++ API doc generation") +# print("Done with c++ API doc generation") -# -- Automatic API documentation (python) -------------------------------------- +# # -- Automatic API documentation (python) -------------------------------------- -# Make sure that the __init__ docstrings appear as part of the class -# documentation -autoclass_content = "both" +# # Make sure that the __init__ docstrings appear as part of the class +# # documentation +# autoclass_content = "both" -print("Executing sphinx-apidoc for python API") -print(f"Executing sphinx-apidoc in {doc_dir}") -subprocess.check_call( - [ - sys.executable, - "-m", - "sphinx.ext.apidoc", - "--force", - "-o", - "py_api", - "../python", - "../*/*test_*.py", # exclude tests - "../python/podio_version.py", - ] - ) +# print("Executing sphinx-apidoc for python API") +# print(f"Executing sphinx-apidoc in {doc_dir}") +# subprocess.check_call( +# [ +# sys.executable, +# "-m", +# "sphinx.ext.apidoc", +# "--force", +# "-o", +# "py_api", +# "../python", +# "../*/*test_*.py", # exclude tests +# "../python/podio_version.py", +# ] +# ) -print("Done with python API doc generation") +# print("Done with python API doc generation") # -- multiversion setup ------------------------------------------------------- -smv_tag_whitelist = r'^(v[0-9]{2}-[0-9]{2}(-[0-9]{2})?)$' -smv_remote_whitelist = r'^(origin)$' -smv_branch_whitelist = r'^(master|docs-on-gh-pages)$' -smv_released_pattern = r'^tags/.*$' +try: + html_context +except NameError: + html_context = {} + +# html_context["display_lower_left"] = True +html_context["current_version"] = os.environ.get("GIT_CURRENT_REF", "master") +html_context["versions"] = [] + +with open("./versions.txt", "r") as vfile: + for line in vfile.readlines(): + html_context["versions"].append(line.strip()) diff --git a/doc/index.rst b/doc/index.rst index 9c56def77..41d7aa03a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -17,5 +17,3 @@ Welcome to PODIO's documentation! userdata.md advanced_topics.md templates.md - cpp_api/api - py_api/modules diff --git a/doc/requirements.txt b/doc/requirements.txt index 1b6bb09c0..97bc1a97e 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -3,4 +3,3 @@ myst-parser sphinx sphinx_rtd_theme sphinx_copybutton -sphinx_multiversion diff --git a/doc/versions.txt b/doc/versions.txt new file mode 100644 index 000000000..72285cc45 --- /dev/null +++ b/doc/versions.txt @@ -0,0 +1 @@ +v99-99-99