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

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

Issue 1311803002: Dart: Removes dartzip (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Readme fixes Created 5 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
« no previous file with comments | « mojo/public/tools/dart_package.py ('k') | mojo/tools/data/apptests » ('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 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import argparse
7 import os
8 import sys
9
10 CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
11 sys.path.insert(0, os.path.join(CURRENT_PATH, "pylib"))
12 import gs
13
14 PREBUILT_FILE_PATH = os.path.join(CURRENT_PATH, "prebuilt", "frameworks")
15
16 FILES_TO_DOWNLOAD = [
17 "apptest.dartzip",
18 ]
19
20 def download(tools_directory, version_file):
21 stamp_path = os.path.join(PREBUILT_FILE_PATH, "VERSION")
22
23 version_path = os.path.join(CURRENT_PATH, version_file)
24 with open(version_path) as version_file:
25 version = version_file.read().strip()
26
27 try:
28 with open(stamp_path) as stamp_file:
29 current_version = stamp_file.read().strip()
30 if current_version == version:
31 return 0 # Already have the right version.
32 except IOError:
33 pass # If the stamp file does not exist we need to download new binaries.
34
35 for file_name in FILES_TO_DOWNLOAD:
36 download_file(file_name, version, tools_directory)
37
38 with open(stamp_path, 'w') as stamp_file:
39 stamp_file.write(version)
40 return 0
41
42
43 def download_file(basename, version, tools_directory):
44 find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
45 sys.path.insert(0, find_depot_tools_path)
46 # pylint: disable=F0401
47 import find_depot_tools
48 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
49
50 gs_path = "gs://mojo/file/" + version + "/" + basename
51
52 output_file = os.path.join(PREBUILT_FILE_PATH, basename)
53 gs.download_from_public_bucket(gs_path, output_file,
54 depot_tools_path)
55
56
57 def main():
58 parser = argparse.ArgumentParser(description="Downloads bundled frameworks "
59 "binaries from google storage.")
60 parser.add_argument("--tools-directory",
61 dest="tools_directory",
62 metavar="<tools-directory>",
63 type=str,
64 required=True,
65 help="Path to the directory containing "
66 "find_depot_tools.py, specified as a relative path "
67 "from the location of this file.")
68 parser.add_argument("--version-file",
69 dest="version_file",
70 metavar="<version-file>",
71 type=str,
72 default="../VERSION",
73 help="Path to the file containing the version of the "
74 "shell to be fetched, specified as a relative path "
75 "from the location of this file (default: "
76 "%(default)s).")
77 args = parser.parse_args()
78 return download(args.tools_directory, args.version_file)
79
80
81 if __name__ == "__main__":
82 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/public/tools/dart_package.py ('k') | mojo/tools/data/apptests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698