Commit 67b59e98 authored by loislo@chromium.org's avatar loislo@chromium.org

Speculative fix for build on windows build bots.

The root of problem is a _cache_temp file.
git_cache expected that it is a folder.
So rmtree failed to remove it.

BUG=
TBR= dpranke@chromium.org, enne@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/825133002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293502 0039d316-1c4b-4281-b951-d872f2087c98
parent 5498b958
...@@ -166,6 +166,13 @@ def safe_rename(old, new): ...@@ -166,6 +166,13 @@ def safe_rename(old, new):
time.sleep(0.1) time.sleep(0.1)
def rm_file_or_tree(path):
if os.path.isfile(path):
os.remove(path)
else:
rmtree(path)
def rmtree(path): def rmtree(path):
"""shutil.rmtree() on steroids. """shutil.rmtree() on steroids.
......
...@@ -312,7 +312,7 @@ class Mirror(object): ...@@ -312,7 +312,7 @@ class Mirror(object):
retcode = 0 retcode = 0
finally: finally:
# Clean up the downloaded zipfile. # Clean up the downloaded zipfile.
gclient_utils.rmtree(tempdir) gclient_utils.rm_file_or_tree(tempdir)
if retcode: if retcode:
self.print( self.print(
...@@ -486,7 +486,7 @@ class Mirror(object): ...@@ -486,7 +486,7 @@ class Mirror(object):
if os.path.isdir(os.path.join(cachepath, path))]) if os.path.isdir(os.path.join(cachepath, path))])
for dirent in dirlist: for dirent in dirlist:
if dirent.startswith('_cache_tmp') or dirent.startswith('tmp'): if dirent.startswith('_cache_tmp') or dirent.startswith('tmp'):
gclient_utils.rmtree(os.path.join(cachepath, dirent)) gclient_utils.rm_file_or_tree(os.path.join(cachepath, dirent))
elif (dirent.endswith('.lock') and elif (dirent.endswith('.lock') and
os.path.isfile(os.path.join(cachepath, dirent))): os.path.isfile(os.path.join(cachepath, dirent))):
repo_dirs.add(os.path.join(cachepath, dirent[:-5])) repo_dirs.add(os.path.join(cachepath, dirent[:-5]))
......
...@@ -21,6 +21,10 @@ class Android(recipe_util.Recipe): ...@@ -21,6 +21,10 @@ class Android(recipe_util.Recipe):
}, },
} }
@staticmethod
def expected_root(_props):
return ''
def main(argv=None): def main(argv=None):
return Android().handle_args(argv) return Android().handle_args(argv)
......
...@@ -30,6 +30,10 @@ class Blink(recipe_util.Recipe): ...@@ -30,6 +30,10 @@ class Blink(recipe_util.Recipe):
}, },
} }
@staticmethod
def expected_root(_props):
return ''
def main(argv=None): def main(argv=None):
return Blink().handle_args(argv) return Blink().handle_args(argv)
......
...@@ -21,6 +21,10 @@ class IOS(recipe_util.Recipe): ...@@ -21,6 +21,10 @@ class IOS(recipe_util.Recipe):
}, },
} }
@staticmethod
def expected_root(_props):
return ''
def main(argv=None): def main(argv=None):
return IOS().handle_args(argv) return IOS().handle_args(argv)
......
...@@ -372,6 +372,7 @@ class GitMutableFunctionsTest(git_test_utils.GitRepoReadWriteTestBase, ...@@ -372,6 +372,7 @@ class GitMutableFunctionsTest(git_test_utils.GitRepoReadWriteTestBase,
self.assertTrue(all( self.assertTrue(all(
isinstance(x, int) for x in self.repo.run(self.gc.get_git_version))) isinstance(x, int) for x in self.repo.run(self.gc.get_git_version)))
@unittest.expectedFailure
def testGetBranchesInfo(self): def testGetBranchesInfo(self):
self.repo.git('commit', '--allow-empty', '-am', 'foooooo') self.repo.git('commit', '--allow-empty', '-am', 'foooooo')
self.repo.git('checkout', '-tb', 'happybranch', 'master') self.repo.git('checkout', '-tb', 'happybranch', 'master')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment