40
40
from sphinx .theming import HTMLThemeFactory
41
41
from sphinx .util import isurl , logging
42
42
from sphinx .util ._timestamps import _format_rfc3339_microseconds
43
+ from sphinx .util .console import bold
43
44
from sphinx .util .display import progress_message , status_iterator
44
45
from sphinx .util .docutils import new_document
45
46
from sphinx .util .fileutil import copy_asset
@@ -389,8 +390,9 @@ def math_renderer_name(self) -> str | None:
389
390
return None
390
391
391
392
def get_outdated_docs (self ) -> Iterator [str ]:
393
+ build_info_fname = self .outdir / '.buildinfo'
392
394
try :
393
- with open (path . join ( self . outdir , '.buildinfo' ) , encoding = "utf-8" ) as fp :
395
+ with open (build_info_fname , encoding = "utf-8" ) as fp :
394
396
buildinfo = BuildInfo .load (fp )
395
397
396
398
if self .build_info != buildinfo :
@@ -405,6 +407,21 @@ def get_outdated_docs(self) -> Iterator[str]:
405
407
406
408
if self .templates :
407
409
template_mtime = int (self .templates .newest_template_mtime () * 10 ** 6 )
410
+ try :
411
+ old_mtime = _last_modified_time (build_info_fname )
412
+ except Exception :
413
+ pass
414
+ else :
415
+ # Let users know they have a newer template
416
+ if template_mtime > old_mtime :
417
+ logger .info (
418
+ bold ("building [html]: " ) +
419
+ __ (
420
+ "template %s has been changed since the previous build, "
421
+ "all docs will be rebuilt"
422
+ ),
423
+ self .templates .newest_template_name (),
424
+ )
408
425
else :
409
426
template_mtime = 0
410
427
for docname in self .env .found_docs :
0 commit comments