Handle new upstream manpage building method

This commit is contained in:
Maxwell G 2023-08-18 00:17:06 +00:00
parent 3d8a45c735
commit 66164773e0
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8
2 changed files with 2 additions and 33 deletions

View File

@ -158,13 +158,9 @@ echo 'python%{python3_pkgversion}-argcomplete'
%pyproject_wheel
# Build manpages
mkdir -p docs/man/man1
%{python3} packaging/cli-doc/build.py man --output-dir docs/man/man1
# XXX: This should be removed once upstream provides a proper way to build
# manpages from source.
# See https://github.com/ansible/ansible/issues/80368
# and the discussion in https://github.com/ansible/ansible/pull/80372
# for more details.
PYTHONPATH="$(pwd)/packaging" %{python3} %{S:2}
%if %{with argcomplete}
# Build shell completions

View File

@ -1,27 +0,0 @@
# 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()