OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 logging | 5 import logging |
6 import os | 6 import os |
7 import stat | 7 import stat |
8 | 8 |
9 from catapult_base import cloud_storage | 9 from catapult_base import cloud_storage |
10 from catapult_base import support_binaries | 10 from catapult_base import support_binaries |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 cloud_storage. | 82 cloud_storage. |
83 ServerError: If an internal server error is hit while downloading the | 83 ServerError: If an internal server error is hit while downloading the |
84 remote file. | 84 remote file. |
85 CloudStorageError: If another error occured while downloading the remote | 85 CloudStorageError: If another error occured while downloading the remote |
86 path. | 86 path. |
87 FileNotFoundError: If an attempted download was otherwise unsuccessful. | 87 FileNotFoundError: If an attempted download was otherwise unsuccessful. |
88 | 88 |
89 """ | 89 """ |
90 dependency_info = self._GetDependencyInfo(dependency, platform) | 90 dependency_info = self._GetDependencyInfo(dependency, platform) |
91 if not dependency_info: | 91 if not dependency_info: |
92 logging.error( | |
93 'The dependency_manager was not initialized with the dependency.') | |
94 if not try_support_binaries: | 92 if not try_support_binaries: |
95 raise exceptions.NoPathFoundError(dependency, platform) | 93 raise exceptions.NoPathFoundError(dependency, platform) |
96 # TODO(aiolos): Remove the support_binaries call and always raise | 94 # TODO(aiolos): Remove the support_binaries call and always raise |
97 # NoPathFound once the binary dependencies are moved over to the new | 95 # NoPathFound once the binary dependencies are moved over to the new |
98 # system. | 96 # system. |
99 | 97 |
100 # platform should be of the form '%s_%s' % (os_name, arch_name) when | 98 # platform should be of the form '%s_%s' % (os_name, arch_name) when |
101 # called from the binary_manager. | 99 # called from the binary_manager. |
102 platform_parts = platform.split('_', 1) | 100 platform_parts = platform.split('_', 1) |
103 assert len(platform_parts) == 2 | 101 assert len(platform_parts) == 2 |
(...skipping 30 matching lines...) Expand all Loading... |
134 A path to an executable for |dependency| that will run on |platform|. | 132 A path to an executable for |dependency| that will run on |platform|. |
135 | 133 |
136 Raises: | 134 Raises: |
137 NoPathFoundError: If a local copy of the executable cannot be found. | 135 NoPathFoundError: If a local copy of the executable cannot be found. |
138 """ | 136 """ |
139 # TODO(aiolos): Remove the support_binaries call and always raise | 137 # TODO(aiolos): Remove the support_binaries call and always raise |
140 # NoPathFound once the binary dependencies are moved over to the new | 138 # NoPathFound once the binary dependencies are moved over to the new |
141 # system. | 139 # system. |
142 dependency_info = self._GetDependencyInfo(dependency, platform) | 140 dependency_info = self._GetDependencyInfo(dependency, platform) |
143 if not dependency_info: | 141 if not dependency_info: |
144 logging.error( | |
145 'The dependency_manager was not initialized with the dependency.') | |
146 if not try_support_binaries: | 142 if not try_support_binaries: |
147 raise exceptions.NoPathFoundError(dependency, platform) | 143 raise exceptions.NoPathFoundError(dependency, platform) |
148 return support_binaries.FindLocallyBuiltPath(dependency) | 144 return support_binaries.FindLocallyBuiltPath(dependency) |
149 local_path = self._LocalPath(dependency_info) | 145 local_path = self._LocalPath(dependency_info) |
150 if not local_path or not os.path.exists(local_path): | 146 if not local_path or not os.path.exists(local_path): |
151 raise exceptions.NoPathFoundError(dependency, platform) | 147 raise exceptions.NoPathFoundError(dependency, platform) |
152 return local_path | 148 return local_path |
153 | 149 |
154 def _UpdateDependencies(self, config): | 150 def _UpdateDependencies(self, config): |
155 """Add the dependency information stored in |config| to this instance. | 151 """Add the dependency information stored in |config| to this instance. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 os.makedirs(download_dir) | 255 os.makedirs(download_dir) |
260 | 256 |
261 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) | 257 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) |
262 if not os.path.exists(download_path): | 258 if not os.path.exists(download_path): |
263 raise exceptions.FileNotFoundError(download_path) | 259 raise exceptions.FileNotFoundError(download_path) |
264 #TODO(aiolos): Add support for unzipping files. | 260 #TODO(aiolos): Add support for unzipping files. |
265 os.chmod(download_path, | 261 os.chmod(download_path, |
266 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) | 262 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) |
267 return os.path.abspath(download_path) | 263 return os.path.abspath(download_path) |
268 | 264 |
OLD | NEW |