| 213 | |
| 214 | |
| 215 | def cleanup_layout(destination: Path): |
| 216 | for path in ( |
| 217 | destination / "Common7", |
| 218 | destination / "VC" / "Auxiliary", |
| 219 | ): |
| 220 | shutil.rmtree(path, ignore_errors=True) |
| 221 | |
| 222 | msvc_roots = sorted((destination / "VC" / "Tools" / "MSVC").glob("*")) |
| 223 | if msvc_roots: |
| 224 | msvc_root = msvc_roots[0] |
| 225 | for subdirectory in ( |
| 226 | msvc_root / "lib" / "x64" / "store", |
| 227 | msvc_root / "lib" / "x64" / "uwp", |
| 228 | ): |
| 229 | shutil.rmtree(subdirectory, ignore_errors=True) |
| 230 | |
| 231 | sdk_bins = sorted((destination / "Windows Kits" / "10" / "bin").glob("*")) |
| 232 | if sdk_bins: |
| 233 | sdk_root = sdk_bins[0] |
| 234 | for path in ( |
| 235 | destination / "Windows Kits" / "10" / "Catalogs", |
| 236 | destination / "Windows Kits" / "10" / "DesignTime", |
| 237 | destination / "Windows Kits" / "10" / "bin" / sdk_root.name / "chpe", |
| 238 | destination / "Windows Kits" / "10" / "Lib" / sdk_root.name / "ucrt_enclave", |
| 239 | ): |
| 240 | shutil.rmtree(path, ignore_errors=True) |
| 241 | |
| 242 | |
| 243 | def resolve_first_subdirectory(path: Path): |