OLD | NEW |
---|---|
1 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 import base64 | 5 import base64 |
6 import json | 6 import json |
7 import os | 7 import os |
8 import urllib2 | |
8 | 9 |
9 from common import utils | 10 from common import utils |
10 | 11 |
11 | 12 |
12 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 13 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
13 CONFIG = json.loads(open(os.path.join(_THIS_DIR, | 14 CONFIG = json.loads(open(os.path.join(_THIS_DIR, |
14 'deps_config.json'), 'r').read()) | 15 'deps_config.json'), 'r').read()) |
15 | 16 |
16 | 17 |
17 class _VarImpl(object): | 18 class _VarImpl(object): |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 if name in components_renamed: | 59 if name in components_renamed: |
59 return components_renamed[name].lower() | 60 return components_renamed[name].lower() |
60 else: | 61 else: |
61 return name.lower() | 62 return name.lower() |
62 | 63 |
63 # Unknown path, return the whole path as component name. | 64 # Unknown path, return the whole path as component name. |
64 return '_'.join(path.split('/')) | 65 return '_'.join(path.split('/')) |
65 | 66 |
66 | 67 |
67 def _GetContentOfDEPS(url): | 68 def _GetContentOfDEPS(url): |
68 _, content = utils.GetHttpClient().Get(url, timeout=60) | 69 try: |
69 return content | 70 _, content = utils.GetHttpClient().Get(url, timeout=60) |
71 return content | |
72 | |
73 # TODO(jeun): Handle HTTP Errors, such as 404. | |
74 except urllib2.HTTPError: | |
Martin Barbella
2014/08/22 02:24:13
Please include some kind of retry logic here. Just
jeun
2014/08/22 22:58:43
Done.
| |
75 return '' | |
70 | 76 |
71 | 77 |
72 def GetChromiumComponents(chromium_revision, | 78 def GetChromiumComponents(chromium_revision, |
73 os_platform='unix', | 79 os_platform='unix', |
74 deps_file_downloader=_GetContentOfDEPS): | 80 deps_file_downloader=_GetContentOfDEPS): |
75 """Return a list of components used by Chrome of the given revision. | 81 """Return a list of components used by Chrome of the given revision. |
76 | 82 |
77 Args: | 83 Args: |
78 chromium_revision: The revision of the Chrome build. | 84 chromium_revision: The revision of the Chrome build. |
79 os_platform: The target platform of the Chrome build, eg. win, mac, etc. | 85 os_platform: The target platform of the Chrome build, eg. win, mac, etc. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 'path': path, | 204 'path': path, |
199 'rolled': new_component['revision'] != old_revision, | 205 'rolled': new_component['revision'] != old_revision, |
200 'name': new_component['name'], | 206 'name': new_component['name'], |
201 'old_revision': old_revision, | 207 'old_revision': old_revision, |
202 'new_revision': new_component['revision'], | 208 'new_revision': new_component['revision'], |
203 'repository': new_component['repository'], | 209 'repository': new_component['repository'], |
204 'repository_type': new_component['repository_type'] | 210 'repository_type': new_component['repository_type'] |
205 } | 211 } |
206 | 212 |
207 return components | 213 return components |
OLD | NEW |