Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 | |
| 6 class UnsupportedConfigFormatError(ValueError): | |
| 7 def __init__(self, config_type, config_file): | |
| 8 if not config_type: | |
| 9 message = ('The json file at %s is unsupported by the dependency_manager ' | |
| 10 'due to no specified config type' % config_file) | |
| 11 else: | |
| 12 message = ('The json file at %s has config type %s, which is unsupported ' | |
| 13 'by the dependency manager.' % (config_file, config_type)) | |
| 14 super(UnsupportedConfigFormatError, self).__init__(message) | |
| 15 | |
| 16 | |
| 17 class EmptyConfigError(ValueError): | |
| 18 def __init__(self, file_path): | |
| 19 super(EmptyConfigError, self).__init__('Empty config at %s.' % file_path) | |
| 20 | |
| 21 | |
| 22 class ConfigConflictError(Exception): | |
| 23 def __init__(self, config_files, conflict): | |
| 24 super(ConfigConflictError, self).__init__( | |
| 25 'Multiple definitions of %s found in given config files: %s .' | |
| 26 'Only overrides of local_path are allowed.' % (config_files, conflict)) | |
| 27 | |
| 28 | |
| 29 class FileNotFoundError(Exception): | |
| 30 def __init__(self, file_path): | |
| 31 super(FileNotFoundError, self).__init__('No file found at %s' % file_path) | |
| 32 | |
| 33 | |
| 34 class NoPathFoundError(FileNotFoundError): | |
| 35 def __init__(self, dependency, platform, arch): | |
| 36 super(NoPathFoundError, self).__init__( | |
| 37 'No file could be found locally, and no file to download from cloud ' | |
| 38 'storage for %s on platform %s and arch %s' % (dependency, platform, | |
| 39 arch)) | |
| 40 | |
| 41 | |
| 42 class DependencyManager(object): | |
| 43 def __init__(self, config_files): | |
| 44 pass | |
| 45 | |
| 46 def FetchPath(self, dependency, platform, arch): | |
| 47 """Find the given dependency in the locations given in configs. | |
| 48 | |
| 49 Return a path to the appropriate executable for <dependency>, | |
|
nednguyen
2015/08/06 21:26:38
|dependency|
| |
| 50 downloading from cloud storage if needed, or None if it cannot be found. | |
| 51 """ | |
| 52 raise NotImplementedError | |
| 53 | |
| 54 def LocalPath(self, dependency, platform, arch): | |
| 55 """Get a local version of the dependency from locations given in configs. | |
| 56 | |
| 57 Return a local path to the given dependency name, or None if an | |
| 58 executable cannot be found. Will not download the executable. | |
| 59 """ | |
| 60 raise NotImplementedError | |
| 61 | |
| 62 def UpdateCloudStorageDependency( | |
| 63 self, dependency, platform, arch, version=None): | |
| 64 """Update the cloud storage hash and the version for the given dependency. | |
| 65 """ | |
| 66 raise NotImplementedError | |
| 67 | |
| 68 def GetVersion(self, dependency, platform, arch): | |
| 69 """Return the Version information for the given dependency. | |
| 70 """ | |
| 71 raise NotImplementedError | |
| 72 | |
| 73 def _UpdateDependencies(self, config_file): | |
| 74 raise NotImplementedError | |
| 75 | |
| 76 def _GetDependencyInfo(self, dependency, platform, arch): | |
| 77 raise NotImplementedError | |
| 78 | |
| 79 @staticmethod | |
| 80 def _LocalPath(dependency_info): | |
| 81 raise NotImplementedError | |
| 82 | |
| 83 @staticmethod | |
| 84 def _CloudStoragePath(dependency_info): | |
| 85 raise NotImplementedError | |
| 86 | |
| OLD | NEW |