• 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
15
16
17def create_asset(target_dir, android_sdk_root):
18  """Create the asset."""
19  if not android_sdk_root:
20    android_sdk_root = (os.environ.get('ANDROID_HOME') or
21                        os.environ.get('ANDROID_SDK_ROOT'))
22  if not android_sdk_root:
23    raise Exception('No --android_sdk_root provided and no ANDROID_HOME or '
24                    'ANDROID_SDK_ROOT environment variables.')
25
26  dst = os.path.join(target_dir, 'android-sdk')
27  shutil.copytree(android_sdk_root, dst)
28
29
30def main():
31  parser = argparse.ArgumentParser()
32  parser.add_argument('--android_sdk_root')
33  parser.add_argument('--target_dir', '-t', required=True)
34  args = parser.parse_args()
35  create_asset(args.target_dir, args.android_sdk_root)
36
37
38if __name__ == '__main__':
39  main()
40