Postprocessing of the resulting binary. These are in part required steps, not usable after failure.
(result_filename)
| 484 | |
| 485 | |
| 486 | def executePostProcessing(result_filename): |
| 487 | """Postprocessing of the resulting binary. |
| 488 | |
| 489 | These are in part required steps, not usable after failure. |
| 490 | """ |
| 491 | |
| 492 | # Lots of cases to deal with, |
| 493 | # pylint: disable=too-many-branches |
| 494 | |
| 495 | if isWin32Windows(): |
| 496 | if not shallMakeModule(): |
| 497 | if python_version < 0x300: |
| 498 | # Copy the Windows manifest from the CPython binary to the created |
| 499 | # executable, so it finds "MSCRT.DLL". This is needed for Python2 |
| 500 | # only, for Python3 newer MSVC doesn't hide the C runtime. |
| 501 | manifest = getWindowsExecutableManifest(sys.executable) |
| 502 | else: |
| 503 | manifest = None |
| 504 | |
| 505 | executePostProcessingResources( |
| 506 | result_filename=result_filename, manifest=manifest, onefile=False |
| 507 | ) |
| 508 | |
| 509 | source_dir = getSourceDirectoryPath(onefile=False, create=True) |
| 510 | |
| 511 | # Attach the binary blob as a Windows resource if we used that mode. |
| 512 | if getSconsReportValue(source_dir, "resource_mode") == "win_resource": |
| 513 | addResourceToFile( |
| 514 | target_filename=result_filename, |
| 515 | data=getFileContents(getConstantBlobFilename(source_dir), mode="rb"), |
| 516 | resource_kind=RT_RCDATA, |
| 517 | res_name=3, |
| 518 | lang_id=0, |
| 519 | logger=postprocessing_logger, |
| 520 | ) |
| 521 | |
| 522 | # On macOS, we update the executable path for searching the "libpython" |
| 523 | # library. |
| 524 | if isMacOS() and not shallMakeModule() and not shallUseStaticLibPython(): |
| 525 | for dependency in parseOtoolListingOutput( |
| 526 | getOtoolDependencyOutput(result_filename) |
| 527 | ): |
| 528 | if os.path.basename(dependency).lower().startswith(("python", "libpython")): |
| 529 | python_dll_filename = dependency |
| 530 | break |
| 531 | else: |
| 532 | return postprocessing_logger.sysexit(""" |
| 533 | Error, expected 'libpython dependency not found. Please report the bug.""") |
| 534 | |
| 535 | python_lib_path = os.path.dirname(python_dll_filename) |
| 536 | python_dll_path = python_dll_filename |
| 537 | |
| 538 | if not os.path.exists(python_lib_path): |
| 539 | python_lib_path = os.path.join(sys.prefix, "lib") |
| 540 | python_dll_path = os.path.join( |
| 541 | python_lib_path, os.path.basename(python_dll_filename) |
| 542 | ) |
| 543 |
no test coverage detected
searching dependent graphs…