Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: pylib/gyp/win_tool.py

Issue 9990006: ninja windows: Support magic idl build rules (Closed) Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: review fixes Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 3 # Copyright (c) 2012 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Utility functions for Windows builds. 7 """Utility functions for Windows builds.
8 8
9 These functions are executed via gyp-win-tool when using the ninja generator. 9 These functions are executed via gyp-win-tool when using the ninja generator.
10 """ 10 """
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 if os.path.isdir(source): 48 if os.path.isdir(source):
49 shutil.copytree(source, dest) 49 shutil.copytree(source, dest)
50 else: 50 else:
51 shutil.copy2(source, dest) 51 shutil.copy2(source, dest)
52 52
53 def ExecLinkWrapper(self, *args): 53 def ExecLinkWrapper(self, *args):
54 """Filter diagnostic output from link that looks like: 54 """Filter diagnostic output from link that looks like:
55 ' Creating library ui.dll.lib and object ui.dll.exp' 55 ' Creating library ui.dll.lib and object ui.dll.exp'
56 This happens when there are exports from the dll or exe. 56 This happens when there are exports from the dll or exe.
57 """ 57 """
58 popen = subprocess.Popen(args, 58 popen = subprocess.Popen(
59 stdout=subprocess.PIPE, 59 args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
60 stderr=subprocess.STDOUT)
61 out, _ = popen.communicate() 60 out, _ = popen.communicate()
62 for line in out.splitlines(): 61 for line in out.splitlines():
63 if not line.startswith(' Creating library '): 62 if not line.startswith(' Creating library '):
64 sys.stdout.write(line) 63 sys.stdout.write(line)
65 return popen.returncode 64 return popen.returncode
66 65
66 def ExecMidlWrapper(self, outdir, tlb, h, dlldata, iid, proxy, idl, *flags):
67 """Filter noisy filenames output from MIDL compile step that isn't
68 quietable via command line flags.
69 """
70 args = ['midl', '/nologo'] + list(flags) + [
71 '/out', outdir,
72 '/tlb', tlb,
73 '/h', h,
74 '/dlldata', dlldata,
75 '/iid', iid,
76 '/proxy', proxy,
77 idl]
78 popen = subprocess.Popen(
79 args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
80 out, _ = popen.communicate()
81 # Filter junk out of stdout, and write filtered versions. Output we want
82 # to filter is pairs of lines that look like this:
83 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl
84 # objidl.idl
85 lines = out.splitlines()
86 prefix = 'Processing '
87 processing = set(os.path.basename(x) for x in lines if x.startswith(prefix))
88 for line in lines:
89 if not line.startswith(prefix) and line not in processing:
90 sys.stdout.write(line)
91 return popen.returncode
92
67 if __name__ == '__main__': 93 if __name__ == '__main__':
68 sys.exit(main(sys.argv[1:])) 94 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698