blob: 16e287513eb4acfb9bbac68dabcb77a1b9d01649 [file] [log] [blame]
mtklein6af0c952016-07-22 03:34:25 -07001#!/usr/bin/env python
2
3# Copyright 2016 Google Inc.
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
Mike Kleinb621a352017-01-12 13:20:38 -05008import os
9import shutil
10import stat
mtklein6af0c952016-07-22 03:34:25 -070011import sys
Mike Kleinb621a352017-01-12 13:20:38 -050012import urllib2
mtklein6af0c952016-07-22 03:34:25 -070013
14def gn_path():
15 if 'linux' in sys.platform:
16 return 'buildtools/linux64/gn'
17 if 'darwin' in sys.platform:
18 return 'buildtools/mac/gn'
19 return 'buildtools/win/gn.exe'
20
Mike Kleinb621a352017-01-12 13:20:38 -050021sha1 = open(gn_path() + '.sha1').read()
22
23with open(gn_path(), 'wb') as f:
24 f.write(urllib2.urlopen('https://chromium-gn.storage-download.googleapis.com/' + sha1).read())
25
26os.chmod(gn_path(), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
27 stat.S_IRGRP | stat.S_IXGRP |
28 stat.S_IROTH | stat.S_IXOTH )
29shutil.copy(gn_path(), 'bin');