You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
908 B

#!/usr/bin/env python3
from pathlib import Path
SRCDIR = Path("octodns")
DOC_MODULE_DIR = Path("docs/modules")
DOC_MODULE_TEMPLATE = """
====================================
``{module_name}``
====================================
.. automodule:: {module_name}"""
for module in SRCDIR.rglob("*.py"):
if module.name in ["__init__.py", "__about__.py"]:
continue
module_docname = str(module).replace("/", ".").removesuffix(".py")
if module.parent.name != "octodns":
module_docpath = (
DOC_MODULE_DIR / module.parent.name / f"{module_docname}.rst"
)
else:
module_docpath = DOC_MODULE_DIR / f"{module_docname}.rst"
print(f"creating sphinx doc module for: {module_docname}")
module_docpath.parent.mkdir(exist_ok=True, parents=True)
module_docpath.write_text(
DOC_MODULE_TEMPLATE.format(module_name=module_docname).strip()
)