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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 """ | 97 """ |
98 args = ['midl', '/nologo'] + list(flags) + [ | 98 args = ['midl', '/nologo'] + list(flags) + [ |
99 '/out', outdir, | 99 '/out', outdir, |
100 '/tlb', tlb, | 100 '/tlb', tlb, |
101 '/h', h, | 101 '/h', h, |
102 '/dlldata', dlldata, | 102 '/dlldata', dlldata, |
103 '/iid', iid, | 103 '/iid', iid, |
104 '/proxy', proxy, | 104 '/proxy', proxy, |
105 idl] | 105 idl] |
106 env = self._GetEnv(arch) | 106 env = self._GetEnv(arch) |
107 popen = subprocess.Popen(args, shell=False, env=env, | 107 popen = subprocess.Popen(args, shell=True, env=env, |
108 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 108 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
109 out, _ = popen.communicate() | 109 out, _ = popen.communicate() |
110 # Filter junk out of stdout, and write filtered versions. Output we want | 110 # Filter junk out of stdout, and write filtered versions. Output we want |
111 # to filter is pairs of lines that look like this: | 111 # to filter is pairs of lines that look like this: |
112 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl | 112 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl |
113 # objidl.idl | 113 # objidl.idl |
114 lines = out.splitlines() | 114 lines = out.splitlines() |
115 prefix = 'Processing ' | 115 prefix = 'Processing ' |
116 processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) | 116 processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) |
117 for line in lines: | 117 for line in lines: |
118 if not line.startswith(prefix) and line not in processing: | 118 if not line.startswith(prefix) and line not in processing: |
119 print line | 119 print line |
120 return popen.returncode | 120 return popen.returncode |
121 | 121 |
122 def ExecAsmWrapper(self, arch, *args): | 122 def ExecAsmWrapper(self, arch, *args): |
123 """Filter logo banner from invocations of asm.exe.""" | 123 """Filter logo banner from invocations of asm.exe.""" |
124 env = self._GetEnv(arch) | 124 env = self._GetEnv(arch) |
125 # MSVS doesn't assemble x64 asm files. | 125 # MSVS doesn't assemble x64 asm files. |
126 if arch == 'environment.x64': | 126 if arch == 'environment.x64': |
127 return 0 | 127 return 0 |
128 popen = subprocess.Popen(args, shell=False, env=env, | 128 popen = subprocess.Popen(args, shell=True, env=env, |
129 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 129 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
130 out, _ = popen.communicate() | 130 out, _ = popen.communicate() |
131 for line in out.splitlines(): | 131 for line in out.splitlines(): |
132 if (not line.startswith('Copyright (C) Microsoft Corporation') and | 132 if (not line.startswith('Copyright (C) Microsoft Corporation') and |
133 not line.startswith('Microsoft (R) Macro Assembler') and | 133 not line.startswith('Microsoft (R) Macro Assembler') and |
134 not line.startswith(' Assembling: ') and | 134 not line.startswith(' Assembling: ') and |
135 line): | 135 line): |
136 print line | 136 print line |
137 return popen.returncode | 137 return popen.returncode |
138 | 138 |
139 def ExecRcWrapper(self, arch, *args): | 139 def ExecRcWrapper(self, arch, *args): |
140 """Filter logo banner from invocations of rc.exe. Older versions of RC | 140 """Filter logo banner from invocations of rc.exe. Older versions of RC |
141 don't support the /nologo flag.""" | 141 don't support the /nologo flag.""" |
142 env = self._GetEnv(arch) | 142 env = self._GetEnv(arch) |
143 popen = subprocess.Popen(args, shell=False, env=env, | 143 popen = subprocess.Popen(args, shell=True, env=env, |
144 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 144 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
145 out, _ = popen.communicate() | 145 out, _ = popen.communicate() |
146 for line in out.splitlines(): | 146 for line in out.splitlines(): |
147 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and | 147 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and |
148 not line.startswith('Copyright (C) Microsoft Corporation') and | 148 not line.startswith('Copyright (C) Microsoft Corporation') and |
149 line): | 149 line): |
150 print line | 150 print line |
151 return popen.returncode | 151 return popen.returncode |
152 | 152 |
153 def ExecClWrapper(self, arch, depname, *args): | 153 def ExecClWrapper(self, arch, depname, *args): |
(...skipping 11 matching lines...) Expand all Loading... |
165 for |arch|. If |dir| is supplied, use that as the working directory.""" | 165 for |arch|. If |dir| is supplied, use that as the working directory.""" |
166 env = self._GetEnv(arch) | 166 env = self._GetEnv(arch) |
167 args = open(rspfile).read() | 167 args = open(rspfile).read() |
168 dir = dir[0] if dir else None | 168 dir = dir[0] if dir else None |
169 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) | 169 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) |
170 popen.wait() | 170 popen.wait() |
171 return popen.returncode | 171 return popen.returncode |
172 | 172 |
173 if __name__ == '__main__': | 173 if __name__ == '__main__': |
174 sys.exit(main(sys.argv[1:])) | 174 sys.exit(main(sys.argv[1:])) |
OLD | NEW |