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
This commit is contained in:
parent
83cebb25d7
commit
2a7fd5355d
6
DEPS
6
DEPS
@ -12,10 +12,6 @@ vars = {
|
|||||||
"chromium_trunk" : "http://src.chromium.org/svn/trunk",
|
"chromium_trunk" : "http://src.chromium.org/svn/trunk",
|
||||||
"chromium_revision": "203806",
|
"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.
|
# A small subset of WebKit is needed for the Android Python test framework.
|
||||||
"webkit_trunk": "http://src.chromium.org/blink/trunk",
|
"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
|
# If a newer version or no current download exists, it will download
|
||||||
# the resources and extract them.
|
# the resources and extract them.
|
||||||
"pattern": ".",
|
"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.
|
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
# in the file PATENTS. All contributing project authors may
|
# in the file PATENTS. All contributing project authors may
|
||||||
# be found in the AUTHORS file in the root of the source tree.
|
# 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."""
|
"""Downloads WebRTC resources files from a remote host."""
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
@ -20,7 +18,7 @@ import tarfile
|
|||||||
import tempfile
|
import tempfile
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
DEPS_KEY = 'webrtc_resources_revision'
|
DESIRED_VERSION = 16
|
||||||
REMOTE_URL_BASE = 'http://commondatastorage.googleapis.com/webrtc-resources'
|
REMOTE_URL_BASE = 'http://commondatastorage.googleapis.com/webrtc-resources'
|
||||||
VERSION_FILENAME = 'webrtc-resources-version'
|
VERSION_FILENAME = 'webrtc-resources-version'
|
||||||
FILENAME_PREFIX = 'webrtc-resources-'
|
FILENAME_PREFIX = 'webrtc-resources-'
|
||||||
@ -44,7 +42,6 @@ def main():
|
|||||||
return
|
return
|
||||||
|
|
||||||
project_root_dir = os.path.normpath(sys.path[0] + '/../../')
|
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')
|
downloads_dir = os.path.join(project_root_dir, 'resources')
|
||||||
current_version_file = os.path.join(downloads_dir, VERSION_FILENAME)
|
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.
|
# Download archive if forced or DEPS version is different than our current.
|
||||||
current_version = _get_current_version(current_version_file)
|
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
|
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:
|
else:
|
||||||
print 'Already have correct version: %s' % current_version
|
print 'Already have correct version: %s' % current_version
|
||||||
|
|
||||||
@ -89,26 +85,6 @@ def _get_current_version(current_version_file):
|
|||||||
return current_version
|
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):
|
def _perform_download(base_url, desired_version, downloads_dir):
|
||||||
"""Performs the download and extracts the downloaded resources.
|
"""Performs the download and extracts the downloaded resources.
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user