import datetime
import os
import time
mydate = datetime.datetime.utcfromtimestamp(
int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
)
year = mydate.year
month = mydate.strftime("%B")
project = 'OpenPMIx'
copyright = f'2014-{year}, OpenPMIx Community'
author = 'The OpenPMIx Community'
with open("../VERSION") as fp:
opmix_lines = fp.readlines()
opmix_data = dict()
for opmix_line in opmix_lines:
if '#' in opmix_line or 0 == len(opmix_line):
continue
opmix_line = opmix_line.strip()
if '=' not in opmix_line:
continue
opmix_key, opmix_val = opmix_line.split("=")
opmix_data[opmix_key.strip()] = opmix_val.strip()
opmix_series = f"v{opmix_data['major']}.{opmix_data['minor']}.x"
opmix_ver = f"v{opmix_data['major']}.{opmix_data['minor']}.{opmix_data['release']}{opmix_data['greek']}"
std_ver = f"{opmix_data['std_major']}.{opmix_data['std_minor']}"
hwloc_min_version = f"{opmix_data['hwloc_min_version']}"
event_min_version = f"{opmix_data['event_min_version']}"
automake_min_version = f"{opmix_data['automake_min_version']}"
autoconf_min_version = f"{opmix_data['autoconf_min_version']}"
libtool_min_version = f"{opmix_data['libtool_min_version']}"
flex_min_version = f"{opmix_data['flex_min_version']}"
release = opmix_ver[1:]
import os
key = 'READTHEDOCS'
if key in os.environ and os.environ[key] == 'True':
print("OpenPMIx: found ReadTheDocs build environment")
if "html_context" not in globals():
html_context = {}
html_context["READTHEDOCS"] = True
html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
rtd_v = os.environ['READTHEDOCS_VERSION']
if os.environ['READTHEDOCS_VERSION_TYPE'] == 'external':
release = f'PR #{rtd_v}'
opmix_ver += f' (Github PR #{rtd_v})'
else:
opmix_ver = rtd_v
release = opmix_ver
if opmix_ver[0] == 'v':
release = opmix_ver[1:]
if release == 'main' or release == 'master':
opmix_ver = 'head of development'
print(f"OpenPMIx: release = {release}")
print(f"OpenPMIx: opmix_ver = {opmix_ver}")
import sphinx_rtd_theme
extensions = ['recommonmark', "sphinx_rtd_theme"]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'venv', 'py*/**']
html_theme = 'sphinx_rtd_theme'
html_last_updated_fmt = '%Y-%m-%d %H:%M:%S %Z'
import os
import re
man_pages = list()
for root, dirs, files in os.walk("man"):
for filename in files:
parts = re.search(r"^([^/]+?).([0-9]+).rst$", filename)
if parts is None:
continue
base_name = parts.group(1)
section = int(parts.group(2))
full_filename_without_rst = f'{root}/{base_name}.{section}'
tuple = (full_filename_without_rst, base_name, '', '', section)
man_pages.append(tuple)
rst_prolog = f"""
.. |mdash| unicode:: U+02014 .. Em dash
.. |rarrow| unicode:: U+02192 .. Right arrow
.. |year| replace:: {year}
.. |date| replace:: {month}-{year}
.. |opmix_ver| replace:: {opmix_ver}
.. |opmix_series| replace:: {opmix_series}
.. |std_ver| replace:: {std_ver}
.. |hwloc_min_version| replace:: {hwloc_min_version}
.. |event_min_version| replace:: {event_min_version}
.. |automake_min_version| replace:: {automake_min_version}
.. |autoconf_min_version| replace:: {autoconf_min_version}
.. |libtool_min_version| replace:: {libtool_min_version}
.. |flex_min_version| replace:: {flex_min_version}
"""
rst_prolog += """
.. raw:: html
<style>
.wy-table-responsive table td,.wy-table-responsive table th{white-space:normal}
</style>
"""