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

Side by Side Diff: mojo/public/tools/download_shell_binary.py

Issue 667853002: Add gclient hook to download prebuilt mojo_shell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « mojo/public/tools/BUILD.gn ('k') | mojo/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import os
4 import subprocess
5 import sys
6 import tempfile
7 import zipfile
8
9 if not sys.platform.startswith("linux"):
10 print "Not supported for your platform"
11 sys.exit(0)
12
13 current_path = os.path.dirname(os.path.realpath(__file__))
14 version_path = os.path.join(current_path, "../VERSION")
15 with open(version_path) as version_file:
16 version = version_file.read().strip()
17
18 prebuilt_file_path = os.path.join(current_path, "prebuilt")
19 stamp_path = os.path.join(prebuilt_file_path, "VERSION")
20
21 try:
22 with open(stamp_path) as stamp_file:
23 current_version = stamp_file.read().strip()
24 if current_version == version:
25 sys.exit(0)
26 except IOError:
27 pass
28
29 platform = "linux-x64" # TODO: configurate
30 basename = platform + ".zip"
31
32 gs_path = "gs://mojo/shell/" + version + "/" + basename
33
34 with tempfile.NamedTemporaryFile() as temp_zip_file:
35 subprocess.check_call(["gsutil", "cp", gs_path, temp_zip_file.name])
jamesr 2014/10/20 22:49:03 this should use the gsutil binary in depot_tools -
36 with zipfile.ZipFile(temp_zip_file.name) as z:
37 zi = z.getinfo("mojo_shell")
38 mode = zi.external_attr >> 16L
39 z.extract(zi, prebuilt_file_path)
40 os.chmod(os.path.join(prebuilt_file_path, "mojo_shell"), mode)
41
42 with open(stamp_path, 'w') as stamp_file:
43 stamp_file.write(version + "\n")
OLDNEW
« no previous file with comments | « mojo/public/tools/BUILD.gn ('k') | mojo/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698