OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 import optparse | 6 import optparse |
7 import os.path | 7 import os.path |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import stat | 10 import stat |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 Does not mask failures, although it does retry a few times on Windows. | 352 Does not mask failures, although it does retry a few times on Windows. |
353 """ | 353 """ |
354 Retry(_RemoveDirectory, path) | 354 Retry(_RemoveDirectory, path) |
355 | 355 |
356 | 356 |
357 def RemovePath(path): | 357 def RemovePath(path): |
358 """Remove a path, file or directory.""" | 358 """Remove a path, file or directory.""" |
359 if os.path.isdir(path): | 359 if os.path.isdir(path): |
360 RemoveDirectory(path) | 360 RemoveDirectory(path) |
361 else: | 361 else: |
362 os.chmod(path, stat.S_IWUSR) | 362 if os.path.isfile(path) and not os.access(path, os.W_OK): |
| 363 os.chmod(path, stat.S_IWUSR) |
363 os.remove(path) | 364 os.remove(path) |
364 | 365 |
365 | 366 |
366 # This is a sanity check so Command can print out better error information. | 367 # This is a sanity check so Command can print out better error information. |
367 def FileCanBeFound(name, paths): | 368 def FileCanBeFound(name, paths): |
368 # CWD | 369 # CWD |
369 if os.path.exists(name): | 370 if os.path.exists(name): |
370 return True | 371 return True |
371 # Paths with directories are not resolved using the PATH variable. | 372 # Paths with directories are not resolved using the PATH variable. |
372 if os.path.dirname(name): | 373 if os.path.dirname(name): |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 # Otherwise these go back to the preamble. | 679 # Otherwise these go back to the preamble. |
679 with Step('summary', status): | 680 with Step('summary', status): |
680 if status.ever_failed: | 681 if status.ever_failed: |
681 print 'There were failed stages.' | 682 print 'There were failed stages.' |
682 else: | 683 else: |
683 print 'Success.' | 684 print 'Success.' |
684 # Display a summary of the build. | 685 # Display a summary of the build. |
685 status.DisplayBuildStatus() | 686 status.DisplayBuildStatus() |
686 | 687 |
687 sys.exit(status.ReturnValue()) | 688 sys.exit(status.ReturnValue()) |
OLD | NEW |