mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
When a release doc only exists as a template, copy it into the right path
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
6cfbd27473
commit
d14de602b1
1 changed files with 31 additions and 0 deletions
31
doc/conf.py
31
doc/conf.py
|
@ -420,6 +420,35 @@ class ReleasesTree(TocTree):
|
|||
return rst
|
||||
|
||||
|
||||
def copy_release_templates_pre(app):
|
||||
app._copied_release_files = []
|
||||
docs_path = pathlib.Path(docs_basepath)
|
||||
release_files_dir = docs_path / "topics" / "releases"
|
||||
release_template_files_dir = release_files_dir / "templates"
|
||||
for fpath in release_template_files_dir.iterdir():
|
||||
dest = release_files_dir / fpath.name.replace(".template", "")
|
||||
if dest.exists():
|
||||
continue
|
||||
log.info(
|
||||
"Copying '%s' -> '%s' just for this build ...",
|
||||
fpath.relative_to(docs_path),
|
||||
dest.relative_to(docs_path),
|
||||
)
|
||||
app._copied_release_files.append(dest)
|
||||
shutil.copyfile(fpath, dest)
|
||||
|
||||
|
||||
def copy_release_templates_post(app, exception):
|
||||
docs_path = pathlib.Path(docs_basepath)
|
||||
for fpath in app._copied_release_files:
|
||||
log.info(
|
||||
"The release file '%s' was copied for the build, but its not in "
|
||||
"version control system. Deleting.",
|
||||
fpath.relative_to(docs_path),
|
||||
)
|
||||
fpath.unlink()
|
||||
|
||||
|
||||
def extract_module_deprecations(app, what, name, obj, options, lines):
|
||||
"""
|
||||
Add a warning to the modules being deprecated into extensions.
|
||||
|
@ -452,4 +481,6 @@ def extract_module_deprecations(app, what, name, obj, options, lines):
|
|||
def setup(app):
|
||||
app.add_directive("releasestree", ReleasesTree)
|
||||
app.connect("autodoc-skip-member", skip_mod_init_member)
|
||||
app.connect("builder-inited", copy_release_templates_pre)
|
||||
app.connect("build-finished", copy_release_templates_post)
|
||||
app.connect("autodoc-process-docstring", extract_module_deprecations)
|
||||
|
|
Loading…
Add table
Reference in a new issue