@@ -701,6 +701,7 @@ def translation_branch(self):
701
701
def build (self ):
702
702
"""Build this version/language doc."""
703
703
logging .info ("Build start." )
704
+ start_time = perf_counter ()
704
705
sphinxopts = list (self .language .sphinxopts )
705
706
sphinxopts .extend (["-q" ])
706
707
if self .language .tag != "en" :
@@ -777,7 +778,7 @@ def is_mac():
777
778
setup_switchers (
778
779
self .versions , self .languages , self .checkout / "Doc" / "build" / "html"
779
780
)
780
- logging .info ("Build done." )
781
+ logging .info ("Build done (%s)." , format_seconds ( perf_counter () - start_time ) )
781
782
782
783
def build_venv (self ):
783
784
"""Build a venv for the specific Python version.
@@ -800,6 +801,7 @@ def build_venv(self):
800
801
def copy_build_to_webroot (self , http : urllib3 .PoolManager ) -> None :
801
802
"""Copy a given build to the appropriate webroot with appropriate rights."""
802
803
logging .info ("Publishing start." )
804
+ start_time = perf_counter ()
803
805
self .www_root .mkdir (parents = True , exist_ok = True )
804
806
if self .language .tag == "en" :
805
807
target = self .www_root / self .version .name
@@ -912,7 +914,9 @@ def copy_build_to_webroot(self, http: urllib3.PoolManager) -> None:
912
914
purge (http , * prefixes )
913
915
for prefix in prefixes :
914
916
purge (http , * [prefix + p for p in changed ])
915
- logging .info ("Publishing done" )
917
+ logging .info (
918
+ "Publishing done (%s)." , format_seconds (perf_counter () - start_time )
919
+ )
916
920
917
921
def should_rebuild (self ):
918
922
state = self .load_state ()
@@ -1141,8 +1145,24 @@ def parse_languages_from_config():
1141
1145
return languages
1142
1146
1143
1147
1148
+ def format_seconds (seconds : float ) -> str :
1149
+ hours , remainder = divmod (seconds , 3600 )
1150
+ minutes , seconds = divmod (remainder , 60 )
1151
+ hours , minutes , seconds = int (hours ), int (minutes ), round (seconds )
1152
+
1153
+ match (hours , minutes , seconds ):
1154
+ case 0 , 0 , s :
1155
+ return f"{ s } s"
1156
+ case 0 , m , s :
1157
+ return f"{ m } m { s } s"
1158
+ case h , m , s :
1159
+ return f"{ h } h { m } m { s } s"
1160
+
1161
+
1144
1162
def build_docs (args ) -> bool :
1145
1163
"""Build all docs (each language and each version)."""
1164
+ logging .info ("Full build start." )
1165
+ start_time = perf_counter ()
1146
1166
http = urllib3 .PoolManager ()
1147
1167
versions = parse_versions_from_devguide (http )
1148
1168
languages = parse_languages_from_config ()
@@ -1205,6 +1225,8 @@ def build_docs(args) -> bool:
1205
1225
)
1206
1226
proofread_canonicals (args .www_root , args .skip_cache_invalidation , http )
1207
1227
1228
+ logging .info ("Full build done (%s)." , format_seconds (perf_counter () - start_time ))
1229
+
1208
1230
return all_built_successfully
1209
1231
1210
1232
0 commit comments