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

Unified Diff: native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py

Issue 10868089: add PRESUBMIT for native_client_sdk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py
diff --git a/native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py b/native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py
index 7cf0a880f342772a37c79e3e88f63ed982e56d69..99d4c626131f10ed811c542fdaee52f4650724bf 100644
--- a/native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py
+++ b/native_client_sdk/src/build_tools/sdk_tools/sdk_update_common.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+"""Utility functions for sdk_update.py and sdk_update_main.py."""
+
import errno
import os
import shutil
@@ -9,8 +11,6 @@ import subprocess
import sys
import time
-"""Utility functions for sdk_update.py and sdk_update_main.py."""
-
class Error(Exception):
"""Generic error/exception for sdk_update module"""
@@ -36,7 +36,7 @@ def RemoveDir(outdir):
try:
shutil.rmtree(outdir)
- except:
+ except OSError:
if not os.path.exists(outdir):
return
# On Windows this could be an issue with junctions, so try again with rmdir
@@ -49,6 +49,7 @@ def RenameDir(srcdir, destdir):
rename if it already exists."""
max_tries = 5
+ num_tries = 0
for num_tries in xrange(max_tries):
try:
RemoveDir(destdir)
@@ -61,8 +62,9 @@ def RenameDir(srcdir, destdir):
# handling a Windows flaky access error. Sleep one second and try
# again.
time.sleep(num_tries + 1)
+
# end of while loop -- could not RenameDir
- raise Error('Could not RenameDir %s => %s after %d tries.\n' %
+ raise Error('Could not RenameDir %s => %s after %d tries.\n'
'Please check that no shells or applications '
'are accessing files in %s.'
% (srcdir, destdir, num_tries, destdir))

Powered by Google App Engine
This is Rietveld 408576698