• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create the asset."""
10
11
12import argparse
13import subprocess
14
15
16# Remember to also update the go_win asset when this is updated.
17GO_URL = "https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz"
18
19
20def create_asset(target_dir):
21  """Create the asset."""
22  p1 = subprocess.Popen(["curl", GO_URL], stdout=subprocess.PIPE)
23  p2 = subprocess.Popen(["tar", "-C", target_dir, "-xzf" "-"], stdin=p1.stdout)
24  p1.stdout.close()  # Allow p1 to receive a SIGPIPE if p2 exits.
25  _,_ = p2.communicate()
26
27
28def main():
29  parser = argparse.ArgumentParser()
30  parser.add_argument('--target_dir', '-t', required=True)
31  args = parser.parse_args()
32  create_asset(args.target_dir)
33
34
35if __name__ == '__main__':
36  main()
37