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

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

Issue 2882073003: Update testing tools (AppRTC, Go) to new versions (Closed)
Patch Set: Move readme 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 golang SDK from WebRTC storage and unpacks it.
11
12 Requires that depot_tools is installed and in the PATH.
13
14 The precondition is that a directory 'golang' lives in the same directory
15 as the script.
16 This 'golang' directory has the following structure:
17
18 /golang
19 |
20 |-----/linux/go.tar.gz.sha1
21 |-----/win/go.zip.sha1
22 |-----/mac/go.tar.gz.sha1
23 """
24
25 import os
26 import sys
27
28 import utils
29
30
31 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
32
33
34 def _GetGoArchivePathForPlatform():
35 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
36 return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension)
37
38
39 def main(argv):
40 if len(argv) == 1:
41 return 'Usage: %s <output_dir>' % argv[0]
42
43 output_dir = os.path.join(argv[1])
44 golang_path = os.path.join(SCRIPT_DIR, 'golang')
45 archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
46 old_archive_sha1 = utils.ComputeSHA1(archive_path)
47
48 utils.DownloadFilesFromGoogleStorage(golang_path)
49
50 if (old_archive_sha1 != utils.ComputeSHA1(archive_path)
51 or not os.path.exists('go')):
52 utils.RemoveDirectory(os.path.join(output_dir, 'go'))
53 utils.UnpackArchiveTo(archive_path, output_dir)
54
55
56 if __name__ == '__main__':
57 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698