(self, compileFile, store)
| 186 | |
| 187 | class CompileFileInfo: |
| 188 | def __init__(self, compileFile, store): |
| 189 | self.file_info = {} # {file: command} |
| 190 | self.dir_info = None # {dir: set[file key]} |
| 191 | self.cmd_info = None # {cmd: set[file key]} |
| 192 | |
| 193 | # load compileFile into info |
| 194 | import json |
| 195 | |
| 196 | with open(compileFile) as f: |
| 197 | m: List[dict] = json.load(f) |
| 198 | for i in m: |
| 199 | command = i.get("command") |
| 200 | if not command: |
| 201 | continue |
| 202 | if files := i.get("files"): # batch files, eg: swift module |
| 203 | self.file_info.update((filekey(f), command) for f in files) |
| 204 | if fileLists := i.get( |
| 205 | "fileLists" |
| 206 | ): # file list store in a dedicated file |
| 207 | self.file_info.update( |
| 208 | (filekey(f), command) |
| 209 | for l in fileLists |
| 210 | if os.path.isfile(l) |
| 211 | for f in getFileArgs(l, store.setdefault("filelist", {})) |
| 212 | ) |
| 213 | if file := i.get("file"): # single file info |
| 214 | self.file_info[filekey(file)] = command |
| 215 | |
| 216 | def get(self, filename): |
| 217 | if command := self.file_info.get(filename.lower()): |
nothing calls this directly
no test coverage detected