Skip to content

Commit

Permalink
include the supportData folder in the BSK documentation
Browse files Browse the repository at this point in the history
If the user installs BSK via a wheel, they have no way of knowing what support data files are included.  They are now auto-listed in a separate page.
  • Loading branch information
schaubh committed Nov 30, 2024
1 parent 436bd01 commit d1227af
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ docs/source/_images/Scenarios/*
docs/source/breathe.data
docs/source/externalTools/*
docs/source/examples/*
docs/source/supportData.rst
src/tests/scenarios/data
bsk-dev-env/
bin/
Expand Down
68 changes: 68 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,73 @@

import numpy as np

#
# create RST showing supportData folder information
#
folder_path = "../../supportData"
output_file = "supportData.rst"
# Files to exclude
excluded_files = {".DS_Store", "__init__.py"}
# loop over supportData folder and list all files

# Dictionary to store files grouped by folder
folder_files = {}

# Collect files grouped by folder
for root, dirs, files in os.walk(folder_path):
# Get the relative folder path
folder_relative_path = os.path.relpath(root, folder_path)
if folder_relative_path == ".":
folder_relative_path = ""

# Collect files for this folder
folder_files[folder_relative_path] = sorted(
[file_name for file_name in files if file_name not in excluded_files]
)

with open(output_file, "w") as f:
f.write("Support Data Files\n")
f.write("==================\n\n")
f.write(".. note::\n\n")
f.write(" This folder contains a listing of all the data files in the folder ``basilisk/supportData`` "
"that are packaged into Basilisk.\n\n")

# Sort folders alphabetically and write each section
for folder in sorted(folder_files.keys()):
f.write(f"**{folder}**\n\n")
for file_name in folder_files[folder]:
f.write(f"- {file_name}\n")
f.write("\n")

# for root, dirs, files in os.walk(folder_path):
# # Get the relative folder path
# folder_relative_path = os.path.relpath(root, folder_path)
# if folder_relative_path == ".":
# folder_relative_path = ""
#
# # Write folder name as a section
# f.write(f"**{folder_relative_path}**\n\n")
#
# # Process files in the current directory
# for file_name in sorted(files):
# if file_name not in excluded_files:
# f.write(f"- {file_name}\n")
# f.write("\n")

# for root, dirs, files in os.walk(folder_path):
# # Write the current folder name as a heading
# folder_relative_path = os.path.relpath(root, folder_path)
# if folder_relative_path == ".":
# folder_relative_path = ""
# f.write(f"**{folder_relative_path}**\n\n")
#
# # Process files in the current directory
# for file_name in files:
# if file_name not in excluded_files:
# f.write(f"- {file_name}\n")
# f.write("\n")


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

now = datetime.datetime.now()
Expand Down Expand Up @@ -502,6 +569,7 @@ def run(self, srcDir):
# breathe_projects_source = fileCrawler.run(officialSrc+"/simulation/vizard")
# breathe_projects_source = fileCrawler.run(officialSrc+"/architecture")
breathe_projects_source = fileCrawler.run("../../examples")
# breathe_projects_source = fileCrawler.run("../../supportData")
# breathe_projects_source = fileCrawler.run("../../externalTools")
with open("breathe.data", 'wb') as f:
pickle.dump(breathe_projects_source, f)
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Related Publications
Learn
Support
Documentation/index
supportData
ExternalSites

.. toctree::
Expand Down

0 comments on commit d1227af

Please sign in to comment.