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) | |
219 if os.path.exists(local_path): | 220 if os.path.exists(local_path): |
221 logging.info('local_path %s exists.', local_path) | |
Dirk Pranke
2015/09/30 18:24:00
Do you really want to commit these logging lines?
aiolos (Not reviewing)
2015/09/30 18:32:16
Done.
| |
220 return local_path | 222 return local_path |
221 return None | 223 return None |
222 | 224 |
223 @staticmethod | 225 @staticmethod |
224 def _CloudStoragePath(dependency_info): | 226 def _CloudStoragePath(dependency_info): |
225 """Return a path to a downloaded file for |dependency_info|. | 227 """Return a path to a downloaded file for |dependency_info|. |
226 | 228 |
227 May not download the file if it has already been downloaded. | 229 May not download the file if it has already been downloaded. |
228 | 230 |
229 Args: | 231 Args: |
(...skipping 28 matching lines...) Expand all Loading... | |
258 if not os.path.exists(download_dir): | 260 if not os.path.exists(download_dir): |
259 os.makedirs(download_dir) | 261 os.makedirs(download_dir) |
260 | 262 |
261 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) | 263 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) |
262 if not os.path.exists(download_path): | 264 if not os.path.exists(download_path): |
263 raise exceptions.FileNotFoundError(download_path) | 265 raise exceptions.FileNotFoundError(download_path) |
264 #TODO(aiolos): Add support for unzipping files. | 266 #TODO(aiolos): Add support for unzipping files. |
265 os.chmod(download_path, | 267 os.chmod(download_path, |
266 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) | 268 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) |
267 return os.path.abspath(download_path) | 269 return os.path.abspath(download_path) |
268 | |
OLD | NEW |