1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Wrapper script for MSVC's cl.exe that filters out filename.
7 When cl.exe is run by 'make' we want to be behave more like
8 gcc and be silent by default. There seems to be no flag which
9 tells cl.exe to suppress the name of the file its compiling
10 so we use a wrapper script to filter its output.
12 This was inspired by ninja's msvc wrapper:
13 src/msvc_helper-win32.cc:CLParser::FilterInputFilename
22 p
= subprocess
.Popen(['cl.exe'] + args
, stdout
=subprocess
.PIPE
)
24 extension
= os
.path
.splitext(line
.strip())[1]
25 if extension
.lower() not in ('.c', '.cpp', '.cxx', '.cc'):
26 sys
.stdout
.write(line
)
30 if __name__
== '__main__':
31 sys
.exit(main(sys
.argv
[1:]))