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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl | 99 # Processing C:\Program Files (x86)\Microsoft SDKs\...\include\objidl.idl |
100 # objidl.idl | 100 # objidl.idl |
101 lines = out.splitlines() | 101 lines = out.splitlines() |
102 prefix = 'Processing ' | 102 prefix = 'Processing ' |
103 processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) | 103 processing = set(os.path.basename(x) for x in lines if x.startswith(prefix)) |
104 for line in lines: | 104 for line in lines: |
105 if not line.startswith(prefix) and line not in processing: | 105 if not line.startswith(prefix) and line not in processing: |
106 print line | 106 print line |
107 return popen.returncode | 107 return popen.returncode |
108 | 108 |
| 109 def ExecAsmWrapper(self, arch, *args): |
| 110 """Filter logo banner from invocations of asm.exe.""" |
| 111 env = self._GetEnv(arch) |
| 112 # MSVS doesn't assemble x64 asm files. |
| 113 if arch == 'environment.x64': |
| 114 return 0 |
| 115 popen = subprocess.Popen(args, shell=True, env=env, |
| 116 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 117 out, _ = popen.communicate() |
| 118 for line in out.splitlines(): |
| 119 if (not line.startswith('Copyright (C) Microsoft Corporation') and |
| 120 not line.startswith('Microsoft (R) Macro Assembler') and |
| 121 not line.startswith(' Assembling: ') and |
| 122 line): |
| 123 print line |
| 124 return popen.returncode |
| 125 |
109 def ExecRcWrapper(self, arch, *args): | 126 def ExecRcWrapper(self, arch, *args): |
110 """Filter logo banner from invocations of rc.exe. Older versions of RC | 127 """Filter logo banner from invocations of rc.exe. Older versions of RC |
111 don't support the /nologo flag.""" | 128 don't support the /nologo flag.""" |
112 env = self._GetEnv(arch) | 129 env = self._GetEnv(arch) |
113 popen = subprocess.Popen(args, shell=True, env=env, | 130 popen = subprocess.Popen(args, shell=True, env=env, |
114 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 131 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
115 out, _ = popen.communicate() | 132 out, _ = popen.communicate() |
116 for line in out.splitlines(): | 133 for line in out.splitlines(): |
117 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and | 134 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and |
118 not line.startswith('Copyright (C) Microsoft Corporation') and | 135 not line.startswith('Copyright (C) Microsoft Corporation') and |
(...skipping 16 matching lines...) Expand all Loading... |
135 for |arch|. If |dir| is supplied, use that as the working directory.""" | 152 for |arch|. If |dir| is supplied, use that as the working directory.""" |
136 env = self._GetEnv(arch) | 153 env = self._GetEnv(arch) |
137 args = open(rspfile).read() | 154 args = open(rspfile).read() |
138 dir = dir[0] if dir else None | 155 dir = dir[0] if dir else None |
139 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) | 156 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) |
140 popen.wait() | 157 popen.wait() |
141 return popen.returncode | 158 return popen.returncode |
142 | 159 |
143 if __name__ == '__main__': | 160 if __name__ == '__main__': |
144 sys.exit(main(sys.argv[1:])) | 161 sys.exit(main(sys.argv[1:])) |
OLD | NEW |