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

Side by Side Diff: tools/dart/update.py

Issue 932993003: Download the dart sdk into third_party/. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « DEPS ('k') | no next file » | 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/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 """Pulls down the current dart sdk to third_party/dart-sdk/."""
7
8 import os
9 import subprocess
10 import sys
11
12 # Path constants. (All of these should be absolute paths.)
13 THIS_DIR = os.path.abspath(os.path.dirname(__file__))
14 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
15 DART_SDK_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'dart-sdk')
16
17 # TODO(erg): We might want 32 bit linux too? I don't know of anyone who still
18 # uses that though. It looks like clang isn't built 32 bit.
19 LINUX_64_SDK = ('https://storage.googleapis.com/dart-archive/channels/' +
20 'stable/release/latest/sdk/dartsdk-linux-x64-release.zip')
zra 2015/02/17 23:06:06 Even though we'll only be using this for a short t
Elliot Glaysher 2015/02/17 23:08:58 That's probably a good idea. What URL would I use
21
22 OUTPUT_FILE = os.path.join(DART_SDK_DIR, 'dartsdk-linux-x64-release.zip')
23
24 def RunCommand(command, fail_hard=True):
25 """Run command and return success (True) or failure; or if fail_hard is
26 True, exit on failure."""
27
28 print 'Running %s' % (str(command))
29 if subprocess.call(' '.join(command), shell=True) == 0:
30 return True
31 print 'Failed.'
32 if fail_hard:
33 sys.exit(1)
34 return False
35
36 def main():
zra 2015/02/17 23:06:06 Would it be worthwhile to include an easy way to t
37 # For version one, we don't actually redownload if the sdk is already
38 # present. This will be replaced with download_from_google_storage once
39 # it supports tarballs.
40 if not os.path.exists(OUTPUT_FILE):
41 wget_command = ['wget', '-N', '-c', LINUX_64_SDK, '-P', DART_SDK_DIR]
42 if not RunCommand(wget_command, fail_hard=False):
43 print "Failed to get dart sdk from server."
44 return
45
46 unzip_command = ['unzip', OUTPUT_FILE, '-d', DART_SDK_DIR]
47 if not RunCommand(unzip_command, fail_hard=False):
48 print "Failed to unzip the dart sdk."
49
50 if __name__ == '__main__':
51 sys.exit(main())
OLDNEW
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698