-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate_docs.py
67 lines (54 loc) · 1.67 KB
/
generate_docs.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from pathlib import Path
import os
import shutil
import subprocess
def generate_sphinx_documentation():
from sphinx.cmd.build import main as sphinx_main
from setuptools_scm import get_version
git_describe_output = get_version()
os.chdir("docs")
source_dir = os.path.join(".")
build_dir = os.path.join(".", "_build/html")
directory = Path(build_dir)
if directory.exists():
shutil.rmtree(build_dir)
sphinx_args = [
"-b",
"html",
source_dir,
build_dir,
"-D",
"dd_changelog_generate=1",
"-D",
"dd_autodoc_generate=1",
"-W",
"--keep-going",
]
sphinx_main(sphinx_args)
try:
from git import Repo
output_file_path = os.path.join("docs", "_build", "html", "version.txt")
repo = Repo("..")
git_describe_output = repo.git.describe().strip()
except Exception as _: # noqa: F841
pass
os.makedirs(os.path.dirname(output_file_path), exist_ok=True)
with open(output_file_path, "w") as version_file:
version_file.write(git_describe_output)
os.chdir("..")
if __name__ == "__main__":
from generate import (
generate_dd_data_dictionary,
generate_dd_data_dictionary_validation,
generate_html_documentation,
generate_ids_cocos_transformations_symbolic_table,
generate_idsnames,
generate_idsdef_js,
)
generate_dd_data_dictionary()
generate_html_documentation()
generate_ids_cocos_transformations_symbolic_table()
generate_idsnames()
generate_dd_data_dictionary_validation()
generate_idsdef_js()
generate_sphinx_documentation()