| Index: sky/sdk/lib/download_material_design_icons
|
| diff --git a/sky/sdk/lib/download_material_design_icons b/sky/sdk/lib/download_material_design_icons
|
| index aad130216dd644d75e5e823962b5e8a26d93f503..02ecfba3be57f6a2e7a0c3db036797019959bf1e 100755
|
| --- a/sky/sdk/lib/download_material_design_icons
|
| +++ b/sky/sdk/lib/download_material_design_icons
|
| @@ -4,6 +4,7 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| +import shutil
|
| import subprocess
|
| import sys
|
| import urllib2
|
| @@ -11,15 +12,24 @@ import urllib2
|
| def main():
|
| sky_lib_dir = os.path.dirname(os.path.abspath(__file__))
|
| assets_dir = os.path.join(sky_lib_dir, 'assets')
|
| + icons_dir = os.path.join(assets_dir, 'material-design-icons')
|
| + existing_sha1_path = os.path.join(icons_dir, 'material-design-icons.sha1')
|
|
|
| - if (os.path.isdir(os.path.join(assets_dir, 'material-design-icons'))):
|
| - return
|
| + existing_sha1 = None
|
| + if os.path.isfile(existing_sha1_path):
|
| + with open(existing_sha1_path, 'r') as f:
|
| + existing_sha1 = f.read()
|
|
|
| sha1_path = os.path.join(assets_dir, 'material-design-icons.sha1')
|
|
|
| with open(sha1_path, 'r') as f:
|
| sha1 = f.read()
|
|
|
| + if existing_sha1 == sha1:
|
| + return
|
| +
|
| + print "Downloading missing material design icons"
|
| +
|
| tgz_path = os.path.join(assets_dir, 'material-design-icons.tgz')
|
| url = 'https://storage.googleapis.com/mojo/material-design-icons/%s' % sha1
|
| response = urllib2.urlopen(url)
|
| @@ -27,11 +37,17 @@ def main():
|
| with open(tgz_path, 'wb') as f:
|
| f.write(response.read())
|
|
|
| + shutil.rmtree(icons_dir)
|
| +
|
| output_path = os.path.join(assets_dir, tgz_path)
|
| subprocess.call([
|
| 'tar', '-xzf', output_path, '-C', assets_dir
|
| ])
|
|
|
| + subprocess.call([
|
| + 'cp', sha1_path, icons_dir
|
| + ])
|
| +
|
| os.unlink(tgz_path)
|
|
|
| if __name__ == '__main__':
|
|
|