forked from pulumi/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_python_docs.sh
executable file
·40 lines (33 loc) · 1.02 KB
/
generate_python_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
set -o errexit -o pipefail
set -x
# Optional argument to generate docs for just a single provider.
REPO_OVERRIDE="${1:-}"
PACKAGES=(
"pulumi"
"pulumi_policy"
"pulumi_terraform"
)
pushd "tools/pydocgen"
pipenv --python 3
pipenv install
if [ -z "${REPO_OVERRIDE:-}" ]; then
echo "Building all Python docs..."
# Install the Python package for all the providers.
for PACKAGE in "${PACKAGES[@]}" ; do \
pipenv run pip install "${PACKAGE}"
done
# Run the pydocgen to generate the docs for all the packages.
pipenv run python -m pydocgen "../../content/docs/reference/pkg"
else
# Install the Python package and run the pydocgen tool for just the provider that
# was requested.
echo "Building Python docs for ${REPO_OVERRIDE}..."
PACKAGE="pulumi"
if [ "${REPO_OVERRIDE}" != "pulumi" ]; then
PACKAGE="pulumi_${REPO_OVERRIDE}"
fi
pipenv run pip install "${PACKAGE}"
pipenv run python -m pydocgen "../../content/docs/reference/pkg" "${PACKAGE}"
fi
popd