-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_docs.py
More file actions
41 lines (31 loc) · 939 Bytes
/
build_docs.py
File metadata and controls
41 lines (31 loc) · 939 Bytes
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
#!/usr/bin/env python3
"""Build documentation using Sphinx."""
import subprocess
import sys
from pathlib import Path
def main():
"""Build documentation."""
docs_dir = Path(__file__).parent
build_dir = docs_dir / "_build"
# Clean previous build
if build_dir.exists():
import shutil
shutil.rmtree(build_dir)
# Build documentation
cmd = [
sys.executable, "-m", "sphinx",
"-b", "html",
"-d", str(build_dir / "doctrees"),
str(docs_dir),
str(build_dir / "html")
]
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
print("Error building documentation:")
print(result.stdout)
print(result.stderr)
sys.exit(1)
print("Documentation built successfully!")
print(f"Output: {build_dir / 'html' / 'index.html'}")
if __name__ == "__main__":
main()