Skip to content

Ensure exit status is returned by build_docs.py #286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,20 +911,21 @@
return "cpython"


def main() -> None:
def main() -> int:
"""Script entry point."""
args = parse_args()
setup_logging(args.log_directory, args.select_output)
load_environment_variables()

if args.select_output is None:
build_docs_with_lock(args, "build_docs.lock")
elif args.select_output == "no-html":
build_docs_with_lock(args, "build_docs_archives.lock")
elif args.select_output == "only-html":
build_docs_with_lock(args, "build_docs_html.lock")
elif args.select_output == "only-html-en":
build_docs_with_lock(args, "build_docs_html_en.lock")
return build_docs_with_lock(args, "build_docs.lock")
if args.select_output == "no-html":
return build_docs_with_lock(args, "build_docs_archives.lock")
if args.select_output == "only-html":
return build_docs_with_lock(args, "build_docs_html.lock")
if args.select_output == "only-html-en":
return build_docs_with_lock(args, "build_docs_html_en.lock")
return EX_FAILURE

Check warning on line 928 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L921-L928

Added lines #L921 - L928 were not covered by tests


def parse_args() -> argparse.Namespace:
Expand Down Expand Up @@ -1073,12 +1074,12 @@
return EX_FAILURE

try:
return EX_OK if build_docs(args) else EX_FAILURE
return build_docs(args)

Check warning on line 1077 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L1077

Added line #L1077 was not covered by tests
finally:
lock.close()


def build_docs(args: argparse.Namespace) -> bool:
def build_docs(args: argparse.Namespace) -> int:
"""Build all docs (each language and each version)."""
logging.info("Full build start.")
start_time = perf_counter()
Expand Down Expand Up @@ -1159,7 +1160,7 @@

logging.info("Full build done (%s).", format_seconds(perf_counter() - start_time))

return any_build_failed
return EX_FAILURE if any_build_failed else EX_OK

Check warning on line 1163 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L1163

Added line #L1163 was not covered by tests


def parse_versions_from_devguide(http: urllib3.PoolManager) -> Versions:
Expand Down Expand Up @@ -1397,4 +1398,4 @@


if __name__ == "__main__":
sys.exit(main())
raise SystemExit(main())
Loading