aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-01-12 13:20:38 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-12 19:54:50 +0000
commitb621a35b436bdbe62f6c558b448ca00449b4a319 (patch)
tree6d7c9c2c74cf5abdf3e73ec5eac01afd1e9228d3 /bin
parent3d97a0e2adbfa3a340031e501616c6c3ba0ff95a (diff)
drop depot_tools dependency in bin/fetch-gn
... and copy gn to bin/ when done to make it easy to find. Change-Id: I1ec405b4c45efb828626ff7d904a417f69b39cb2 Reviewed-on: https://skia-review.googlesource.com/6962 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetch-gn26
1 files changed, 13 insertions, 13 deletions
diff --git a/bin/fetch-gn b/bin/fetch-gn
index fc2c82a089..16e287513e 100755
--- a/bin/fetch-gn
+++ b/bin/fetch-gn
@@ -5,12 +5,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import subprocess
+import os
+import shutil
+import stat
import sys
-
-def quiet(*cmd):
- cmd = ' '.join(cmd).split()
- subprocess.check_output(cmd)
+import urllib2
def gn_path():
if 'linux' in sys.platform:
@@ -19,11 +18,12 @@ def gn_path():
return 'buildtools/mac/gn'
return 'buildtools/win/gn.exe'
-def download_tool():
- if 'linux' in sys.platform or 'darwin' in sys.platform:
- return 'download_from_google_storage'
- return 'download_from_google_storage.bat'
-
-quiet(download_tool(),
- '--no_resume --no_auth --bucket chromium-gn',
- '-s ', gn_path() + '.sha1')
+sha1 = open(gn_path() + '.sha1').read()
+
+with open(gn_path(), 'wb') as f:
+ f.write(urllib2.urlopen('https://chromium-gn.storage-download.googleapis.com/' + sha1).read())
+
+os.chmod(gn_path(), stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
+ stat.S_IRGRP | stat.S_IXGRP |
+ stat.S_IROTH | stat.S_IXOTH )
+shutil.copy(gn_path(), 'bin');