Get the target for the build.
()
| 191 | |
| 192 | |
| 193 | def get_target(): |
| 194 | """Get the target for the build.""" |
| 195 | config = getConfig() |
| 196 | backend_config = config.get("backend_config") or {} |
| 197 | |
| 198 | def get_os(): |
| 199 | """Get OS name for target.""" |
| 200 | if OS_NAME == "Windows": |
| 201 | return "win" |
| 202 | elif OS_NAME == "Darwin": |
| 203 | return "mac" |
| 204 | elif OS_NAME == "Linux": |
| 205 | return "linux" |
| 206 | else: |
| 207 | return OS_NAME.lower() |
| 208 | |
| 209 | def get_arch(): |
| 210 | """Get architecture for target.""" |
| 211 | machine = platform.machine().lower() |
| 212 | if machine in ("x86_64", "amd64"): |
| 213 | return "x64" |
| 214 | elif machine in ("arm64", "aarch64"): |
| 215 | return "arm64" |
| 216 | else: |
| 217 | return machine |
| 218 | |
| 219 | platform_name = backend_config.get("platform", get_platform_name()) |
| 220 | variant_name = backend_config.get("variant", get_variant_name(platform_name)) |
| 221 | |
| 222 | target = f"{get_os()}-{get_arch()}-{platform_name}-{variant_name}" |
| 223 | |
| 224 | return target |
| 225 | |
| 226 | |
| 227 | def get_platform_name(): |
no test coverage detected