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