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