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