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

Side by Side Diff: native_client_sdk/src/build_tools/sdk_tools/sdk_update.py

Issue 10910101: fix pylint warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Shim script for the SDK updater, to allow automatic updating. 6 """Shim script for the SDK updater, to allow automatic updating.
7 7
8 The purpose of this script is to be a shim which automatically updates 8 The purpose of this script is to be a shim which automatically updates
9 sdk_tools (the bundle containing the updater scripts) whenever this script is 9 sdk_tools (the bundle containing the updater scripts) whenever this script is
10 run. 10 run.
11 11
12 When the sdk_tools bundle has been updated to the most recent version, this 12 When the sdk_tools bundle has been updated to the most recent version, this
13 script forwards its arguments to sdk_updater_main.py. 13 script forwards its arguments to sdk_updater_main.py.
14 """ 14 """
15 15
16 import os 16 import os
17 import subprocess 17 import subprocess
18 from sdk_update_common import * 18 from sdk_update_common import RenameDir, RemoveDir, Error
19 import sys 19 import sys
20 import tempfile 20 import tempfile
21 21
22 22
23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
24 SDK_UPDATE_MAIN = os.path.join(SCRIPT_DIR, 'sdk_update_main.py') 24 SDK_UPDATE_MAIN = os.path.join(SCRIPT_DIR, 'sdk_update_main.py')
25 SDK_ROOT_DIR = os.path.dirname(SCRIPT_DIR) 25 SDK_ROOT_DIR = os.path.dirname(SCRIPT_DIR)
26 NACLSDK_SHELL_SCRIPT = os.path.join(SDK_ROOT_DIR, 'naclsdk') 26 NACLSDK_SHELL_SCRIPT = os.path.join(SDK_ROOT_DIR, 'naclsdk')
27 if sys.platform.startswith('win'): 27 if sys.platform.startswith('win'):
28 NACLSDK_SHELL_SCRIPT += '.bat' 28 NACLSDK_SHELL_SCRIPT += '.bat'
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 ' viewing or accessing this directory and try again.\n' % ( 76 ' viewing or accessing this directory and try again.\n' % (
77 SDK_TOOLS_DIR,)) 77 SDK_TOOLS_DIR,))
78 sys.exit(1) 78 sys.exit(1)
79 79
80 try: 80 try:
81 RenameDir(SDK_TOOLS_UPDATE_DIR, SDK_TOOLS_DIR) 81 RenameDir(SDK_TOOLS_UPDATE_DIR, SDK_TOOLS_DIR)
82 except Error: 82 except Error:
83 # Failed for some reason, move the old dir back. 83 # Failed for some reason, move the old dir back.
84 try: 84 try:
85 RenameDir(temp_sdktools, SDK_TOOLS_DIR) 85 RenameDir(temp_sdktools, SDK_TOOLS_DIR)
86 except: 86 except Error:
87 # Not much to do here. sdk_tools won't exist, but sdk_tools_update 87 # Not much to do here. sdk_tools won't exist, but sdk_tools_update
88 # should. Hopefully running the batch script again will move 88 # should. Hopefully running the batch script again will move
89 # sdk_tools_update -> sdk_tools and it will work this time... 89 # sdk_tools_update -> sdk_tools and it will work this time...
90 sys.stderr.write('Unable to restore directory "%s" while auto-updating.' 90 sys.stderr.write('Unable to restore directory "%s" while auto-updating.'
91 'Make sure no programs are viewing or accessing this directory and' 91 'Make sure no programs are viewing or accessing this directory and'
92 'try again.\n' % (SDK_TOOLS_DIR,)) 92 'try again.\n' % (SDK_TOOLS_DIR,))
93 sys.exit(1) 93 sys.exit(1)
94 finally: 94 finally:
95 RemoveDir(tempdir) 95 RemoveDir(tempdir)
96 96
97 97
98 def main(): 98 def main():
99 args = sys.argv[1:] 99 args = sys.argv[1:]
100 if UpdateSDKTools(args): 100 if UpdateSDKTools(args):
101 RenameSdkToolsDirectory() 101 RenameSdkToolsDirectory()
102 # Call the shell script, just in case this script was updated in the next 102 # Call the shell script, just in case this script was updated in the next
103 # version of sdk_tools 103 # version of sdk_tools
104 return subprocess.call([NACLSDK_SHELL_SCRIPT] + args) 104 return subprocess.call([NACLSDK_SHELL_SCRIPT] + args)
105 else: 105 else:
106 return subprocess.call(MakeSdkUpdateMainCmd(args)) 106 return subprocess.call(MakeSdkUpdateMainCmd(args))
107 107
108 108
109 if __name__ == '__main__': 109 if __name__ == '__main__':
110 sys.exit(main()) 110 sys.exit(main())
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/manifest_util.py ('k') | native_client_sdk/src/build_tools/sdk_tools/sdk_update_main.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698