ansible-core/build_manpages.py

28 lines
718 B
Python

# Copyright (C) Ansible Project
#
# SPDX-License-Identifier: GPL-3.0-or-later
from pathlib import Path
from pep517_backend._backend import (
_convert_rst_in_template_to_manpage,
_generate_rst_in_templates,
_get_package_distribution_version,
)
def main():
Path('docs/man/man1/').mkdir(exist_ok=True, parents=True)
version_number = _get_package_distribution_version()
for rst_in in _generate_rst_in_templates():
_convert_rst_in_template_to_manpage(
rst_doc_template=rst_in.read_text(),
destination_path=rst_in.with_suffix('').with_suffix(''),
version_number=version_number,
)
rst_in.unlink()
if __name__ == "__main__":
main()