Skip to content

Commit

Permalink
loading exclusion patterns from a file to decouple dependencies; clea…
Browse files Browse the repository at this point in the history
…nup for PR
  • Loading branch information
nv-kmcgill53 committed Dec 13, 2024
1 parent 86564a6 commit 4e52bc1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["README.md", "examples/README.md", "user_guide/perf_analyzer.md"]
exclusions = None
with open("exclusions.txt", "r") as f:
exclusions = f.read()
f.close()
exclude_patterns = exclusions.strip().split("\n")
print(f"exclude_patterns: {exclude_patterns}")

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

Expand Down
3 changes: 3 additions & 0 deletions docs/exclusions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
README.md
examples/README.md
user_guide/perf_analyzer.md
16 changes: 8 additions & 8 deletions docs/generate_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
from collections import defaultdict
from functools import partial

from conf import exclude_patterns

# Global constants
server_abspath = os.environ.get("SERVER_ABSPATH", os.getcwd())
server_docs_abspath = os.path.join(server_abspath, "docs")
Expand Down Expand Up @@ -65,6 +63,13 @@
# Hyperlink in a .md file, excluding embedded images.
hyperlink_reg = re.compile(r"((?<!\!)\[[^\]]+\]\s*\(\s*)([^)]+?)(\s*\))")

exclusions = None
with open(f"{server_docs_abspath}/exclusions.txt", "r") as f:
exclusions = f.read()
f.close()
exclude_patterns = exclusions.strip().split("\n")
print(f"exclude_patterns: {exclude_patterns}")

# Parser
parser = argparse.ArgumentParser(description="Process some arguments.")
parser.add_argument(
Expand Down Expand Up @@ -114,9 +119,8 @@ def run_command(command):
- command: Command to execute
"""
log_message(f"Running command: {command}")
result = None
try:
result = subprocess.run(
subprocess.run(
command,
shell=True,
check=True,
Expand All @@ -125,7 +129,6 @@ def run_command(command):
stderr=subprocess.PIPE,
)
except subprocess.CalledProcessError as e:
print(result.stdout)
raise (e)


Expand Down Expand Up @@ -370,9 +373,6 @@ def main():
repo_tag = args.repo_tag
repository_filename = args.repo_file
github_org = args.github_organization
print(f"repo_tag: {repo_tag}")
print(f"repository_filename: {repository_filename}")
print(f"github_org: {github_org}")

# Change working directory to server/docs.
os.chdir(server_docs_abspath)
Expand Down

0 comments on commit 4e52bc1

Please sign in to comment.