OLD | NEW |
(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. 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 os |
| 18 import sys |
| 19 |
| 20 import utils |
| 21 |
| 22 |
| 23 def _GetGoArchivePathForPlatform(): |
| 24 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz' |
| 25 return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension) |
| 26 |
| 27 |
| 28 def main(argv): |
| 29 if len(argv) == 1: |
| 30 return 'Usage: %s <path to webrtc.DEPS>' % argv[0] |
| 31 if not os.path.exists('.gclient'): |
| 32 return 'Invoked from wrong dir; invoke from dir with .gclient' |
| 33 |
| 34 webrtc_deps_path = os.path.join(argv[1], 'src', 'webrtc', 'tools', 'testing') |
| 35 golang_path = os.path.join(webrtc_deps_path, 'golang') |
| 36 archive_path = os.path.join(golang_path, _GetGoArchivePathForPlatform()) |
| 37 old_archive_sha1 = utils.ComputeSHA1(archive_path) |
| 38 |
| 39 utils.DownloadFilesFromGoogleStorage(golang_path) |
| 40 |
| 41 if (old_archive_sha1 != utils.ComputeSHA1(archive_path) |
| 42 or not os.path.exists('go')): |
| 43 utils.DeleteDirNextToGclient('go') |
| 44 utils.UnpackToWorkingDir(archive_path) |
| 45 |
| 46 |
| 47 if __name__ == '__main__': |
| 48 sys.exit(main(sys.argv)) |
OLD | NEW |