From 2a7fd5355d1e7323ac56970a8a4b09be0aced86e Mon Sep 17 00:00:00 2001 From: "henrike@webrtc.org" Date: Thu, 27 Jun 2013 18:36:28 +0000 Subject: [PATCH] Moves tools/update.py to trunk/webrtc/tools and updates it so that it no longer pulls any information from the DEPS file. BUG=N/A R=andrew@webrtc.org, kjellander@google.com, kjellander@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1730004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@4277 4adac7df-926f-26a2-2b94-8c16560cd09d --- DEPS | 6 +---- {tools/resources => webrtc/tools}/update.py | 30 +++------------------ 2 files changed, 4 insertions(+), 32 deletions(-) rename {tools/resources => webrtc/tools}/update.py (84%) diff --git a/DEPS b/DEPS index af3fcf1fb2..0aa8d434ac 100644 --- a/DEPS +++ b/DEPS @@ -12,10 +12,6 @@ vars = { "chromium_trunk" : "http://src.chromium.org/svn/trunk", "chromium_revision": "203806", - # External resources like video and audio files used for testing purposes. - # Downloaded on demand when needed. - "webrtc_resources_revision": "16", - # A small subset of WebKit is needed for the Android Python test framework. "webkit_trunk": "http://src.chromium.org/blink/trunk", } @@ -162,7 +158,7 @@ hooks = [ # If a newer version or no current download exists, it will download # the resources and extract them. "pattern": ".", - "action": ["python", Var("root_dir") + "/tools/resources/update.py"], + "action": ["python", Var("root_dir") + "/webrtc/tools/update.py"], }, { # A change to a .gyp, .gypi, or to GYP itself should run the generator. diff --git a/tools/resources/update.py b/webrtc/tools/update.py similarity index 84% rename from tools/resources/update.py rename to webrtc/tools/update.py index f202d0746f..a1ac085c23 100755 --- a/tools/resources/update.py +++ b/webrtc/tools/update.py @@ -7,8 +7,6 @@ # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. -__author__ = 'kjellander@webrtc.org (Henrik Kjellander)' - """Downloads WebRTC resources files from a remote host.""" from optparse import OptionParser @@ -20,7 +18,7 @@ import tarfile import tempfile import urllib2 -DEPS_KEY = 'webrtc_resources_revision' +DESIRED_VERSION = 16 REMOTE_URL_BASE = 'http://commondatastorage.googleapis.com/webrtc-resources' VERSION_FILENAME = 'webrtc-resources-version' FILENAME_PREFIX = 'webrtc-resources-' @@ -44,7 +42,6 @@ def main(): return project_root_dir = os.path.normpath(sys.path[0] + '/../../') - deps_file = os.path.join(project_root_dir, 'DEPS') downloads_dir = os.path.join(project_root_dir, 'resources') current_version_file = os.path.join(downloads_dir, VERSION_FILENAME) @@ -63,10 +60,9 @@ def main(): # Download archive if forced or DEPS version is different than our current. current_version = _get_current_version(current_version_file) - desired_version = _get_desired_version(deps_file) - if desired_version != current_version or options.force: + if DESIRED_VERSION != current_version or options.force: base_url = options.base_url or REMOTE_URL_BASE - _perform_download(base_url, desired_version, downloads_dir) + _perform_download(base_url, DESIRED_VERSION, downloads_dir) else: print 'Already have correct version: %s' % current_version @@ -89,26 +85,6 @@ def _get_current_version(current_version_file): return current_version -def _get_desired_version(deps_file): - """Evaluates the project's DEPS and returns the desired resources version. - - Args: - deps_file: Full path to the DEPS file of the project. - Returns: - The desired resources version. - """ - # Evaluate the DEPS file as Python code to extract the variables defined. - locals_dict = {'Var': lambda name: locals_dict['vars'][name], - 'File': lambda name: name, - 'From': lambda deps, definition: deps} - execfile(deps_file, {}, locals_dict) - deps_vars = locals_dict['vars'] - - desired_version = int(deps_vars[DEPS_KEY]) - print 'Version in DEPS file: %d' % desired_version - return desired_version - - def _perform_download(base_url, desired_version, downloads_dir): """Performs the download and extracts the downloaded resources.