Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(746)

Side by Side Diff: download_node.py

Issue 872423002: Adding support for AppRTC closure compiling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webrtc/webrtc.DEPS/
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
kjellander_chromium 2015/01/27 09:32:57 2015
phoglund_chromium 2015/01/27 09:49:38 Done.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Downloads the node binaries from WebRTC storage and unpacks it.
7
8 Requires that depot_tools is installed and in the PATH. This script expects
9 to run with Chrome's base dir as the working directory, e.g. where the .gclient
10 file is. This is what should happen if this script is invoked as a hook action.
11 """
12
13 import glob
14 import os
15 import sys
16 import tarfile
17 import zipfile
18
19 import utils
20
21
22 def _GetNodeArchivePathForPlatform():
23 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
24 return os.path.join(utils.GetPlatform(), 'node.%s' % archive_extension)
25
26
27 def _StripVersionNumberFromNodeDir():
28 # The node dir will be called node-x-x-x.tar.gz, rename to just node.
29 unpacked_name = glob.glob('node*')
30 assert len(unpacked_name) == 1, 'Should have precisely one node!'
31 os.rename(unpacked_name[0], 'node')
32
33
34 def main(argv):
35 if len(argv) == 1:
36 return 'Usage: %s <path to webrtc.DEPS>' % argv[0]
37 if not os.path.exists('.gclient'):
38 return 'Invoked from wrong dir; invoke from dir with .gclient'
39
40 webrtc_deps_path = argv[1]
kjellander_chromium 2015/01/27 09:32:56 A lot of this is duplicated in download_golang.py.
phoglund_chromium 2015/01/27 09:49:38 Yes, I feel a lot of the duplication is incidental
41 node_path = os.path.join(webrtc_deps_path, 'node')
42 archive_path = os.path.join(node_path, _GetNodeArchivePathForPlatform())
43 old_archive_sha1 = utils.ComputeSHA1(archive_path)
44
45 utils.DownloadFilesFromGoogleStorage(node_path)
46
47 if (old_archive_sha1 != utils.ComputeSHA1(archive_path)
48 or not os.path.exists('node')):
kjellander_chromium 2015/01/27 09:32:57 Do you need to check for non-existing node dir her
phoglund_chromium 2015/01/27 09:49:38 Ah, I should do this in download_golang too. The p
49 utils.DeleteDirNextToGclient('node')
50 utils.UnpackToWorkingDir(archive_path)
51 _StripVersionNumberFromNodeDir()
52
53
54 if __name__ == '__main__':
55 sys.exit(main(sys.argv))
OLDNEW
« build_apprtc_closure.py ('K') | « download_golang.py ('k') | node/linux/node.tar.gz.sha1 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698