| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 popen = subprocess.Popen(args, shell=True, env=env, | 172 popen = subprocess.Popen(args, shell=True, env=env, |
| 173 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | 173 stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 174 out, _ = popen.communicate() | 174 out, _ = popen.communicate() |
| 175 for line in out.splitlines(): | 175 for line in out.splitlines(): |
| 176 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and | 176 if (not line.startswith('Microsoft (R) Windows (R) Resource Compiler') and |
| 177 not line.startswith('Copyright (C) Microsoft Corporation') and | 177 not line.startswith('Copyright (C) Microsoft Corporation') and |
| 178 line): | 178 line): |
| 179 print line | 179 print line |
| 180 return popen.returncode | 180 return popen.returncode |
| 181 | 181 |
| 182 def ExecClWrapper(self, arch, depname, *args): | |
| 183 """Runs cl.exe and filters output through ninja-deplist-helper to get | |
| 184 dependendency information which is stored in |depname|.""" | |
| 185 env = self._GetEnv(arch) | |
| 186 args = ' '.join(args) + \ | |
| 187 '| ninja-deplist-helper -r . -q -f cl -o ' + depname + '"' | |
| 188 popen = subprocess.Popen(args, shell=True, env=env) | |
| 189 popen.wait() | |
| 190 return popen.returncode | |
| 191 | |
| 192 def ExecActionWrapper(self, arch, rspfile, *dir): | 182 def ExecActionWrapper(self, arch, rspfile, *dir): |
| 193 """Runs an action command line from a response file using the environment | 183 """Runs an action command line from a response file using the environment |
| 194 for |arch|. If |dir| is supplied, use that as the working directory.""" | 184 for |arch|. If |dir| is supplied, use that as the working directory.""" |
| 195 env = self._GetEnv(arch) | 185 env = self._GetEnv(arch) |
| 196 args = open(rspfile).read() | 186 args = open(rspfile).read() |
| 197 dir = dir[0] if dir else None | 187 dir = dir[0] if dir else None |
| 198 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) | 188 popen = subprocess.Popen(args, shell=True, env=env, cwd=dir) |
| 199 popen.wait() | 189 popen.wait() |
| 200 return popen.returncode | 190 return popen.returncode |
| 201 | 191 |
| 202 if __name__ == '__main__': | 192 if __name__ == '__main__': |
| 203 sys.exit(main(sys.argv[1:])) | 193 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |