OLD | NEW |
---|---|
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 """ | 57 """ |
58 popen = subprocess.Popen(args, | 58 popen = subprocess.Popen(args, |
59 stdout=subprocess.PIPE, | 59 stdout=subprocess.PIPE, |
60 stderr=subprocess.STDOUT) | 60 stderr=subprocess.STDOUT) |
61 out, _ = popen.communicate() | 61 out, _ = popen.communicate() |
62 for line in out.splitlines(): | 62 for line in out.splitlines(): |
63 if not line.startswith(' Creating library '): | 63 if not line.startswith(' Creating library '): |
64 sys.stdout.write(line) | 64 sys.stdout.write(line) |
65 return popen.returncode | 65 return popen.returncode |
66 | 66 |
67 def ExecMidlWrapper(self, outdir, tlb, h, dlldata, iid, proxy, idl, *flags): | |
68 """Filter noisy filenames output from MIDL compile step that isn't | |
69 quietable via command line flags. | |
70 """ | |
71 args = ['midl', '/nologo'] + list(flags) + [ | |
72 '/out', outdir, | |
73 '/tlb', tlb, | |
74 '/h', h, | |
75 '/dlldata', dlldata, | |
76 '/iid', iid, | |
77 '/proxy', proxy, | |
78 idl] | |
79 popen = subprocess.Popen(args, | |
Nico
2012/04/05 04:37:11
nit: if you break after (, the rest might all fit
scottmg
2012/04/05 17:52:42
Done. (and above)
| |
80 shell=True, | |
81 stdout=subprocess.PIPE, | |
82 stderr=subprocess.STDOUT) | |
83 out, _ = popen.communicate() | |
84 # Filter junk out of stdout, and write filtered versions. Output we want | |
85 # to filter is pairs of lines that look like this: | |
86 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl | |
87 # objidl.idl | |
88 lines = out.splitlines() | |
89 prefix = 'Processing ' | |
90 processings = [os.path.basename(x) for x in lines if x.startswith(prefix)] | |
Nico
2012/04/05 04:37:11
:-D
Do wrap this in a set(), just in case the out
scottmg
2012/04/05 17:52:42
Done.
| |
91 for line in lines: | |
92 if not line.startswith(prefix) and x not in processings: | |
93 sys.stdout.write(line) | |
94 return popen.returncode | |
95 | |
67 if __name__ == '__main__': | 96 if __name__ == '__main__': |
68 sys.exit(main(sys.argv[1:])) | 97 sys.exit(main(sys.argv[1:])) |
OLD | NEW |