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

Unified Diff: tools/android/download_android_tools.py

Issue 1574033002: Speed up download_android_tools.py by about a third. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/android/download_android_tools.py
diff --git a/tools/android/download_android_tools.py b/tools/android/download_android_tools.py
index 4b69214904bce68c548ead9d7e397f475b069f02..e8d2d2e44293e3edabee99b67863997a9767cd8d 100755
--- a/tools/android/download_android_tools.py
+++ b/tools/android/download_android_tools.py
@@ -9,6 +9,7 @@ them to INSTALL_DIR, updating INSTALL_DIR/VERSION_* stamp files with current
version. Does nothing if INSTALL_DIR/VERSION_* are already up to date.
"""
+import multiprocessing
import os
import shutil
import subprocess
@@ -84,17 +85,20 @@ def UpdateTools(tools_name):
print ('WARNING: Failed to download Android tools.')
return
- print "Extracting Android tools (" + tools_name + ")"
- with tarfile.open(archive_path) as arch:
- arch.extractall(INSTALL_DIR)
- os.remove(archive_path)
- # Write version as the last step.
- with open(os.path.join(INSTALL_DIR, version_stamp), 'w+') as f:
- f.write('%s\n' % version)
+ def Extract():
+ print "Extracting Android tools (" + tools_name + ")..."
+ with tarfile.open(archive_path) as arch:
+ arch.extractall(INSTALL_DIR)
+ os.remove(archive_path)
+ # Write version as the last step.
+ with open(os.path.join(INSTALL_DIR, version_stamp), 'w+') as f:
+ f.write('%s\n' % version)
+ print "Finished extracting Android tools (" + tools_name + ")"
+ multiprocessing.Process(target=Extract).start()
def main():
- UpdateTools('sdk')
UpdateTools('ndk')
+ UpdateTools('sdk')
if __name__ == '__main__':
sys.exit(main())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698