@@ -103,6 +103,8 @@ class Builder:
103
103
#: The file format produced by the builder allows images to be embedded using data-URIs.
104
104
supported_data_uri_images : ClassVar [bool ] = False
105
105
106
+ phase : BuildPhase = BuildPhase .INITIALIZATION
107
+
106
108
srcdir = _StrPathProperty ()
107
109
confdir = _StrPathProperty ()
108
110
outdir = _StrPathProperty ()
@@ -431,14 +433,14 @@ def build(
431
433
pickle .dump (self .env , f , pickle .HIGHEST_PROTOCOL )
432
434
433
435
# global actions
434
- self ._app . phase = BuildPhase .CONSISTENCY_CHECK
436
+ self .phase = BuildPhase .CONSISTENCY_CHECK
435
437
with progress_message (__ ('checking consistency' )):
436
438
self .env .check_consistency ()
437
439
else :
438
440
if method == 'update' and not docnames :
439
441
logger .info (bold (__ ('no targets are out of date.' )))
440
442
441
- self ._app . phase = BuildPhase .RESOLVING
443
+ self .phase = BuildPhase .RESOLVING
442
444
443
445
# filter "docnames" (list of outdated files) by the updated
444
446
# found_docs of the environment; this will remove docs that
@@ -776,21 +778,17 @@ def _write_serial(self, docnames: Sequence[str]) -> None:
776
778
len (docnames ),
777
779
self ._app .verbosity ,
778
780
):
779
- _write_docname (
780
- docname , app = self ._app , env = self .env , builder = self , tags = self .tags
781
- )
781
+ _write_docname (docname , env = self .env , builder = self , tags = self .tags )
782
782
783
783
def _write_parallel (self , docnames : Sequence [str ], nproc : int ) -> None :
784
784
def write_process (docs : list [tuple [str , nodes .document ]]) -> None :
785
- self ._app . phase = BuildPhase .WRITING
785
+ self .phase = BuildPhase .WRITING
786
786
for docname , doctree in docs :
787
787
self .write_doc (docname , doctree )
788
788
789
789
# warm up caches/compile templates using the first document
790
790
firstname , docnames = docnames [0 ], docnames [1 :]
791
- _write_docname (
792
- firstname , app = self ._app , env = self .env , builder = self , tags = self .tags
793
- )
791
+ _write_docname (firstname , env = self .env , builder = self , tags = self .tags )
794
792
795
793
tasks = ParallelTasks (nproc )
796
794
chunks = make_chunks (docnames , nproc )
@@ -808,7 +806,7 @@ def write_process(docs: list[tuple[str, nodes.document]]) -> None:
808
806
def on_chunk_done (args : list [tuple [str , nodes .document ]], result : None ) -> None :
809
807
next (progress )
810
808
811
- self ._app . phase = BuildPhase .RESOLVING
809
+ self .phase = BuildPhase .RESOLVING
812
810
for chunk in chunks :
813
811
arg = []
814
812
for docname in chunk :
@@ -884,15 +882,14 @@ def _write_docname(
884
882
docname : str ,
885
883
/ ,
886
884
* ,
887
- app : Sphinx ,
888
885
env : BuildEnvironment ,
889
886
builder : Builder ,
890
887
tags : Tags ,
891
888
) -> None :
892
889
"""Write a single document."""
893
- app .phase = BuildPhase .RESOLVING
890
+ builder .phase = BuildPhase .RESOLVING
894
891
doctree = env .get_and_resolve_doctree (docname , builder = builder , tags = tags )
895
- app .phase = BuildPhase .WRITING
892
+ builder .phase = BuildPhase .WRITING
896
893
builder .write_doc_serialized (docname , doctree )
897
894
builder .write_doc (docname , doctree )
898
895
0 commit comments