| 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.') |
| 92 if not try_support_binaries: | 94 if not try_support_binaries: |
| 93 raise exceptions.NoPathFoundError(dependency, platform) | 95 raise exceptions.NoPathFoundError(dependency, platform) |
| 94 # TODO(aiolos): Remove the support_binaries call and always raise | 96 # TODO(aiolos): Remove the support_binaries call and always raise |
| 95 # NoPathFound once the binary dependencies are moved over to the new | 97 # NoPathFound once the binary dependencies are moved over to the new |
| 96 # system. | 98 # system. |
| 97 | 99 |
| 98 # platform should be of the form '%s_%s' % (os_name, arch_name) when | 100 # platform should be of the form '%s_%s' % (os_name, arch_name) when |
| 99 # called from the binary_manager. | 101 # called from the binary_manager. |
| 100 platform_parts = platform.split('_', 1) | 102 platform_parts = platform.split('_', 1) |
| 101 assert len(platform_parts) == 2 | 103 assert len(platform_parts) == 2 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 132 A path to an executable for |dependency| that will run on |platform|. | 134 A path to an executable for |dependency| that will run on |platform|. |
| 133 | 135 |
| 134 Raises: | 136 Raises: |
| 135 NoPathFoundError: If a local copy of the executable cannot be found. | 137 NoPathFoundError: If a local copy of the executable cannot be found. |
| 136 """ | 138 """ |
| 137 # TODO(aiolos): Remove the support_binaries call and always raise | 139 # TODO(aiolos): Remove the support_binaries call and always raise |
| 138 # NoPathFound once the binary dependencies are moved over to the new | 140 # NoPathFound once the binary dependencies are moved over to the new |
| 139 # system. | 141 # system. |
| 140 dependency_info = self._GetDependencyInfo(dependency, platform) | 142 dependency_info = self._GetDependencyInfo(dependency, platform) |
| 141 if not dependency_info: | 143 if not dependency_info: |
| 144 logging.error( |
| 145 'The dependency_manager was not initialized with the dependency.') |
| 142 if not try_support_binaries: | 146 if not try_support_binaries: |
| 143 raise exceptions.NoPathFoundError(dependency, platform) | 147 raise exceptions.NoPathFoundError(dependency, platform) |
| 144 return support_binaries.FindLocallyBuiltPath(dependency) | 148 return support_binaries.FindLocallyBuiltPath(dependency) |
| 145 local_path = self._LocalPath(dependency_info) | 149 local_path = self._LocalPath(dependency_info) |
| 146 if not local_path or not os.path.exists(local_path): | 150 if not local_path or not os.path.exists(local_path): |
| 147 raise exceptions.NoPathFoundError(dependency, platform) | 151 raise exceptions.NoPathFoundError(dependency, platform) |
| 148 return local_path | 152 return local_path |
| 149 | 153 |
| 150 def _UpdateDependencies(self, config): | 154 def _UpdateDependencies(self, config): |
| 151 """Add the dependency information stored in |config| to this instance. | 155 """Add the dependency information stored in |config| to this instance. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if not os.path.exists(download_dir): | 258 if not os.path.exists(download_dir): |
| 255 os.makedirs(download_dir) | 259 os.makedirs(download_dir) |
| 256 | 260 |
| 257 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) | 261 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) |
| 258 if not os.path.exists(download_path): | 262 if not os.path.exists(download_path): |
| 259 raise exceptions.FileNotFoundError(download_path) | 263 raise exceptions.FileNotFoundError(download_path) |
| 260 #TODO(aiolos): Add support for unzipping files. | 264 #TODO(aiolos): Add support for unzipping files. |
| 261 os.chmod(download_path, | 265 os.chmod(download_path, |
| 262 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) |
| 263 return os.path.abspath(download_path) | 267 return os.path.abspath(download_path) |
| OLD | NEW |