Wrapper around LoadTargetBuildFile for parallel processing. This wrapper is used when LoadTargetBuildFile is executed in a worker process.
(
global_flags,
build_file_path,
variables,
includes,
depth,
check,
generator_input_info,
)
| 498 | |
| 499 | |
| 500 | def CallLoadTargetBuildFile( |
| 501 | global_flags, |
| 502 | build_file_path, |
| 503 | variables, |
| 504 | includes, |
| 505 | depth, |
| 506 | check, |
| 507 | generator_input_info, |
| 508 | ): |
| 509 | """Wrapper around LoadTargetBuildFile for parallel processing. |
| 510 | |
| 511 | This wrapper is used when LoadTargetBuildFile is executed in |
| 512 | a worker process. |
| 513 | """ |
| 514 | |
| 515 | try: |
| 516 | signal.signal(signal.SIGINT, signal.SIG_IGN) |
| 517 | |
| 518 | # Apply globals so that the worker process behaves the same. |
| 519 | for key, value in global_flags.items(): |
| 520 | globals()[key] = value |
| 521 | |
| 522 | SetGeneratorGlobals(generator_input_info) |
| 523 | result = LoadTargetBuildFile( |
| 524 | build_file_path, |
| 525 | per_process_data, |
| 526 | per_process_aux_data, |
| 527 | variables, |
| 528 | includes, |
| 529 | depth, |
| 530 | check, |
| 531 | False, |
| 532 | ) |
| 533 | if not result: |
| 534 | return result |
| 535 | |
| 536 | (build_file_path, dependencies) = result |
| 537 | |
| 538 | # We can safely pop the build_file_data from per_process_data because it |
| 539 | # will never be referenced by this process again, so we don't need to keep |
| 540 | # it in the cache. |
| 541 | build_file_data = per_process_data.pop(build_file_path) |
| 542 | |
| 543 | # This gets serialized and sent back to the main process via a pipe. |
| 544 | # It's handled in LoadTargetBuildFileCallback. |
| 545 | return (build_file_path, build_file_data, dependencies) |
| 546 | except GypError as e: |
| 547 | sys.stderr.write("gyp: %s\n" % e) |
| 548 | return None |
| 549 | except Exception as e: |
| 550 | print("Exception:", e, file=sys.stderr) |
| 551 | print(traceback.format_exc(), file=sys.stderr) |
| 552 | return None |
| 553 | |
| 554 | |
| 555 | class ParallelProcessingError(Exception): |
nothing calls this directly
no test coverage detected
searching dependent graphs…