| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 | 8 |
| 9 """Create the asset.""" | 9 """Create the asset.""" |
| 10 | 10 |
| 11 | 11 |
| 12 import argparse | 12 import argparse |
| 13 import glob | 13 import glob |
| 14 import os.path | 14 import os.path |
| 15 import shutil | 15 import shutil |
| 16 import subprocess | 16 import subprocess |
| 17 | 17 |
| 18 NDK_VER = "android-ndk-r12b" | 18 NDK_VER = "android-ndk-r12b" |
| 19 NDK_URL = \ | 19 NDK_URL = \ |
| 20 "https://dl.google.com/android/repository/%s-linux-x86_64.zip" % NDK_VER | 20 "https://dl.google.com/android/repository/%s-darwin-x86_64.zip" % NDK_VER |
| 21 | 21 |
| 22 def create_asset(target_dir): | 22 def create_asset(target_dir): |
| 23 """Create the asset.""" | 23 """Create the asset.""" |
| 24 subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"]) | 24 subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"]) |
| 25 subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir]) | 25 subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir]) |
| 26 for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")): | 26 for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")): |
| 27 shutil.move(f, target_dir) | 27 shutil.move(f, target_dir) |
| 28 subprocess.check_call(["rm", "ndk.zip"]) | 28 subprocess.check_call(["rm", "ndk.zip"]) |
| 29 | 29 |
| 30 | 30 |
| 31 def main(): | 31 def main(): |
| 32 parser = argparse.ArgumentParser() | 32 parser = argparse.ArgumentParser() |
| 33 parser.add_argument('--target_dir', '-t', required=True) | 33 parser.add_argument('--target_dir', '-t', required=True) |
| 34 args = parser.parse_args() | 34 args = parser.parse_args() |
| 35 create_asset(args.target_dir) | 35 create_asset(args.target_dir) |
| 36 | 36 |
| 37 | 37 |
| 38 if __name__ == '__main__': | 38 if __name__ == '__main__': |
| 39 main() | 39 main() |
| OLD | NEW |