Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / native_client_sdk / src / tools / cl_wrapper.py
blob5e6c16048dde2cddfb0c9317c2aaa5b9ecd6c120
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
14 """
16 import os
17 import subprocess
18 import sys
21 def main(args):
22 p = subprocess.Popen(['cl.exe'] + args, stdout=subprocess.PIPE)
23 for line in p.stdout:
24 extension = os.path.splitext(line.strip())[1]
25 if extension.lower() not in ('.c', '.cpp', '.cxx', '.cc'):
26 sys.stdout.write(line)
27 return p.wait()
30 if __name__ == '__main__':
31 sys.exit(main(sys.argv[1:]))