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

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

Issue 11228013: [NaCl SDK] Refactor sdk_update*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows again Created 8 years, 1 month 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.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 """Run sdk_update_main to update sdk_tools bundle. Return True if it is 45 """Run sdk_update_main to update sdk_tools bundle. Return True if it is
46 updated. 46 updated.
47 47
48 Args: 48 Args:
49 args: The arguments to pass to sdk_update_main.py. We need to keep this to 49 args: The arguments to pass to sdk_update_main.py. We need to keep this to
50 ensure sdk_update_main is called correctly; some parameters specify 50 ensure sdk_update_main is called correctly; some parameters specify
51 URLS or directories to use. 51 URLS or directories to use.
52 Returns: 52 Returns:
53 True if the sdk_tools bundle was updated. 53 True if the sdk_tools bundle was updated.
54 """ 54 """
55 cmd = MakeSdkUpdateMainCmd(['--update-sdk-tools'] + args) 55 cmd = MakeSdkUpdateMainCmd(args + ['--update-sdk-tools'])
56 process = subprocess.Popen(cmd, stdout=subprocess.PIPE) 56 process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
57 stdout, _ = process.communicate() 57 stdout, _ = process.communicate()
58 if process.returncode == 0: 58 if process.returncode == 0:
59 return stdout.find('sdk_tools is already up-to-date.') == -1 59 return stdout.find('sdk_tools is already up-to-date.') == -1
60 else: 60 else:
61 # Updating sdk_tools could fail for any number of reasons. Regardless, it 61 # Updating sdk_tools could fail for any number of reasons. Regardless, it
62 # should be safe to try to run the user's command. 62 # should be safe to try to run the user's command.
63 return False 63 return False
64 64
65 65
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698