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 """ |
11 | 11 |
12 import os | 12 import os |
13 import shutil | 13 import shutil |
14 import subprocess | |
14 import sys | 15 import sys |
15 | 16 |
16 | 17 |
17 def main(args): | 18 def main(args): |
18 executor = WinTool() | 19 executor = WinTool() |
19 exit_code = executor.Dispatch(args) | 20 exit_code = executor.Dispatch(args) |
20 if exit_code is not None: | 21 if exit_code is not None: |
21 sys.exit(exit_code) | 22 sys.exit(exit_code) |
22 | 23 |
23 | 24 |
(...skipping 18 matching lines...) Expand all Loading... | |
42 if os.path.exists(dest): | 43 if os.path.exists(dest): |
43 if os.path.isdir(dest): | 44 if os.path.isdir(dest): |
44 shutil.rmtree(dest) | 45 shutil.rmtree(dest) |
45 else: | 46 else: |
46 os.unlink(dest) | 47 os.unlink(dest) |
47 if os.path.isdir(source): | 48 if os.path.isdir(source): |
48 shutil.copytree(source, dest) | 49 shutil.copytree(source, dest) |
49 else: | 50 else: |
50 shutil.copy2(source, dest) | 51 shutil.copy2(source, dest) |
51 | 52 |
53 def ExecLinkWrapper(self, *args): | |
54 """Filter diagnostic output from link that looks like: | |
55 ' Creating library ui.dll.lib and object ui.dll.exp' | |
56 This happens when there are exports from the dll or exe. | |
57 """ | |
58 popen = subprocess.Popen(args, | |
59 stdout=subprocess.PIPE, | |
60 stderr=subprocess.STDOUT) | |
61 out, _ = popen.communicate() | |
62 for line in out.splitlines(): | |
Nico
2012/04/03 23:13:12
You can just iterate over popen.stdout, which will
| |
63 if not line.startswith(' Creating library '): | |
64 sys.stdout.write(line) | |
65 return popen.returncode | |
52 | 66 |
53 if __name__ == '__main__': | 67 if __name__ == '__main__': |
54 sys.exit(main(sys.argv[1:])) | 68 sys.exit(main(sys.argv[1:])) |
OLD | NEW |