OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import subprocess | 7 import subprocess |
8 import urllib2 | 8 import urllib2 |
9 | 9 |
10 sky_lib_dir = os.path.dirname(os.path.abspath(__file__)) | 10 sky_lib_dir = os.path.dirname(os.path.abspath(__file__)) |
11 assets_dir = os.path.join(sky_lib_dir, 'assets') | 11 assets_dir = os.path.join(sky_lib_dir, 'assets') |
12 sha1_path = os.path.join(assets_dir, 'material-design-icons.sha1') | 12 sha1_path = os.path.join(assets_dir, 'material-design-icons.sha1') |
13 | 13 |
14 with open(sha1_path, 'r') as f: | 14 with open(sha1_path, 'r') as f: |
15 sha1 = f.read() | 15 sha1 = f.read() |
16 | 16 |
17 tgz_path = os.path.join(assets_dir, 'material-design-icons.tgz') | 17 tgz_path = os.path.join(assets_dir, 'material-design-icons.tgz') |
18 url = 'https://storage.googleapis.com/mojo/material-design-icons/%s' % sha1 | 18 url = 'https://storage.googleapis.com/mojo/material-design-icons/%s' % sha1 |
19 response = urllib2.urlopen(url) | 19 response = urllib2.urlopen(url) |
20 | 20 |
21 with open(tgz_path, 'wb') as f: | 21 with open(tgz_path, 'wb') as f: |
22 f.write(response.read()) | 22 f.write(response.read()) |
23 | 23 |
24 output_path = os.path.join(assets_dir, tgz_path) | 24 output_path = os.path.join(assets_dir, tgz_path) |
25 subprocess.call([ | 25 subprocess.call([ |
26 'tar', '-xzf', output_path, '-C', assets_dir | 26 'tar', '-xzf', output_path, '-C', assets_dir |
27 ]) | 27 ]) |
28 | 28 |
29 os.unlink(tgz_path) | 29 os.unlink(tgz_path) |
OLD | NEW |