| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Bootstrap Chrome Telemetry by downloading all its files from SVN servers. | 5 """Bootstrap Chrome Telemetry by downloading all its files from SVN servers. |
| 6 | 6 |
| 7 Requires a DEPS file to specify which directories on which SVN servers | 7 Requires a DEPS file to specify which directories on which SVN servers |
| 8 are required to run Telemetry. Format of that DEPS file is a subset of the | 8 are required to run Telemetry. Format of that DEPS file is a subset of the |
| 9 normal DEPS file format[1]; currently only only the "deps" dictionary is | 9 normal DEPS file format[1]; currently only only the "deps" dictionary is |
| 10 supported and nothing else. | 10 supported and nothing else. |
| 11 | 11 |
| 12 Fetches all files in the specified directories using WebDAV (SVN is WebDAV under | 12 Fetches all files in the specified directories using WebDAV (SVN is WebDAV under |
| 13 the hood). | 13 the hood). |
| 14 | 14 |
| 15 [1] http://dev.chromium.org/developers/how-tos/depottools#TOC-DEPS-file | 15 [1] http://dev.chromium.org/developers/how-tos/depottools#TOC-DEPS-file |
| 16 """ | 16 """ |
| 17 | 17 |
| 18 import imp | 18 import imp |
| 19 import logging | 19 import logging |
| 20 import os | 20 import os |
| 21 import urllib | 21 import urllib |
| 22 import urlparse | 22 import urlparse |
| 23 | 23 |
| 24 # Dummy module for DAVclient. | 24 # Dummy module for DAVclient. |
| 25 davclient = None | 25 davclient = None |
| 26 | 26 |
| 27 | 27 |
| 28 # TODO(eakuefner): Switch this link to tools/perf version after verifying. |
| 28 # Link to file containing the 'davclient' WebDAV client library. | 29 # Link to file containing the 'davclient' WebDAV client library. |
| 29 _DAVCLIENT_URL = ('https://src.chromium.org/chrome/trunk/src/tools/' | 30 _DAVCLIENT_URL = ('https://src.chromium.org/chrome/trunk/src/tools/' |
| 30 'telemetry/third_party/davclient/davclient.py') | 31 'telemetry/third_party/davclient/davclient.py') |
| 31 | 32 |
| 32 | 33 |
| 33 def _DownloadAndImportDAVClientModule(): | 34 def _DownloadAndImportDAVClientModule(): |
| 34 """Dynamically import davclient helper library.""" | 35 """Dynamically import davclient helper library.""" |
| 35 global davclient | 36 global davclient |
| 36 davclient_src = urllib.urlopen(_DAVCLIENT_URL).read() | 37 davclient_src = urllib.urlopen(_DAVCLIENT_URL).read() |
| 37 davclient = imp.new_module('davclient') | 38 davclient = imp.new_module('davclient') |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 for dst_path, src_path in deps.iteritems(): | 152 for dst_path, src_path in deps.iteritems(): |
| 152 full_dst_path = os.path.join(destination_dir, dst_path) | 153 full_dst_path = os.path.join(destination_dir, dst_path) |
| 153 parsed_url = urlparse.urlparse(src_path) | 154 parsed_url = urlparse.urlparse(src_path) |
| 154 root_url = parsed_url.scheme + '://' + parsed_url.netloc | 155 root_url = parsed_url.scheme + '://' + parsed_url.netloc |
| 155 | 156 |
| 156 dav_client = DAVClientWrapper(root_url) | 157 dav_client = DAVClientWrapper(root_url) |
| 157 dav_client.Traverse(parsed_url.path, full_dst_path) | 158 dav_client.Traverse(parsed_url.path, full_dst_path) |
| 158 | 159 |
| 159 for url in deps_includes.values(): | 160 for url in deps_includes.values(): |
| 160 DownloadDeps(destination_dir, url) | 161 DownloadDeps(destination_dir, url) |
| OLD | NEW |