You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. """Downloads prebuilt AppRTC and Go from WebRTC storage and unpacks it.
  10. Requires that depot_tools is installed and in the PATH.
  11. It downloads compressed files in the directory where the script lives.
  12. This is because the precondition is that the script lives in the same
  13. directory of the .sha1 files.
  14. """
  15. import os
  16. import sys
  17. import utils
  18. SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
  19. def _GetGoArchivePathForPlatform():
  20. archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
  21. return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension)
  22. def main(argv):
  23. if len(argv) > 2:
  24. return 'Usage: %s [output_dir]' % argv[0]
  25. output_dir = os.path.abspath(argv[1]) if len(argv) > 1 else None
  26. apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip')
  27. if os.path.isfile(apprtc_zip_path + '.sha1'):
  28. utils.DownloadFilesFromGoogleStorage(SCRIPT_DIR, auto_platform=False)
  29. if output_dir is not None:
  30. utils.RemoveDirectory(os.path.join(output_dir, 'apprtc'))
  31. utils.UnpackArchiveTo(apprtc_zip_path, output_dir)
  32. golang_path = os.path.join(SCRIPT_DIR, 'golang')
  33. golang_zip_path = os.path.join(golang_path, _GetGoArchivePathForPlatform())
  34. if os.path.isfile(golang_zip_path + '.sha1'):
  35. utils.DownloadFilesFromGoogleStorage(golang_path)
  36. if output_dir is not None:
  37. utils.RemoveDirectory(os.path.join(output_dir, 'go'))
  38. utils.UnpackArchiveTo(golang_zip_path, output_dir)
  39. if __name__ == '__main__':
  40. sys.exit(main(sys.argv))