Files
Matt ClayandGitHub 691c8e8603 Omit pre-built man pages from sdist (#81395)
Since man pages aren't accessible to users after a `pip install`, there's no need to include them in the sdist.
This change makes it trivial to build man pages from source, which makes them much easier to iterate on.
It also simplifies creation and testing of the sdist, since it no longer requires building man pages.

The new `packaging/cli-doc/build.py` script can generate both man pages and RST documentation.
This supports inclusion on the docs site without a dependency on `ansible-core` internals.
Having a single implementation for both simplifies keeping the two formats in sync.
2023-08-01 12:48:01 -07:00

39 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eux
source virtualenv.sh
mkdir -p "${JUNIT_OUTPUT_DIR}" # ensure paths relative to this path work
cli_doc="${JUNIT_OUTPUT_DIR}/../../../packaging/cli-doc"
build="${cli_doc}/build.py"
template="template.j2"
# Test `rst` command
pip install jinja2
rst_dir="${OUTPUT_DIR}/rst"
python.py "${build}" rst --output-dir "${rst_dir}" && ./verify.py "${rst_dir}"
python.py "${build}" rst --output-dir "${rst_dir}" --template "${template}" && ./verify.py "${rst_dir}"
# Test `man` command (and the argcomplete code path)
pip install docutils argcomplete
man_dir="${OUTPUT_DIR}/man"
python.py "${build}" man --output-dir "${man_dir}" && ./verify.py "${man_dir}"
python.py "${build}" man --output-dir "${man_dir}" --template "${template}" && ./verify.py "${man_dir}"
# Test `json` command
python.py "${build}" json --output-file docs.json && ls -l docs.json
# Ensure complete coverage of the main conditional
echo "import sys; sys.path.insert(0, '${cli_doc}'); import build" > cover.py
python.py cover.py