Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: infra/bots/assets/android_ndk_linux/create.py

Issue 2275093003: add an asset for the Linux Android NDK. (Closed)
Patch Set: v4 strips the top layer Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
14 import os.path
15 import shutil
13 import subprocess 16 import subprocess
14 17
15 GO_URL = "https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz" 18 NDK_VER = "android-ndk-r12b"
19 NDK_URL = \
20 "https://dl.google.com/android/repository/%s-linux-x86_64.zip" % NDK_VER
16 21
17 def create_asset(target_dir): 22 def create_asset(target_dir):
18 """Create the asset.""" 23 """Create the asset."""
19 p1 = subprocess.Popen(["curl", GO_URL], stdout=subprocess.PIPE) 24 subprocess.check_call(["curl", NDK_URL, "-o", "ndk.zip"])
20 p2 = subprocess.Popen(["tar", "-C", target_dir, "-xzf" "-"], stdin=p1.stdout) 25 subprocess.check_call(["unzip", "ndk.zip", "-d", target_dir])
21 p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. 26 for f in glob.glob(os.path.join(target_dir, NDK_VER, "*")):
22 _,_ = p2.communicate() 27 shutil.move(f, target_dir)
borenet 2016/08/26 17:08:15 Why not just create a temporary dir, download and
28 subprocess.check_call(["rm", "ndk.zip"])
23 29
24 30
25 def main(): 31 def main():
26 parser = argparse.ArgumentParser() 32 parser = argparse.ArgumentParser()
27 parser.add_argument('--target_dir', '-t', required=True) 33 parser.add_argument('--target_dir', '-t', required=True)
28 args = parser.parse_args() 34 args = parser.parse_args()
29 create_asset(args.target_dir) 35 create_asset(args.target_dir)
30 36
31 37
32 if __name__ == '__main__': 38 if __name__ == '__main__':
33 main() 39 main()
OLDNEW
« no previous file with comments | « infra/bots/assets/android_ndk_linux/common.py ('k') | infra/bots/assets/android_ndk_linux/create_and_upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698