| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Utility functions for Windows builds. | 5 """Utility functions for Windows builds. |
| 6 | 6 |
| 7 This file is copied to the build directory as part of toolchain setup and | 7 This file is copied to the build directory as part of toolchain setup and |
| 8 is used to set up calls to tools used by the build that need wrappers. | 8 is used to set up calls to tools used by the build that need wrappers. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 # and msvs_emulation for details). We convert to a dict here. | 78 # and msvs_emulation for details). We convert to a dict here. |
| 79 # Drop last 2 NULs, one for list terminator, one for trailing vs. separator. | 79 # Drop last 2 NULs, one for list terminator, one for trailing vs. separator. |
| 80 pairs = open(arch).read()[:-2].split('\0') | 80 pairs = open(arch).read()[:-2].split('\0') |
| 81 kvs = [item.split('=', 1) for item in pairs] | 81 kvs = [item.split('=', 1) for item in pairs] |
| 82 return dict(kvs) | 82 return dict(kvs) |
| 83 | 83 |
| 84 def ExecStamp(self, path): | 84 def ExecStamp(self, path): |
| 85 """Simple stamp command.""" | 85 """Simple stamp command.""" |
| 86 open(path, 'w').close() | 86 open(path, 'w').close() |
| 87 | 87 |
| 88 def ExecDeleteFile(self, path): |
| 89 """Simple file delete command.""" |
| 90 if os.path.exists(path): |
| 91 os.unlink(path) |
| 92 |
| 88 def ExecRecursiveMirror(self, source, dest): | 93 def ExecRecursiveMirror(self, source, dest): |
| 89 """Emulation of rm -rf out && cp -af in out.""" | 94 """Emulation of rm -rf out && cp -af in out.""" |
| 90 if os.path.exists(dest): | 95 if os.path.exists(dest): |
| 91 if os.path.isdir(dest): | 96 if os.path.isdir(dest): |
| 92 def _on_error(fn, path, dummy_excinfo): | 97 def _on_error(fn, path, dummy_excinfo): |
| 93 # The operation failed, possibly because the file is set to | 98 # The operation failed, possibly because the file is set to |
| 94 # read-only. If that's why, make it writable and try the op again. | 99 # read-only. If that's why, make it writable and try the op again. |
| 95 if not os.access(path, os.W_OK): | 100 if not os.access(path, os.W_OK): |
| 96 os.chmod(path, stat.S_IWRITE) | 101 os.chmod(path, stat.S_IWRITE) |
| 97 fn(path) | 102 fn(path) |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 project_dir = os.path.relpath(project_dir, BASE_DIR) | 320 project_dir = os.path.relpath(project_dir, BASE_DIR) |
| 316 selected_files = selected_files.split(';') | 321 selected_files = selected_files.split(';') |
| 317 ninja_targets = [os.path.join(project_dir, filename) + '^^' | 322 ninja_targets = [os.path.join(project_dir, filename) + '^^' |
| 318 for filename in selected_files] | 323 for filename in selected_files] |
| 319 cmd = ['ninja.exe'] | 324 cmd = ['ninja.exe'] |
| 320 cmd.extend(ninja_targets) | 325 cmd.extend(ninja_targets) |
| 321 return subprocess.call(cmd, shell=True, cwd=BASE_DIR) | 326 return subprocess.call(cmd, shell=True, cwd=BASE_DIR) |
| 322 | 327 |
| 323 if __name__ == '__main__': | 328 if __name__ == '__main__': |
| 324 sys.exit(main(sys.argv[1:])) | 329 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |