MCPcopy
hub / github.com/saltstack/salt / pdf

Function pdf

tools/docs.py:199–234  ·  view source on GitHub ↗
(ctx: Context, no_clean: bool = False, no_color: bool = False)

Source from the content-addressed store, hash-verified

197 },
198)
199def pdf(ctx: Context, no_clean: bool = False, no_color: bool = False):
200 if not shutil.which("inkscape"):
201 ctx.warn("No inkscape binary found")
202 ctx.exit(1)
203 if no_clean is False:
204 ctx.run("make", "clean", cwd="doc/", check=True)
205 opts = [
206 "-W",
207 "-j",
208 "auto",
209 "--keep-going",
210 ]
211 if no_color is False:
212 opts.append("--color")
213 ctx.run(
214 "make",
215 "pdf",
216 f"SPHINXOPTS={' '.join(opts)}",
217 cwd="doc/",
218 check=True,
219 )
220
221 artifact = tools.utils.REPO_ROOT / "doc" / "_build" / "latex" / "Salt.pdf"
222 if "LATEST_RELEASE" in os.environ:
223 shutil.move(
224 artifact, artifact.parent / f"Salt-{os.environ['LATEST_RELEASE']}.pdf"
225 )
226 artifact = artifact.parent / f"Salt-{os.environ['LATEST_RELEASE']}.pdf"
227 github_output = os.environ.get("GITHUB_OUTPUT")
228 if github_output is not None:
229 with open(github_output, "a", encoding="utf-8") as wfh:
230 wfh.write(
231 "has-artifacts=true\n"
232 f"artifact-name={artifact.resolve().name}\n"
233 f"artifact-path={artifact.resolve()}\n"
234 )
235
236
237@docs.command(

Callers

nothing calls this directly

Calls 6

exitMethod · 0.80
openFunction · 0.50
runMethod · 0.45
appendMethod · 0.45
getMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected