Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: gclient_utils.py

Issue 825133002: Speculative fix for build on windows build bots. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: expected_root Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | git_cache.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Generic utils.""" 5 """Generic utils."""
6 6
7 import codecs 7 import codecs
8 import cStringIO 8 import cStringIO
9 import datetime 9 import datetime
10 import logging 10 import logging
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 break 159 break
160 except OSError: 160 except OSError:
161 if i == (retries - 1): 161 if i == (retries - 1):
162 # Give up. 162 # Give up.
163 raise 163 raise
164 # retry 164 # retry
165 logging.debug("Renaming failed from %s to %s. Retrying ..." % (old, new)) 165 logging.debug("Renaming failed from %s to %s. Retrying ..." % (old, new))
166 time.sleep(0.1) 166 time.sleep(0.1)
167 167
168 168
169 def rm_file_or_tree(path):
170 if os.path.isfile(path):
171 os.remove(path)
172 else:
173 rmtree(path)
174
175
169 def rmtree(path): 176 def rmtree(path):
170 """shutil.rmtree() on steroids. 177 """shutil.rmtree() on steroids.
171 178
172 Recursively removes a directory, even if it's marked read-only. 179 Recursively removes a directory, even if it's marked read-only.
173 180
174 shutil.rmtree() doesn't work on Windows if any of the files or directories 181 shutil.rmtree() doesn't work on Windows if any of the files or directories
175 are read-only, which svn repositories and some .svn files are. We need to 182 are read-only, which svn repositories and some .svn files are. We need to
176 be able to force the files to be writable (i.e., deletable) as we traverse 183 be able to force the files to be writable (i.e., deletable) as we traverse
177 the tree. 184 the tree.
178 185
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 def DefaultIndexPackConfig(url=''): 1166 def DefaultIndexPackConfig(url=''):
1160 """Return reasonable default values for configuring git-index-pack. 1167 """Return reasonable default values for configuring git-index-pack.
1161 1168
1162 Experiments suggest that higher values for pack.threads don't improve 1169 Experiments suggest that higher values for pack.threads don't improve
1163 performance.""" 1170 performance."""
1164 cache_limit = DefaultDeltaBaseCacheLimit() 1171 cache_limit = DefaultDeltaBaseCacheLimit()
1165 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit] 1172 result = ['-c', 'core.deltaBaseCacheLimit=%s' % cache_limit]
1166 if url in THREADED_INDEX_PACK_BLACKLIST: 1173 if url in THREADED_INDEX_PACK_BLACKLIST:
1167 result.extend(['-c', 'pack.threads=1']) 1174 result.extend(['-c', 'pack.threads=1'])
1168 return result 1175 return result
OLDNEW
« no previous file with comments | « no previous file | git_cache.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698