OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 | 8 |
9 import datetime | 9 import datetime |
10 import errno | 10 import errno |
11 import os | 11 import os |
12 import shutil | 12 import shutil |
13 import sys | 13 import sys |
14 import subprocess | 14 import subprocess |
15 import tempfile | 15 import tempfile |
16 import time | 16 import time |
17 import uuid | 17 import uuid |
18 | 18 |
19 | 19 |
20 GCLIENT = 'gclient.bat' if sys.platform == 'win32' else 'gclient' | 20 GCLIENT = 'gclient.bat' if sys.platform == 'win32' else 'gclient' |
21 GIT = 'git.bat' if sys.platform == 'win32' else 'git' | 21 GIT = 'git.bat' if sys.platform == 'win32' else 'git' |
| 22 WHICH = 'where' if sys.platform == 'win32' else 'which' |
22 | 23 |
23 | 24 |
24 class print_timings(object): | 25 class print_timings(object): |
25 def __init__(self): | 26 def __init__(self): |
26 self._start = None | 27 self._start = None |
27 | 28 |
28 def __enter__(self): | 29 def __enter__(self): |
29 self._start = datetime.datetime.utcnow() | 30 self._start = datetime.datetime.utcnow() |
30 print 'Task started at %s GMT' % str(self._start) | 31 print 'Task started at %s GMT' % str(self._start) |
31 | 32 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 # For POSIX: making the directory writable guarantees removability. | 192 # For POSIX: making the directory writable guarantees removability. |
192 # Windows will ignore the non-read-only bits in the chmod value. | 193 # Windows will ignore the non-read-only bits in the chmod value. |
193 os.chmod(root, 0770) | 194 os.chmod(root, 0770) |
194 for name in files: | 195 for name in files: |
195 remove_with_retry(os.remove, os.path.join(root, name)) | 196 remove_with_retry(os.remove, os.path.join(root, name)) |
196 for name in dirs: | 197 for name in dirs: |
197 remove_with_retry(lambda p: shutil.rmtree(p, onerror=RmTreeOnError), | 198 remove_with_retry(lambda p: shutil.rmtree(p, onerror=RmTreeOnError), |
198 os.path.join(root, name)) | 199 os.path.join(root, name)) |
199 | 200 |
200 remove_with_retry(os.rmdir, file_path) | 201 remove_with_retry(os.rmdir, file_path) |
OLD | NEW |