-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_docs.py
More file actions
executable file
·42 lines (33 loc) · 1.15 KB
/
build_docs.py
File metadata and controls
executable file
·42 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
"""
Build documentation for the Neural Network Alignment framework.
"""
import os
import subprocess
import sys
from importlib.util import find_spec
from pathlib import Path
def main():
"""Build the documentation."""
# Change to docs directory
docs_dir = Path(__file__).parent / "docs"
if not docs_dir.exists():
print(f"Error: Documentation directory not found at {docs_dir}")
sys.exit(1)
os.chdir(docs_dir)
# Check if sphinx is installed
if find_spec("sphinx") is None:
print("Sphinx not installed. Installing documentation requirements...")
subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements-docs.txt"])
# Build HTML documentation
print("Building HTML documentation...")
result = subprocess.run(["make", "html"], capture_output=True, text=True)
if result.returncode == 0:
print("Documentation built successfully!")
print(f"View documentation at: {docs_dir}/build/html/index.html")
else:
print("Error building documentation:")
print(result.stderr)
sys.exit(1)
if __name__ == "__main__":
main()