Adding apprtc and downloading of google appengine sdk to webrtc.DEPS.
R=kjellander@chromium.org
BUG=303021
Review URL: https://codereview.chromium.org/25857002
git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/webrtc/webrtc.DEPS@227910 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/DEPS b/DEPS
index 0407c58..dad9bf6 100644
--- a/DEPS
+++ b/DEPS
@@ -7,6 +7,11 @@
"googlecode_url": "http://%s.googlecode.com/svn",
}
+deps = {
+ "src/third_party/webrtc_apprtc":
+ "https://webrtc.googlecode.com/svn/trunk/samples/js",
+}
+
deps_os = {
"android": {
"src/data":
@@ -17,3 +22,12 @@
"http://gflags.googlecode.com/svn/trunk/src@84",
},
}
+
+hooks = [
+ {
+ "pattern": ".",
+ "action" : ["python",
+ "webrtc.DEPS/download_appengine_sdk.py",
+ "webrtc.DEPS"],
+ },
+]
diff --git a/download_appengine_sdk.py b/download_appengine_sdk.py
new file mode 100755
index 0000000..d4e3b78
--- /dev/null
+++ b/download_appengine_sdk.py
@@ -0,0 +1,77 @@
+#!/usr/bin/python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Downloads the appengine SDK from WebRTC storage and unpacks it.
+
+Requires that depot_tools is installed and in the PATH. This script expects
+to run with Chrome's base dir as the working directory, e.g. where the .gclient
+file is. This is what should happen if this script is invoked as a hook action.
+"""
+
+import hashlib
+import os
+import shutil
+import sys
+import subprocess
+import zipfile
+
+
+def _DownloadAppEngineZipFile(webrtc_deps_path):
+ print 'Downloading files in %s...' % webrtc_deps_path
+
+ extension = 'bat' if 'win32' in sys.platform else 'py'
+ cmd = ['download_from_google_storage.%s' % extension,
+ '--bucket=chromium-webrtc-resources',
+ '--directory', webrtc_deps_path]
+ subprocess.check_call(cmd)
+
+
+def _ComputeSHA1(path):
+ if not os.path.exists(path):
+ return 0
+
+ sha1 = hashlib.sha1()
+ file_to_hash = open(path, 'rb')
+ try:
+ sha1.update(file_to_hash.read())
+ finally:
+ file_to_hash.close()
+
+ return sha1.hexdigest()
+
+
+# This is necessary since Windows won't allow us to unzip onto an existing dir.
+def _DeleteOldAppEngineDir():
+ app_engine_dir = 'google_appengine'
+ print 'Deleting %s in %s...' % (app_engine_dir, os.getcwd())
+ shutil.rmtree(app_engine_dir, ignore_errors=True)
+
+
+def _Unzip(path):
+ print 'Unzipping %s in %s...' % (path, os.getcwd())
+ zip_file = zipfile.ZipFile(path)
+ try:
+ zip_file.extractall()
+ finally:
+ zip_file.close()
+
+
+def main(argv):
+ if len(argv) == 1:
+ return 'Usage: %s <path to webrtc.DEPS>' % argv[0]
+
+ webrtc_deps_path = argv[1]
+ zip_path = os.path.join(webrtc_deps_path, 'google-appengine.zip')
+ old_zip_sha1 = _ComputeSHA1(zip_path)
+
+ _DownloadAppEngineZipFile(webrtc_deps_path)
+
+ if old_zip_sha1 != _ComputeSHA1(zip_path):
+ _DeleteOldAppEngineDir()
+ _Unzip(zip_path)
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/google-appengine.zip.sha1 b/google-appengine.zip.sha1
new file mode 100644
index 0000000..cf13e4c
--- /dev/null
+++ b/google-appengine.zip.sha1
@@ -0,0 +1 @@
+827468f89c78f292c28ceac50e6109c8d649fa61