| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """ Set of basic operations/utilities that are used by the build. """ | 5 """ Set of basic operations/utilities that are used by the build. """ |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 import errno | 8 import errno |
| 9 import fnmatch | 9 import fnmatch |
| 10 import math | 10 import math |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 """ | 231 """ |
| 232 file_path = os.path.join(*path) | 232 file_path = os.path.join(*path) |
| 233 if not os.path.exists(file_path): | 233 if not os.path.exists(file_path): |
| 234 return | 234 return |
| 235 | 235 |
| 236 def RemoveWithRetry_win(rmfunc, path): | 236 def RemoveWithRetry_win(rmfunc, path): |
| 237 os.chmod(path, stat.S_IWRITE) | 237 os.chmod(path, stat.S_IWRITE) |
| 238 if win32_api_avail: | 238 if win32_api_avail: |
| 239 win32api.SetFileAttributes(path, win32con.FILE_ATTRIBUTE_NORMAL) | 239 win32api.SetFileAttributes(path, win32con.FILE_ATTRIBUTE_NORMAL) |
| 240 try: | 240 try: |
| 241 return rmfunc(path) | 241 if os.path.islink(path): |
| 242 return os.remove(path) |
| 243 else: |
| 244 return rmfunc(path) |
| 242 except EnvironmentError, e: | 245 except EnvironmentError, e: |
| 243 if e.errno != errno.EACCES: | 246 if e.errno != errno.EACCES: |
| 244 raise | 247 raise |
| 245 print 'Failed to delete %s: trying again' % repr(path) | 248 print 'Failed to delete %s: trying again' % repr(path) |
| 246 time.sleep(0.1) | 249 time.sleep(0.1) |
| 247 return rmfunc(path) | 250 return rmfunc(path) |
| 248 | 251 |
| 249 def RemoveWithRetry_non_win(rmfunc, path): | 252 def RemoveWithRetry_non_win(rmfunc, path): |
| 250 if os.path.islink(path): | 253 if os.path.islink(path): |
| 251 return os.remove(path) | 254 return os.remove(path) |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 LogAndRemoveFiles('/dev/shm', kLogRegex) | 753 LogAndRemoveFiles('/dev/shm', kLogRegex) |
| 751 elif IsMac(): | 754 elif IsMac(): |
| 752 nstempdir_path = '/usr/local/libexec/nstempdir' | 755 nstempdir_path = '/usr/local/libexec/nstempdir' |
| 753 if os.path.exists(nstempdir_path): | 756 if os.path.exists(nstempdir_path): |
| 754 ns_temp_dir = GetCommandOutput([nstempdir_path]).strip() | 757 ns_temp_dir = GetCommandOutput([nstempdir_path]).strip() |
| 755 if ns_temp_dir: | 758 if ns_temp_dir: |
| 756 LogAndRemoveFiles(ns_temp_dir, kLogRegex) | 759 LogAndRemoveFiles(ns_temp_dir, kLogRegex) |
| 757 else: | 760 else: |
| 758 raise NotImplementedError( | 761 raise NotImplementedError( |
| 759 'Platform "%s" is not currently supported.' % sys.platform) | 762 'Platform "%s" is not currently supported.' % sys.platform) |
| OLD | NEW |