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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 platform_parts = platform.split('_', 1) | 94 platform_parts = platform.split('_', 1) |
95 assert len(platform_parts) == 2 | 95 assert len(platform_parts) == 2 |
96 platform_os, platform_arch = platform_parts | 96 platform_os, platform_arch = platform_parts |
97 logging.info('Calling into support_binaries with dependency %s, platform ' | 97 logging.info('Calling into support_binaries with dependency %s, platform ' |
98 '%s and arch %s.' % (dependency, platform_os, | 98 '%s and arch %s.' % (dependency, platform_os, |
99 platform_arch)) | 99 platform_arch)) |
100 return support_binaries.FindPath(dependency, platform_arch, | 100 return support_binaries.FindPath(dependency, platform_arch, |
101 platform_os) | 101 platform_os) |
102 logging.info('Looking for dependency %s, on platform %s in the dependency ' | 102 logging.info('Looking for dependency %s, on platform %s in the dependency ' |
103 'manager.' % (dependency, platform)) | 103 'manager.' % (dependency, platform)) |
104 dependency_info = self._GetDependencyInfo(self._lookup_dict, dependency, | 104 dependency_info = self._GetDependencyInfo(dependency, platform) |
105 platform) | |
106 path = self._LocalPath(dependency_info) | 105 path = self._LocalPath(dependency_info) |
107 if not path or not os.path.exists(path): | 106 if not path or not os.path.exists(path): |
108 path = self._CloudStoragePath(dependency_info) | 107 path = self._CloudStoragePath(dependency_info) |
109 if not path or not os.path.exists(path): | 108 if not path or not os.path.exists(path): |
110 raise exceptions.NoPathFoundError(dependency, platform) | 109 raise exceptions.NoPathFoundError(dependency, platform) |
111 return path | 110 return path |
112 | 111 |
113 def LocalPath(self, dependency, platform): | 112 def LocalPath(self, dependency, platform): |
114 """Get a path to a locally stored executable for |dependency|. | 113 """Get a path to a locally stored executable for |dependency|. |
115 | 114 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 os.makedirs(download_dir) | 248 os.makedirs(download_dir) |
250 | 249 |
251 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) | 250 cloud_storage.GetIfHashChanged(cs_path, download_path, cs_bucket, cs_hash) |
252 if not os.path.exists(download_path): | 251 if not os.path.exists(download_path): |
253 raise exceptions.FileNotFoundError(download_path) | 252 raise exceptions.FileNotFoundError(download_path) |
254 #TODO(aiolos): Add support for unzipping files. | 253 #TODO(aiolos): Add support for unzipping files. |
255 os.chmod(download_path, | 254 os.chmod(download_path, |
256 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) | 255 stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP) |
257 return os.path.abspath(download_path) | 256 return os.path.abspath(download_path) |
258 | 257 |
OLD | NEW |