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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 Args: | 210 Args: |
211 dependency_info: A DependencyInfo instance for the dependency to be | 211 dependency_info: A DependencyInfo instance for the dependency to be |
212 found and the platform it should run on. | 212 found and the platform it should run on. |
213 | 213 |
214 Returns: A path to a local file, or None if not found. | 214 Returns: A path to a local file, or None if not found. |
215 """ | 215 """ |
216 if dependency_info: | 216 if dependency_info: |
217 paths = dependency_info.local_paths | 217 paths = dependency_info.local_paths |
218 for local_path in paths: | 218 for local_path in paths: |
219 logging.info('Trying local_path %s', local_path) | |
220 if os.path.exists(local_path): | 219 if os.path.exists(local_path): |
221 logging.info('local_path %s exists.', local_path) | |
222 return local_path | 220 return local_path |
223 return None | 221 return None |
224 | 222 |
225 @staticmethod | 223 @staticmethod |
226 def _CloudStoragePath(dependency_info): | 224 def _CloudStoragePath(dependency_info): |
227 """Return a path to a downloaded file for |dependency_info|. | 225 """Return a path to a downloaded file for |dependency_info|. |
228 | 226 |
229 May not download the file if it has already been downloaded. | 227 May not download the file if it has already been downloaded. |
230 | 228 |
231 Args: | 229 Args: |
(...skipping 28 matching lines...) Expand all Loading... |
260 if not os.path.exists(download_dir): | 258 if not os.path.exists(download_dir): |
261 os.makedirs(download_dir) | 259 os.makedirs(download_dir) |
262 | 260 |
263 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) | 261 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) |
264 if not os.path.exists(download_path): | 262 if not os.path.exists(download_path): |
265 raise exceptions.FileNotFoundError(download_path) | 263 raise exceptions.FileNotFoundError(download_path) |
266 #TODO(aiolos): Add support for unzipping files. | 264 #TODO(aiolos): Add support for unzipping files. |
267 os.chmod(download_path, | 265 os.chmod(download_path, |
268 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) | 266 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) |
269 return os.path.abspath(download_path) | 267 return os.path.abspath(download_path) |
| 268 |
OLD | NEW |