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 and upload it.""" 10 11 12import argparse 13import common 14import os 15import subprocess 16import sys 17import utils 18 19 20def main(): 21 if sys.platform != 'win32': 22 print >> sys.stderr, 'This script only runs on Windows.' 23 sys.exit(1) 24 parser = argparse.ArgumentParser() 25 parser.add_argument('--gsutil') 26 parser.add_argument('--sdk_path', '-s', required=True) 27 parser.add_argument('--runtime_path', '-r', 28 default=os.path.join("C:","System32","vulkan-1.dll"), 29 required=True) 30 args = parser.parse_args() 31 32 with utils.tmp_dir(): 33 cwd = os.getcwd() 34 create_script = os.path.join(common.FILE_DIR, 'create.py') 35 upload_script = os.path.join(common.FILE_DIR, 'upload.py') 36 37 try: 38 cwd = os.path.join(cwd, 'sdk') 39 cmd = ['python', create_script, 40 '-t', cwd, 41 '--sdk_path', args.sdk_path, 42 '--runtime_path', args.runtime_path] 43 subprocess.check_call(cmd) 44 cmd = ['python', upload_script, '-t', cwd] 45 if args.gsutil: 46 cmd.extend(['--gsutil', args.gsutil]) 47 subprocess.check_call(cmd) 48 except subprocess.CalledProcessError: 49 # Trap exceptions to avoid printing two stacktraces. 50 sys.exit(1) 51 52 53if __name__ == '__main__': 54 main() 55