1#!/usr/bin/env python 2# 3# Copyright 2017 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 11import common # fixes python import path 12import argparse 13import subprocess 14import sys 15import utils 16 17 18URL = 'https://github.com/bazelbuild/bazel/releases/download/4.0.0/bazel-4.0.0-installer-linux-x86_64.sh' 19INSTALLER_SCRIPT = URL.split('/')[-1] 20 21 22def create_asset(target_dir): 23 """Create the asset.""" 24 with utils.tmp_dir(): 25 subprocess.call(['wget', URL]) 26 subprocess.call(['sh', INSTALLER_SCRIPT, '--prefix=' + target_dir]) 27 28 29def main(): 30 if 'linux' not in sys.platform: 31 print >> sys.stderr, 'This script only runs on Linux.' 32 sys.exit(1) 33 parser = argparse.ArgumentParser() 34 parser.add_argument('--target_dir', '-t', required=True) 35 args = parser.parse_args() 36 create_asset(args.target_dir) 37 38 39if __name__ == '__main__': 40 main() 41