• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
11
12import argparse
13import os
14import shutil
15import sys
16
17
18ENV_VAR = 'ANDROID_SDK_LINUX_SDK_ROOT'
19
20
21def getenv(key):
22  val = os.environ.get(key)
23  if not val:
24    print(('Environment variable %s not set; you should run this via '
25           'create_and_upload.py.' % key), file=sys.stderr)
26    sys.exit(1)
27  return val
28
29
30def create_asset(target_dir, android_sdk_root):
31  """Create the asset."""
32  dst = os.path.join(target_dir, 'android-sdk')
33  shutil.copytree(android_sdk_root, dst)
34
35
36def main():
37  parser = argparse.ArgumentParser()
38  parser.add_argument('--target_dir', '-t', required=True)
39  args = parser.parse_args()
40  android_sdk_root = getenv(ENV_VAR)
41  create_asset(args.target_dir, android_sdk_root)
42
43
44if __name__ == '__main__':
45  main()
46