|
2 | 2 |
|
3 | 3 | from logging import getLogger |
4 | 4 | from os import getenv |
5 | | -from pathlib import Path |
6 | 5 | from platform import machine as platform_machine |
7 | 6 | from sys import platform as sys_platform, version_info |
8 | 7 | from typing import Any |
@@ -61,12 +60,13 @@ def initialize(self, version: str, build_data: dict[str, Any]) -> None: |
61 | 60 | self._logger.warning(command) |
62 | 61 |
|
63 | 62 | # Execute build plan |
64 | | - build_plan.execute() |
| 63 | + try: |
| 64 | + build_plan.execute() |
| 65 | + finally: |
| 66 | + # Perform any cleanup actions |
| 67 | + build_plan.cleanup() |
65 | 68 |
|
66 | | - # Perform any cleanup actions |
67 | | - build_plan.cleanup() |
68 | | - |
69 | | - if not build_plan._libraries: |
| 69 | + if not build_plan.libraries: |
70 | 70 | raise ValueError("No libraries were created by the build.") |
71 | 71 |
|
72 | 72 | # force include libraries |
@@ -104,13 +104,9 @@ def initialize(self, version: str, build_data: dict[str, Any]) -> None: |
104 | 104 | build_data["tag"] = f"cp{version_major}{version_minor}-cp{version_major}{version_minor}-{os_name}_{machine}" |
105 | 105 |
|
106 | 106 | # force include libraries |
107 | | - for path in Path(".").rglob("*"): |
108 | | - if path.is_dir(): |
109 | | - continue |
110 | | - if str(path).startswith("target") or str(path).startswith("dist") or not str(path).startswith(config.module): |
111 | | - continue |
112 | | - if path.suffix in (".pyd", ".dll", ".so", ".dylib"): |
113 | | - build_data["force_include"][str(path)] = str(path) |
114 | | - |
115 | | - for path in build_data["force_include"]: |
| 107 | + force_include = build_data.setdefault("force_include", {}) |
| 108 | + for artifact in build_plan.copied_artifacts: |
| 109 | + force_include[artifact.distribution_path] = artifact.distribution_path |
| 110 | + |
| 111 | + for path in force_include: |
116 | 112 | self._logger.warning(f"Force include: {path}") |
0 commit comments