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 14import subprocess 15import sys 16import utils 17 18SDK_VERSION='1.1.97.0' 19SDK_URL=('https://sdk.lunarg.com/sdk/download/%s/linux/' 20 'vulkansdk-linux-x86_64-%s.tar.gz' % (SDK_VERSION, SDK_VERSION)) 21 22 23def create_asset(target_dir): 24 """Create the asset.""" 25 with utils.tmp_dir(): 26 tarball = 'vulkansdk-linux.tar.gz' 27 subprocess.check_call(['curl', SDK_URL, '--output', tarball]) 28 subprocess.check_call(['tar', '--extract', '--verbose', 29 '--file=%s' % tarball, '--gunzip', 30 '--directory=%s' % target_dir, 31 '--strip-components=2', 32 '%s/x86_64' % SDK_VERSION]) 33 34def main(): 35 if 'linux' not in sys.platform: 36 print >> sys.stderr, 'This script only runs on Linux.' 37 sys.exit(1) 38 parser = argparse.ArgumentParser() 39 parser.add_argument('--target_dir', '-t', required=True) 40 args = parser.parse_args() 41 create_asset(args.target_dir) 42 43 44if __name__ == '__main__': 45 main() 46