Get the path to the LLVM standard library module on Linux or macOS. If multiple paths are found, return the one with the latest LLVM version.
(search: str)
| 189 | |
| 190 | |
| 191 | def get_llvm_std_module(search: str) -> str | None: |
| 192 | """Get the path to the LLVM standard library module on Linux or macOS. If multiple paths are found, return the one with the latest LLVM version.""" |
| 193 | try: |
| 194 | llvm_path: str = subprocess.check_output([f"find {search} -name std.cppm"], text=True, shell=True).strip() |
| 195 | except subprocess.CalledProcessError: |
| 196 | llvm_path: str = "" |
| 197 | all_paths: list[str] = [line for line in llvm_path.splitlines() if line.strip()] |
| 198 | if len(all_paths) == 0: |
| 199 | return None |
| 200 | return max(all_paths, key=lambda p: parse_llvm_version(p) or (0,)) |
| 201 | |
| 202 | |
| 203 | def find_vs_path() -> pathlib.Path | None: |
no test coverage detected