Skip to content

Commit

Permalink
No sphinx-multiversion test
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Dec 21, 2023
1 parent cbc77d3 commit 53aba4f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 65 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 9 additions & 11 deletions doc/_templates/versions.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
{%- if current_version %}
<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<span class="fa fa-book"> Other Versions</span>
v: {{ current_version.name }}
v: {{ current_version }}
<span class="fa fa-caret-down"></span>
</span>
<div class="rst-other-versions">
{%- if versions.tags or version.branches%}
<dl>
<dt>Versions</dt>
{%- for item in versoin.branches %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor -%}
{%- for item in versions.tags %}
<dd><a href="{{ item.url }}">{{ item.name }}</a></dd>
{%- endfor %}
<dd><a href="../master/index.html">master</a></dd>
<!-- VERSION_CHANGE START -->

{% for version in versions %}
<dd><a href="../{{ version }}/index.html">{{ version }}</a></dd>
{% endfor %}

<!-- VERSION_CHANGE END -->
</dl>
{%- endif %}
</div>
</div>
{%- endif %}
108 changes: 58 additions & 50 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
2 changes: 0 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ Welcome to PODIO's documentation!
userdata.md
advanced_topics.md
templates.md
cpp_api/api
py_api/modules
1 change: 0 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ myst-parser
sphinx
sphinx_rtd_theme
sphinx_copybutton
sphinx_multiversion
1 change: 1 addition & 0 deletions doc/versions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v99-99-99

0 comments on commit 53aba4f

Please sign in to comment.