| # Copyright 2022 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Delete .ninja_deps if it references files inside a libc++ dir which has |
| since been reverted back to a file, and would cause Ninja fail on Windows. See |
| os.chdir(os.path.join(os.path.dirname(__file__), '..')) |
| # Paths that have switched between being a directory and regular file. |
| 'buildtools/third_party/libc++/trunk/include/__string', |
| 'buildtools/third_party/libc++/trunk/include/__tuple', |
| if os.path.isdir(bad_dir): |
| # If it's a dir, .ninja_deps referencing files in it is not a problem. |
| for out_dir in os.listdir('out'): |
| ninja_deps = os.path.join('out', out_dir, '.ninja_deps') |
| if str.encode(bad_dir) + b'/' in open(ninja_deps, 'rb').read(): |
| print('Deleting', ninja_deps) |
| except FileNotFoundError: |
| if __name__ == '__main__': |