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

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: Use dev url. 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
20 LINUX_64_SDK = ('http://gsdview.appspot.com/dart-archive/channels/dev/' +
21 'raw/43808/sdk/dartsdk-linux-x64-release.zip')
22
23 OUTPUT_FILE = os.path.join(DART_SDK_DIR, 'dartsdk-linux-x64-release.zip')
24
25 def RunCommand(command, fail_hard=True):
26 """Run command and return success (True) or failure; or if fail_hard is
27 True, exit on failure."""
28
29 print 'Running %s' % (str(command))
30 if subprocess.call(command, shell=False) == 0:
31 return True
32 print 'Failed.'
33 if fail_hard:
34 sys.exit(1)
35 return False
36
37 def main():
38 # For version one, we don't actually redownload if the sdk is already
39 # present. This will be replaced with download_from_google_storage once
40 # it supports tarballs.
41 #
42 # You can explicitly redownload this by blowing away your
43 # third_party/dart-sdk/ directory.
44 if not os.path.exists(OUTPUT_FILE):
45 wget_command = ['wget', '-N', '-c', LINUX_64_SDK, '-P', DART_SDK_DIR]
46 if not RunCommand(wget_command, fail_hard=False):
47 print "Failed to get dart sdk from server."
48 return
49
50 unzip_command = ['unzip', '-q', OUTPUT_FILE, '-d', DART_SDK_DIR]
51 if not RunCommand(unzip_command, fail_hard=False):
52 print "Failed to unzip the dart sdk."
53
54 if __name__ == '__main__':
55 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