Skip to content

Commit

Permalink
toctree now includes plugin models
Browse files Browse the repository at this point in the history
  • Loading branch information
tsole0 committed Jun 30, 2023
1 parent 577d88f commit 9329d67
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions docs/sphinx-docs/doc-regen/makedocumentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,24 @@ def call_regenmodel(filepath, regen_py):
Runs regenmodel.py/regentoc.py (specified in parameter regen_py) with all found PY_FILES
"""
REGENMODEL = abspath(regen_py)
# Initialize command to be executed
command = [
sys.executable,
REGENMODEL,
filepath,
]
# Append each filepath to command individually if passed in many files
if type(filepath) == list:
for string in filepath:
command.append(string)
else:
command.append(filepath)
subprocess.run(command)

def main():
TARGETS = get_main_docs()
print(TARGETS)
for file in TARGETS:
call_regenmodel(file, "regenmodel.py")
call_regenmodel(file, "regentoc.py")
call_regenmodel(TARGETS, "regentoc.py")

if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion docs/sphinx-docs/doc-regen/regentoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ def generate_toc(model_files):
category = {} # type: Dict[str, List[str]]
for item in model_files:
# assume model is in sasmodels/models/name.py, and ignore the full path
# NOTE: No longer use shortened pathname for model because we also pull in models from .sasview/plugin_models
model_name = basename(item)[:-3]
if model_name.startswith('_'):
continue
model_info = load_model_info(model_name)
model_info = load_model_info(item)
if model_info.category is None:
print("Missing category for", item, file=sys.stderr)
else:
Expand Down

0 comments on commit 9329d67

Please sign in to comment.