@@ -45,6 +45,12 @@ def __init__(self, cmake: str, build: Path):
4545 self ._generated_list_parsed = False
4646
4747 def query (self ) -> bool :
48+ """ Use CMake's file API to get JSON information about the build tree
49+
50+ Generates a JSON request file for the current build tree and runs
51+ CMake on the build tree. Deletes the request file immediately
52+ after.
53+ """
4854 if not self .cmake_cache .exists ():
4955 return False
5056
@@ -77,6 +83,11 @@ def query(self) -> bool:
7783 return True
7884
7985 def read_reply (self ) -> bool :
86+ """ Reads the CMake file API reply file and updates internal state
87+
88+ Reads the result of the previous query file and updates
89+ the targets, the cache entries and the cmake files.
90+ """
8091 reply = self ._build / ".cmake" / "api" / "v1" / "reply"
8192 indices = sorted (reply .glob ("index-*.json" ))
8293 if not indices :
@@ -124,15 +135,15 @@ def _read_cache(self, cachepath: Path):
124135 self ._cached_variables [name ] = "\n \n " .join (doc )
125136
126137 def _read_cmake_files (self , jsonpath : Path ):
127- """inspect generated list files"""
138+ """inspect CMake list files that are used during build generation """
128139
129140 if not self ._builtin_variables or self ._generated_list_parsed :
130141 return
131142
132143 with jsonpath .open () as fp :
133144 cmake_files = json .load (fp )
134145
135- # inspect generated list files
146+ # Inspect generated list files: Get the values of variables in each script
136147 with tempfile .TemporaryDirectory () as tmpdirname :
137148 tmplist = Path (tmpdirname ) / "dump.cmake"
138149 with tmplist .open ("w" ) as fp :
@@ -203,6 +214,11 @@ def parse_doc(self) -> None:
203214 self ._parse_modules ()
204215
205216 def _parse_commands (self ) -> None :
217+ """ Load docs for builtin cmake functions
218+
219+ Loads the documentation for builtin cmake functions from the result
220+ of `$ cmake --help-commands`.
221+ """
206222 p = subprocess .run (
207223 [self ._cmake , "--help-commands" ],
208224 stdout = subprocess .PIPE ,
@@ -231,6 +247,11 @@ def _parse_commands(self) -> None:
231247 self ._builtin_commands [command ] = "```cmake\n " + signature + "\n ```"
232248
233249 def _parse_variables (self ) -> None :
250+ """ Load docs for builtin cmake variables
251+
252+ Loads the documentation for builtin cmake variables from
253+ the result of `$ cmake --help-variables`.
254+ """
234255 p = subprocess .run (
235256 [self ._cmake , "--help-variables" ],
236257 stdout = subprocess .PIPE ,
@@ -265,6 +286,11 @@ def _parse_variables(self) -> None:
265286 self ._builtin_variables [variable ] = doc
266287
267288 def _parse_modules (self ) -> None :
289+ """ Loads docs for all modules in the cmake distribution
290+
291+ Loads the documentation for cmake modules included in the
292+ distribution from the result of `$ cmake --help-modules`.
293+ """
268294 p = subprocess .run (
269295 [self ._cmake , "--help-modules" ],
270296 stdout = subprocess .PIPE ,
0 commit comments