aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-02-15 10:41:10 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-21 20:42:26 +0000
commitcdcadf7a29d3f15389f828ced2d98f2be9b0c460 (patch)
treeb78293af64135eb9125e9f2f8ff618dc8eac69a1 /bin
parent138bd155ed1d1c8696733b7060553f070f384678 (diff)
remove fetch-gn dependency on buildtools
This makes it possible to fetch GN without syncing DEPS. To roll GN now, just update the three hashes in bin/fetch-gn. buildtools is still a dependency of fetch-clang-format. Bug: skia:7634 Change-Id: Ida6b516cfb0b306da73550875ab1ff97c9da6a64 Reviewed-on: https://skia-review.googlesource.com/107882 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fetch-gn28
1 files changed, 15 insertions, 13 deletions
diff --git a/bin/fetch-gn b/bin/fetch-gn
index d5de7e4fd6..be2cb1acec 100755
--- a/bin/fetch-gn
+++ b/bin/fetch-gn
@@ -14,11 +14,11 @@ import urllib2
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
-gn_path = 'buildtools/linux64/gn' if 'linux' in sys.platform else \
- 'buildtools/mac/gn' if 'darwin' in sys.platform else \
- 'buildtools/win/gn.exe'
+dst = 'bin/gn.exe' if 'win32' in sys.platform else 'bin/gn'
-sha1 = open(gn_path + '.sha1').read().strip()
+sha1 = '113f5b30a7cfae72015600a119590d45d64c0d0d' if 'linux' in sys.platform else \
+ 'b33a6d33c2b2f42762f902672ffdf4837fa1c662' if 'darwin' in sys.platform else \
+ 'b1981c189f40c3ae42b965277ad1bc3449d26d2a' # Windows
def sha1_of_file(path):
h = hashlib.sha1()
@@ -27,15 +27,17 @@ def sha1_of_file(path):
h.update(f.read())
return h.hexdigest()
-if sha1_of_file(gn_path) != sha1:
- with open(gn_path, 'wb') as f:
+if sha1_of_file(dst) != sha1:
+ with open(dst, '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 )
-
-gn_copy_path = os.path.join('bin', os.path.basename(gn_path))
-if sha1_of_file(gn_copy_path) != sha1:
- shutil.copy(gn_path, gn_copy_path)
+ os.chmod(dst, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
+ stat.S_IRGRP | stat.S_IXGRP |
+ stat.S_IROTH | stat.S_IXOTH )
+# We'll also copy to a path that depot_tools' GN wrapper will expect to find the binary.
+copy_path = 'buildtools/linux64/gn' if 'linux' in sys.platform else \
+ 'buildtools/mac/gn' if 'darwin' in sys.platform else \
+ 'buildtools/win/gn.exe'
+if os.path.isdir(os.path.dirname(copy_path)):
+ shutil.copy(dst, copy_path)