Skip to content

Commit

Permalink
Update version of rtd
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Mar 25, 2024
1 parent 33672ff commit 32d54ff
Showing 1 changed file with 43 additions and 35 deletions.
78 changes: 43 additions & 35 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
# import sys
# sys.path.insert(0, os.path.abspath('.'))

from glob import glob
from mock import Mock as MagicMock
import os
import subprocess
import sys
from glob import glob

import yaml
from mock import Mock as MagicMock


# Copied from volttron.platform.agent.util because it is not required
# that volttron be installed to utilize this script.
Expand Down Expand Up @@ -69,14 +71,17 @@ def execute_command(cmds,


class Mock(MagicMock):

@classmethod
def __getattr__(cls, name):
return Mock()
return Mock()


autodoc_mock_imports = ['loadshape', 'numpy', 'sympy', 'xlrd', 'stomp', 'oadr2', 'pyodbc', 'lxml', 'pytest',
'pint', 'pandas', 'suds', 'paho', 'pymongo', 'bson', 'subprocess32', 'heaters', 'meters',
'hvac', 'blinds', 'vehicles']
autodoc_mock_imports = [
'loadshape', 'numpy', 'sympy', 'xlrd', 'stomp', 'oadr2', 'pyodbc', 'lxml',
'pytest', 'pint', 'pandas', 'suds', 'paho', 'pymongo', 'bson',
'subprocess32', 'heaters', 'meters', 'hvac', 'blinds', 'vehicles'
]

# -- Project information -----------------------------------------------------

Expand All @@ -87,8 +92,7 @@ def __getattr__(cls, name):
# The short X.Y version
version = '9.0'
# The full version, including alpha/beta/rc tags
release = '9.0-rc'

release = '9.0'

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -151,7 +155,6 @@ def __getattr__(cls, name):
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down Expand Up @@ -180,13 +183,11 @@ def __getattr__(cls, name):
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'VOLTTRONdoc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
Expand Down Expand Up @@ -215,37 +216,34 @@ def __getattr__(cls, name):
'The VOLTTRON Community', 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(main_doc, 'volttron', 'VOLTTRON Documentation',
[author], 1)
]

man_pages = [(main_doc, 'volttron', 'VOLTTRON Documentation', [author], 1)]

# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(main_doc, 'VOLTTRON', 'VOLTTRON Documentation',
author, 'VOLTTRON', 'One line description of project.',
'Miscellaneous'),
(main_doc, 'VOLTTRON', 'VOLTTRON Documentation', author, 'VOLTTRON',
'One line description of project.', 'Miscellaneous'),
]


# -- Extension configuration -------------------------------------------------

# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/3.6': None,
'volttron-ansible': ('https://volttron.readthedocs.io/projects/volttron-ansible/en/main/',
None)}
intersphinx_mapping = {
'https://docs.python.org/3.6':
None,
'volttron-ansible':
('https://volttron.readthedocs.io/projects/volttron-ansible/en/main/',
None)
}

# -- Options for todo extension ----------------------------------------------

Expand Down Expand Up @@ -290,11 +288,15 @@ def generate_apidoc(app):
# generate api-docs for each api docs directory
for docs_subdir in config.keys():
docs_subdir_path = os.path.join(apidocs_base_dir, docs_subdir)
agent_dirs = glob(os.path.join(volttron_root, config[docs_subdir]["path"], "*/"))
agent_dirs = glob(
os.path.join(volttron_root, config[docs_subdir]["path"], "*/"))
file_excludes = []
if config[docs_subdir].get("file_excludes"):
for exclude_pattern in config[docs_subdir].get("file_excludes", []):
file_excludes.append(os.path.join(volttron_root, config[docs_subdir]["path"], exclude_pattern))
for exclude_pattern in config[docs_subdir].get(
"file_excludes", []):
file_excludes.append(
os.path.join(volttron_root, config[docs_subdir]["path"],
exclude_pattern))
print("after file excludes. calling apidoc")
agent_excludes = \
config[docs_subdir].get("agent_excludes") if config[docs_subdir].get("agent_excludes", []) else []
Expand All @@ -311,19 +313,24 @@ def run_apidoc(docs_dir, agent_dirs, agent_excludes, exclude_pattern):
:param agent_excludes: agent directories to be skipped
:param exclude_pattern: file name patterns to be excluded. This passed on to sphinx-apidoc command for exclude
"""
print(f"In run apidoc params {docs_dir}, {agent_dirs}, {agent_excludes}, {exclude_pattern}")
print(
f"In run apidoc params {docs_dir}, {agent_dirs}, {agent_excludes}, {exclude_pattern}"
)
for agent_src_dir in agent_dirs:
agent_src_dir = os.path.abspath(agent_src_dir)
agent_src_dir = agent_src_dir[:-1] if agent_src_dir.endswith("/") else agent_src_dir
agent_src_dir = agent_src_dir[:-1] if agent_src_dir.endswith(
"/") else agent_src_dir
name = os.path.basename(agent_src_dir)
agent_doc_dir = os.path.join(docs_dir, name)
if name not in agent_excludes:
sys.path.insert(0, agent_src_dir)
cmd = ["sphinx-apidoc", '-e', '-a', '-M', '-d 4',
'-t', os.path.join(script_dir, 'apidocs-templates'),
'--force', '-o', agent_doc_dir, agent_src_dir,
os.path.join(agent_src_dir, "setup.py"), os.path.join(agent_src_dir, "conftest.py")
]
cmd = [
"sphinx-apidoc", '-e', '-a', '-M', '-d 4', '-t',
os.path.join(script_dir, 'apidocs-templates'), '--force', '-o',
agent_doc_dir, agent_src_dir,
os.path.join(agent_src_dir, "setup.py"),
os.path.join(agent_src_dir, "conftest.py")
]

cmd.extend(exclude_pattern)
subprocess.check_call(cmd)
Expand Down Expand Up @@ -363,5 +370,6 @@ def clean_api_rst(app, exception):
global apidocs_base_dir
import shutil
if os.path.exists(apidocs_base_dir):
print("Cleanup: Removing apidocs directory {}".format(apidocs_base_dir))
print(
"Cleanup: Removing apidocs directory {}".format(apidocs_base_dir))
shutil.rmtree(apidocs_base_dir)

0 comments on commit 32d54ff

Please sign in to comment.