MCPcopy
hub / github.com/pex-tool/pex / main

Function main

scripts/build-docs.py:139–177  ·  view source on GitHub ↗
(
    out_dir: Path,
    subdir: str | None = None,
    linkcheck: bool = False,
    pdf: bool = False,
    html: bool = True,
    clean_html: bool = False,
    serve: bool = False,
)

Source from the content-addressed store, hash-verified

137
138
139def main(
140 out_dir: Path,
141 subdir: str | None = None,
142 linkcheck: bool = False,
143 pdf: bool = False,
144 html: bool = True,
145 clean_html: bool = False,
146 serve: bool = False,
147) -> None:
148 static_dynamic_dir = (Path("docs") / "_static_dynamic").absolute()
149
150 def clean_static_dynmaic_dir() -> None:
151 shutil.rmtree(static_dynamic_dir, ignore_errors=True)
152
153 clean_static_dynmaic_dir()
154 static_dynamic_dir.mkdir(parents=True, exist_ok=True)
155 atexit.register(clean_static_dynmaic_dir)
156
157 if linkcheck:
158 execute_sphinx_build(out_dir, "linkcheck")
159
160 if pdf:
161 pdf_dir = execute_sphinx_build(out_dir, "simplepdf", out_dir="pdf")
162 (static_dynamic_dir / "pex.pdf").symlink_to(pdf_dir / "pex.pdf")
163
164 if html:
165 html_defines: dict[str, str] = {}
166 if subdir:
167 html_defines["pex_site_subdir"] = f"/{subdir.lstrip('/')}"
168 html_dir = execute_sphinx_build(out_dir, "html", **html_defines)
169 if clean_html:
170 shutil.rmtree(html_dir / ".doctrees", ignore_errors=True)
171 (html_dir / ".buildinfo").unlink(missing_ok=True)
172 (html_dir / "objects.inv").unlink(missing_ok=True)
173
174 page_find_args = ["--site", str(html_dir), "--output-subdir", "_pagefind"]
175 if serve:
176 page_find_args.append("--serve")
177 execute_pagefind(page_find_args)
178
179
180if __name__ == "__main__":

Callers 1

build-docs.pyFile · 0.70

Calls 5

clean_static_dynmaic_dirFunction · 0.85
execute_sphinx_buildFunction · 0.85
execute_pagefindFunction · 0.85
appendMethod · 0.80
registerMethod · 0.45

Tested by

no test coverage detected