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

Side by Side Diff: download_golang.py

Issue 872423002: Adding support for AppRTC closure compiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webrtc/webrtc.DEPS/
Patch Set: Created 5 years, 10 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
« no previous file with comments | « copy_apprtc.py ('k') | download_node.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 """Downloads the golang SDK from WebRTC storage and unpacks it. 6 """Downloads the golang SDK from WebRTC storage and unpacks it.
7 7
8 Requires that depot_tools is installed and in the PATH. This script expects 8 Requires that depot_tools is installed and in the PATH. This script expects
9 to run with Chrome's base dir as the working directory, e.g. where the .gclient 9 to run with Chrome's base dir as the working directory, e.g. where the .gclient
10 file is. This is what should happen if this script is invoked as a hook action. 10 file is. This is what should happen if this script is invoked as a hook action.
11 """ 11 """
12 12
13 import os 13 import os
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 import tarfile 16 import tarfile
17 import zipfile 17 import zipfile
18 18
19 import utils 19 import utils
20 20
21 21
22 def _DownloadFilesFromGoogleStorage(webrtc_deps_path):
23 print 'Downloading files in %s...' % webrtc_deps_path
24
25 extension = 'bat' if 'win32' in sys.platform else 'py'
26 cmd = ['download_from_google_storage.%s' % extension,
27 '--bucket=chromium-webrtc-resources',
28 '--auto_platform',
29 '--recursive',
30 '--directory', webrtc_deps_path]
31 subprocess.check_call(cmd)
32
33
34 def _GetGoArchivePathForPlatform(): 22 def _GetGoArchivePathForPlatform():
35 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz' 23 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
36 return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension) 24 return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension)
37 25
38 26
39 def main(argv): 27 def main(argv):
40 if len(argv) == 1: 28 if len(argv) == 1:
41 return 'Usage: %s <path to webrtc.DEPS>' % argv[0] 29 return 'Usage: %s <path to webrtc.DEPS>' % argv[0]
42 if not os.path.exists('.gclient'): 30 if not os.path.exists('.gclient'):
43 return 'Invoked from wrong dir; invoke from dir with .gclient' 31 return 'Invoked from wrong dir; invoke from dir with .gclient'
44 32
45 webrtc_deps_path = argv[1] 33 webrtc_deps_path = argv[1]
46 golang_path = os.path.join(webrtc_deps_path, 'golang') 34 golang_path = os.path.join(webrtc_deps_path, 'golang')
47 archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform()) 35 archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
48 old_archive_sha1 = utils.ComputeSHA1(archive_path) 36 old_archive_sha1 = utils.ComputeSHA1(archive_path)
49 37
50 _DownloadFilesFromGoogleStorage(golang_path) 38 utils.DownloadFilesFromGoogleStorage(golang_path)
51 39
52 if old_archive_sha1 != utils.ComputeSHA1(archive_path): 40 if (old_archive_sha1 != utils.ComputeSHA1(archive_path)
41 or not os.path.exists('go')):
53 utils.DeleteDirNextToGclient('go') 42 utils.DeleteDirNextToGclient('go')
54 utils.UnpackToWorkingDir(archive_path) 43 utils.UnpackToWorkingDir(archive_path)
55 44
56 45
57 if __name__ == '__main__': 46 if __name__ == '__main__':
58 sys.exit(main(sys.argv)) 47 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « copy_apprtc.py ('k') | download_node.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698