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)) |