@@ -911,20 +911,21 @@ def _checkout_name(select_output: str | None) -> str:
911
911
return "cpython"
912
912
913
913
914
- def main () -> None :
914
+ def main () -> int :
915
915
"""Script entry point."""
916
916
args = parse_args ()
917
917
setup_logging (args .log_directory , args .select_output )
918
918
load_environment_variables ()
919
919
920
920
if args .select_output is None :
921
- build_docs_with_lock (args , "build_docs.lock" )
922
- elif args .select_output == "no-html" :
923
- build_docs_with_lock (args , "build_docs_archives.lock" )
924
- elif args .select_output == "only-html" :
925
- build_docs_with_lock (args , "build_docs_html.lock" )
926
- elif args .select_output == "only-html-en" :
927
- build_docs_with_lock (args , "build_docs_html_en.lock" )
921
+ return build_docs_with_lock (args , "build_docs.lock" )
922
+ if args .select_output == "no-html" :
923
+ return build_docs_with_lock (args , "build_docs_archives.lock" )
924
+ if args .select_output == "only-html" :
925
+ return build_docs_with_lock (args , "build_docs_html.lock" )
926
+ if args .select_output == "only-html-en" :
927
+ return build_docs_with_lock (args , "build_docs_html_en.lock" )
928
+ return EX_FAILURE
928
929
929
930
930
931
def parse_args () -> argparse .Namespace :
@@ -1073,12 +1074,12 @@ def build_docs_with_lock(args: argparse.Namespace, lockfile_name: str) -> int:
1073
1074
return EX_FAILURE
1074
1075
1075
1076
try :
1076
- return EX_OK if build_docs (args ) else EX_FAILURE
1077
+ return build_docs (args )
1077
1078
finally :
1078
1079
lock .close ()
1079
1080
1080
1081
1081
- def build_docs (args : argparse .Namespace ) -> bool :
1082
+ def build_docs (args : argparse .Namespace ) -> int :
1082
1083
"""Build all docs (each language and each version)."""
1083
1084
logging .info ("Full build start." )
1084
1085
start_time = perf_counter ()
@@ -1159,7 +1160,7 @@ def build_docs(args: argparse.Namespace) -> bool:
1159
1160
1160
1161
logging .info ("Full build done (%s)." , format_seconds (perf_counter () - start_time ))
1161
1162
1162
- return any_build_failed
1163
+ return EX_FAILURE if any_build_failed else EX_OK
1163
1164
1164
1165
1165
1166
def parse_versions_from_devguide (http : urllib3 .PoolManager ) -> Versions :
@@ -1397,4 +1398,4 @@ def purge_surrogate_key(http: urllib3.PoolManager, surrogate_key: str) -> None:
1397
1398
1398
1399
1399
1400
if __name__ == "__main__" :
1400
- sys . exit (main ())
1401
+ raise SystemExit (main ())
0 commit comments