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 glob 14import os.path 15import shutil 16import subprocess 17 18 19NDK_VER = "android-ndk-r21d" 20NDK_URL = \ 21 "https://dl.google.com/android/repository/%s-darwin-x86_64.zip" % NDK_VER 22 23 24def create_asset(target_dir): 25 """Create the asset.""" 26 subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"]) 27 subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir]) 28 for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")): 29 shutil.move(f, target_dir) 30 subprocess.check_call(["rm", "ndk.zip"]) 31 32 33def main(): 34 parser = argparse.ArgumentParser() 35 parser.add_argument('--target_dir', '-t', required=True) 36 args = parser.parse_args() 37 create_asset(args.target_dir) 38 39 40if __name__ == '__main__': 41 main() 42