MCPcopy Index your code
hub / github.com/saltstack/salt / html

Function html

tools/docs.py:139–185  ·  view source on GitHub ↗
(
    ctx: Context,
    no_clean: bool = False,
    no_color: bool = False,
    archive: pathlib.Path = os.environ.get("ARCHIVE_FILENAME"),  # type: ignore[assignment]
)

Source from the content-addressed store, hash-verified

137 },
138)
139def html(
140 ctx: Context,
141 no_clean: bool = False,
142 no_color: bool = False,
143 archive: pathlib.Path = os.environ.get("ARCHIVE_FILENAME"), # type: ignore[assignment]
144):
145 if no_clean is False:
146 ctx.run("make", "clean", cwd="doc/", check=True)
147 opts = [
148 "-W",
149 "-j",
150 "auto",
151 "--keep-going",
152 ]
153 if no_color is False:
154 opts.append("--color")
155 ctx.run(
156 "make",
157 "html",
158 f"SPHINXOPTS={' '.join(opts)}",
159 cwd="doc/",
160 check=True,
161 )
162 github_output = os.environ.get("GITHUB_OUTPUT")
163 if archive is not None:
164 ctx.info(f"Compressing the generated documentation to '{archive}'...")
165 ctx.run("tar", "caf", str(archive.resolve()), ".", cwd="doc/_build/html")
166
167 if github_output is not None:
168 with open(github_output, "a", encoding="utf-8") as wfh:
169 wfh.write(
170 "has-artifacts=true\n"
171 f"artifact-name={archive.resolve().name}\n"
172 f"artifact-path={archive.resolve()}\n"
173 )
174 elif github_output is not None:
175 artifact = tools.utils.REPO_ROOT / "doc" / "_build" / "html"
176 if "LATEST_RELEASE" in os.environ:
177 artifact_name = f"salt-{os.environ['LATEST_RELEASE']}-docs-html"
178 else:
179 artifact_name = "salt-docs-html"
180 with open(github_output, "a", encoding="utf-8") as wfh:
181 wfh.write(
182 "has-artifacts=true\n"
183 f"artifact-name={artifact_name}\n"
184 f"artifact-path={artifact.resolve()}\n"
185 )
186
187
188@docs.command(

Callers

nothing calls this directly

Calls 6

openFunction · 0.50
getMethod · 0.45
runMethod · 0.45
appendMethod · 0.45
infoMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected