account for the removed Makefile

This commit is contained in:
Maxwell G 2023-04-20 20:47:22 +00:00
parent 3394859eb9
commit c98092b221
No known key found for this signature in database
GPG Key ID: F79E4E25E8C661F8
2 changed files with 39 additions and 6 deletions

View File

@ -11,7 +11,8 @@ Release: 2%{?dist}
# are BSD licensed. There are various files scattered throughout the codebase
# containing code under different licenses.
License: GPL-3.0-or-later AND BSD-2-Clause AND PSF-2.0 AND MIT AND Apache-2.0
Source: https://github.com/ansible/ansible/archive/v%{uversion}/%{name}-%{uversion}.tar.gz
Source0: https://github.com/ansible/ansible/archive/v%{uversion}/%{name}-%{uversion}.tar.gz
Source1: build_manpages.py
Url: https://ansible.com
BuildArch: noarch
@ -48,7 +49,6 @@ Obsoletes: ansible-base < 2.10.6-1
BuildRequires: make
BuildRequires: python%{python3_pkgversion}-devel
# Needed to build manpages from source.
BuildRequires: python%{python3_pkgversion}-straight-plugin
BuildRequires: python%{python3_pkgversion}-docutils
# Shell completions
BuildRequires: python%{python3_pkgversion}-argcomplete
@ -95,7 +95,6 @@ This package installs extensive documentation for ansible-core
%autosetup -p1 -n ansible-%{uversion}
find \( -name '.git_keep' -o -name '.rstcheck.cfg' \) -delete
# ansible-test is executed directly by the Makefile, so we need to fix the shebang.
sed -i -s 's|/usr/bin/env python|%{python3}|' \
bin/ansible-test \
test/lib/ansible_test/_util/target/cli/ansible_test_cli_stub.py
@ -116,7 +115,13 @@ sed '/^mock$/d' test/lib/ansible_test/_data/requirements/units.txt > _requiremen
%pyproject_wheel
# Build manpages
make PYTHON=%{python3} docs
# 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:1}
# Build shell completions
(
@ -215,8 +220,8 @@ install -Dpm 0644 licenses/* -t %{buildroot}%{_pkglicensedir}
%check
%if %{with tests}
ln -s /usr/bin/pytest-3 bin/pytest
make PYTHON=%{python3} tests-py3
%{python3} bin/ansible-test \
units --local --python-interpreter %{python3}
%endif
@ -242,6 +247,7 @@ make PYTHON=%{python3} tests-py3
%changelog
* Mon Apr 24 2023 Maxwell G <maxwell@gtmx.me> - 2.15.0~b3-1
- Update to 2.15.0~b3.
- Account for the removed Makefile
* Mon Apr 24 2023 Maxwell G <maxwell@gtmx.me> - 2.14.4-2
- Add gating

27
build_manpages.py Normal file
View File

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