MCPcopy Create free account
hub / github.com/Prograda/Skybolt / build

Function build

Tools/BuildScripts/docs/build_docs.py:6–25  ·  view source on GitHub ↗
(source_dir: Path, output_dir: Path, deploy_to_github=False)

Source from the content-addressed store, hash-verified

4from pathlib import Path
5
6def build(source_dir: Path, output_dir: Path, deploy_to_github=False):
7 python_source_dir = source_dir / "Assets/Core/Scripts"
8
9 env = os.environ.copy()
10 env["PYTHONPATH"] = os.pathsep.join([str(python_source_dir)])
11
12 # Create dummy skybolt python module so that mkdocs collects the skybolt.pyi file to generate interface documentation.
13 # This is not required if the compile python .pyd file is on the PYTHONPATH, but we don't assume this is the case as
14 # skybolt might not have been compiled.
15 skybolt_module_filename = (python_source_dir / "skybolt.py")
16 skybolt_module_filename.touch()
17 skybolt_module_filename.write_text("#This is a temporary file used as a stub for generating documentation. It should not exist except for when building docs.")
18
19 try:
20 command = "gh-deploy" if deploy_to_github else "build"
21 sp.run(f"mkdocs {command} --site-dir {output_dir} --dirty", cwd=str(source_dir), env=env, shell=True, check=True)
22 except RuntimeError as e:
23 raise e
24 finally:
25 skybolt_module_filename.unlink()
26
27
28if __name__ == "__main__":

Callers 1

build_docs.pyFile · 0.70

Calls 1

runMethod · 0.80

Tested by

no test coverage detected