Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import copy | 10 import copy |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 return solutions | 292 return solutions |
| 293 | 293 |
| 294 | 294 |
| 295 def remove(target): | 295 def remove(target): |
| 296 """Remove a target by moving it into build.dead.""" | 296 """Remove a target by moving it into build.dead.""" |
| 297 dead_folder = path.join(BUILDER_DIR, 'build.dead') | 297 dead_folder = path.join(BUILDER_DIR, 'build.dead') |
| 298 if not path.exists(dead_folder): | 298 if not path.exists(dead_folder): |
| 299 os.makedirs(dead_folder) | 299 os.makedirs(dead_folder) |
| 300 dest = path.join(dead_folder, uuid.uuid4().hex) | 300 dest = path.join(dead_folder, uuid.uuid4().hex) |
| 301 print 'Marking for removal %s => %s' % (target, dest) | 301 print 'Marking for removal %s => %s' % (target, dest) |
| 302 os.rename(target, dest) | 302 try: |
| 303 os.rename(target, dest) | |
| 304 except Exception as e: | |
| 305 print 'Error renaming %s to %s: %s' % (target, dest, str(e)) | |
|
ddoman1
2016/10/25 21:33:08
This would eat the exception and the execution flo
agable
2016/10/28 16:48:40
You're absolutely right that we should be using th
katthomas
2016/10/28 18:41:13
My bad on the raise. Done now.
| |
| 303 | 306 |
| 304 | 307 |
| 305 def ensure_no_checkout(dir_names): | 308 def ensure_no_checkout(dir_names): |
| 306 """Ensure that there is no undesired checkout under build/.""" | 309 """Ensure that there is no undesired checkout under build/.""" |
| 307 build_dir = os.getcwd() | 310 build_dir = os.getcwd() |
| 308 has_checkout = any(path.exists(path.join(build_dir, dir_name, '.git')) | 311 has_checkout = any(path.exists(path.join(build_dir, dir_name, '.git')) |
| 309 for dir_name in dir_names) | 312 for dir_name in dir_names) |
| 310 if has_checkout: | 313 if has_checkout: |
| 311 for filename in os.listdir(build_dir): | 314 for filename in os.listdir(build_dir): |
| 312 deletion_target = path.join(build_dir, filename) | 315 deletion_target = path.join(build_dir, filename) |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1096 # download patch failure is still an infra problem. | 1099 # download patch failure is still an infra problem. |
| 1097 if e.code == 3: | 1100 if e.code == 3: |
| 1098 # Patch download problem. | 1101 # Patch download problem. |
| 1099 return 87 | 1102 return 87 |
| 1100 # Genuine patch problem. | 1103 # Genuine patch problem. |
| 1101 return 88 | 1104 return 88 |
| 1102 | 1105 |
| 1103 | 1106 |
| 1104 if __name__ == '__main__': | 1107 if __name__ == '__main__': |
| 1105 sys.exit(main()) | 1108 sys.exit(main()) |
| OLD | NEW |