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

Side by Side Diff: webrtc/tools/testing/download_apprtc_appengine_and_mercurial.py

Issue 2861653005: Moving scripts to download and build apprtc/collider. (Closed)
Patch Set: removing download_node.py (it seems unused) Created 3 years, 7 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 #
4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree.
9
10 """Downloads the appengine SDK from WebRTC storage and unpacks it.
11
12 Requires that depot_tools is installed and in the PATH. This script expects
13 to run with Chrome's base dir as the working directory, e.g. where the .gclient
14 file is. This is what should happen if this script is invoked as a hook action.
15 """
16
17 import glob
18 import os
19 import sys
20 import subprocess
21
22 import utils
23
24 def _DownloadResources(webrtc_deps_path):
25 print 'Downloading files in %s...' % webrtc_deps_path
26
27 extension = 'bat' if 'win32' in sys.platform else 'py'
28 cmd = ['download_from_google_storage.%s' % extension,
29 '--bucket=chromium-webrtc-resources',
30 '--directory', webrtc_deps_path]
31 subprocess.check_call(cmd)
32
33
34 def _StripVersionNumberFromMercurialFolder():
35 unpacked_name = glob.glob('mercurial*')
36 assert len(unpacked_name) == 1, 'Should have precisely one mercurial!'
37 os.rename(unpacked_name[0], 'mercurial')
38
39
40 def main(argv):
41 if len(argv) == 1:
42 return 'Usage: %s <path to webrtc.DEPS>' % argv[0]
43
44 webrtc_deps_path = os.path.join(argv[1], 'src', 'webrtc', 'tools', 'testing')
45 appengine_zip_path = os.path.join(webrtc_deps_path, 'google-appengine.zip')
46 old_appengine_sha1 = utils.ComputeSHA1(appengine_zip_path)
47
48 mercurial_tar_path = os.path.join(webrtc_deps_path, 'mercurial-src.tar.gz')
49 old_mercurial_sha1 = utils.ComputeSHA1(mercurial_tar_path)
50
51 apprtc_zip_path = os.path.join(webrtc_deps_path, 'prebuilt_apprtc.zip')
52 old_apprtc_sha1 = utils.ComputeSHA1(apprtc_zip_path)
53
54 _DownloadResources(webrtc_deps_path)
55
56 if old_appengine_sha1 != utils.ComputeSHA1(appengine_zip_path):
57 utils.DeleteDirNextToGclient('google_appengine')
58 utils.UnpackToWorkingDir(appengine_zip_path)
59
60 if old_mercurial_sha1 != utils.ComputeSHA1(mercurial_tar_path):
61 utils.DeleteDirNextToGclient('mercurial')
62 utils.UnpackToWorkingDir(mercurial_tar_path)
63 _StripVersionNumberFromMercurialFolder()
64
65 if old_apprtc_sha1 != utils.ComputeSHA1(apprtc_zip_path):
66 utils.DeleteDirNextToGclient('apprtc')
67 utils.UnpackToWorkingDir(apprtc_zip_path)
68
69 if __name__ == '__main__':
70 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698