r''' Equivalent to writing the content into the file but will not touch the file if it already had the right content (to avoid triggering recompile).
(filename, new_content)
| 266 | return ['clang++', 'clang'] if IS_MACOS else ['g++', 'gcc', 'gnu-c++', 'gnu-cc', 'clang++', 'clang'] |
| 267 | |
| 268 | def _maybe_write(filename, new_content): |
| 269 | r''' |
| 270 | Equivalent to writing the content into the file but will not touch the file |
| 271 | if it already had the right content (to avoid triggering recompile). |
| 272 | ''' |
| 273 | if os.path.exists(filename): |
| 274 | with open(filename) as f: |
| 275 | content = f.read() |
| 276 | |
| 277 | if content == new_content: |
| 278 | # The file already contains the right thing! |
| 279 | return |
| 280 | |
| 281 | with open(filename, 'w') as source_file: |
| 282 | source_file.write(new_content) |
| 283 | |
| 284 | def get_default_build_root() -> str: |
| 285 | """ |
no test coverage detected
searching dependent graphs…