| 24 | |
| 25 | class CustomBuildHook(BuildHookInterface): |
| 26 | def initialize(self, version, build_data): |
| 27 | # Inject the platform specifier into the wheel's filename. |
| 28 | if os.environ.get("PYI_WHEEL_TAG"): |
| 29 | build_data["tag"] = "py3-none-" + os.environ["PYI_WHEEL_TAG"] |
| 30 | |
| 31 | pyi_platform = os.environ.get("PYI_PLATFORM") |
| 32 | if pyi_platform: |
| 33 | if "Darwin" in pyi_platform: |
| 34 | icons = ["icns"] |
| 35 | elif "Windows" in pyi_platform: |
| 36 | icons = ["ico"] |
| 37 | else: |
| 38 | icons = [] |
| 39 | else: |
| 40 | icons = ["ico", "icns"] |
| 41 | |
| 42 | build_data["artifacts"] += [ |
| 43 | f"PyInstaller/bootloader/{pyi_platform or '*'}/*", |
| 44 | *(f"PyInstaller/bootloader/images/*.{suffix}" for suffix in icons), |
| 45 | ] |
| 46 | self.run() |
| 47 | |
| 48 | def bootloader_exists(self): |
| 49 | # Checks if the console, non-debug bootloader exists |