Return the path to the default C/C++ compiler. Returns ------- out: Optional[str] The path to the default C/C++ compiler, or None if none was found.
()
| 40 | |
| 41 | |
| 42 | def get_cc(): |
| 43 | """Return the path to the default C/C++ compiler. |
| 44 | |
| 45 | Returns |
| 46 | ------- |
| 47 | out: Optional[str] |
| 48 | The path to the default C/C++ compiler, or None if none was found. |
| 49 | """ |
| 50 | |
| 51 | if not _is_linux_like(): |
| 52 | return None |
| 53 | |
| 54 | env_cxx = os.environ.get("CXX") or os.environ.get("CC") |
| 55 | if env_cxx: |
| 56 | return env_cxx |
| 57 | cc_names = ["g++", "gcc", "clang++", "clang", "c++", "cc"] |
| 58 | dirs_in_path = os.get_exec_path() |
| 59 | for cc in cc_names: |
| 60 | for d in dirs_in_path: |
| 61 | cc_path = os.path.join(d, cc) |
| 62 | if os.path.isfile(cc_path) and os.access(cc_path, os.X_OK): |
| 63 | return cc_path |
| 64 | return None |
| 65 | |
| 66 | |
| 67 | def create_shared(output, objects, options=None, cc=None, cwd=None, ccache_env=None): |
no test coverage detected
searching dependent graphs…