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 common # pylint: disable=unused-import 14import os 15import subprocess 16import utils 17 18 19# Remember to also update the go_win asset when this is updated. 20GO_URL = "https://golang.org/dl/go1.16.3.linux-amd64.tar.gz" 21 22 23def create_asset(target_dir): 24 """Create the asset.""" 25 with utils.tmp_dir(): 26 cwd = os.getcwd() 27 zipfile = os.path.join(cwd, 'go.tar.gz') 28 subprocess.check_call(["wget", '-O', zipfile, GO_URL]) 29 subprocess.check_call(["tar", "-xzf", zipfile, "-C", target_dir]) 30 31def main(): 32 parser = argparse.ArgumentParser() 33 parser.add_argument('--target_dir', '-t', required=True) 34 args = parser.parse_args() 35 create_asset(args.target_dir) 36 37 38if __name__ == '__main__': 39 main() 40