Return the stable-ABI Python library path for Windows abi3 extensions.
()
| 69 | |
| 70 | |
| 71 | def _get_windows_python_sabi_library() -> Path: |
| 72 | """Return the stable-ABI Python library path for Windows abi3 extensions.""" |
| 73 | candidate_roots = [] |
| 74 | for raw_root in ( |
| 75 | sys.base_prefix, |
| 76 | sys.base_exec_prefix, |
| 77 | sysconfig.get_config_var("installed_base"), |
| 78 | sysconfig.get_config_var("base"), |
| 79 | ): |
| 80 | if not raw_root: |
| 81 | continue |
| 82 | candidate_root = Path(raw_root).resolve() |
| 83 | if candidate_root not in candidate_roots: |
| 84 | candidate_roots.append(candidate_root) |
| 85 | |
| 86 | candidate_paths = [] |
| 87 | for root in candidate_roots: |
| 88 | candidate_paths.extend( |
| 89 | [ |
| 90 | root / "libs" / "python3.lib", |
| 91 | root / "python3.dll", |
| 92 | ] |
| 93 | ) |
| 94 | |
| 95 | for candidate_path in candidate_paths: |
| 96 | if candidate_path.exists(): |
| 97 | return candidate_path |
| 98 | |
| 99 | searched = ", ".join(str(path) for path in candidate_paths) or "<none>" |
| 100 | raise RuntimeError( |
| 101 | "Could not locate the Windows stable-ABI Python library for abi3 engine modules. " |
| 102 | f"Searched: {searched}" |
| 103 | ) |
| 104 | |
| 105 | |
| 106 | class OpenVikingBuildExt(build_ext): |