Skip to content

Commit

Permalink
Update conf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 authored Nov 8, 2023
1 parent d552f6f commit c3d2768
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,49 @@
import sys
import yaml

from volttron.platform.agent.utils import execute_command
# Copied from volttron.platform.agent.util because it is not required
# that volttron be installed to utilize this script.
def execute_command(cmds,
env=None,
cwd=None,
logger=None,
err_prefix=None,
use_shell=False) -> str:
""" Executes a command as a subprocess
If the return code of the call is 0 then return stdout otherwise
raise a RuntimeError. If logger is specified then write the exception
to the logger otherwise this call will remain silent.
:param cmds:list of commands to pass to subprocess.run
:param env: environment to run the command with
:param cwd: working directory for the command
:param logger: a logger to use if errors occure
:param err_prefix: an error prefix to allow better tracing through the error message
:return: stdout string if successful
:raises RuntimeError: if the return code is not 0 from suprocess.run
"""

results = subprocess.run(cmds,
env=env,
cwd=cwd,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
shell=use_shell)
if results.returncode != 0:
err_prefix = err_prefix if err_prefix is not None else "Error executing command"
err_message = "\n{}: Below Command failed with non zero exit code.\n" \
"Command:{} \nStderr:\n{}\n".format(err_prefix,
results.args,
results.stderr)
if logger:
logger.exception(err_message)
raise RuntimeError(err_message)
else:
raise RuntimeError(err_message)

return results.stdout.decode('utf-8')


class Mock(MagicMock):
Expand All @@ -39,13 +81,13 @@ def __getattr__(cls, name):
# -- Project information -----------------------------------------------------

project = 'VOLTTRON'
copyright = '2022, The VOLTTRON Community'
copyright = '2023, The VOLTTRON Community'
author = 'The VOLTTRON Community'

# The short X.Y version
version = '8.2'
version = '9.0'
# The full version, including alpha/beta/rc tags
release = '8.2'
release = '9.0-rc'


# -- General configuration ---------------------------------------------------
Expand Down

0 comments on commit c3d2768

Please sign in to comment.