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 12 import argparse 13 import os 14 import shutil 15 16 17 def 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 30 def 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 38 if __name__ == '__main__': 39 main() 40