(build_file_path, data, aux_data, includes, is_target, check)
| 221 | |
| 222 | |
| 223 | def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check): |
| 224 | if build_file_path in data: |
| 225 | return data[build_file_path] |
| 226 | |
| 227 | if os.path.exists(build_file_path): |
| 228 | build_file_contents = open(build_file_path, encoding="utf-8").read() |
| 229 | else: |
| 230 | raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})") |
| 231 | |
| 232 | build_file_data = None |
| 233 | try: |
| 234 | if check: |
| 235 | build_file_data = CheckedEval(build_file_contents) |
| 236 | else: |
| 237 | build_file_data = eval(build_file_contents, {"__builtins__": {}}, None) |
| 238 | except SyntaxError as e: |
| 239 | e.filename = build_file_path |
| 240 | raise |
| 241 | except Exception as e: |
| 242 | gyp.common.ExceptionAppend(e, "while reading " + build_file_path) |
| 243 | raise |
| 244 | |
| 245 | if not isinstance(build_file_data, dict): |
| 246 | raise GypError("%s does not evaluate to a dictionary." % build_file_path) |
| 247 | |
| 248 | data[build_file_path] = build_file_data |
| 249 | aux_data[build_file_path] = {} |
| 250 | |
| 251 | # Scan for includes and merge them in. |
| 252 | if "skip_includes" not in build_file_data or not build_file_data["skip_includes"]: |
| 253 | try: |
| 254 | if is_target: |
| 255 | LoadBuildFileIncludesIntoDict( |
| 256 | build_file_data, build_file_path, data, aux_data, includes, check |
| 257 | ) |
| 258 | else: |
| 259 | LoadBuildFileIncludesIntoDict( |
| 260 | build_file_data, build_file_path, data, aux_data, None, check |
| 261 | ) |
| 262 | except Exception as e: |
| 263 | gyp.common.ExceptionAppend( |
| 264 | e, "while reading includes of " + build_file_path |
| 265 | ) |
| 266 | raise |
| 267 | |
| 268 | return build_file_data |
| 269 | |
| 270 | |
| 271 | def LoadBuildFileIncludesIntoDict( |
no test coverage detected
searching dependent graphs…