def GetInstance(cls): """Returns the singleton instance.""" if cls.NeedsInit(): raise exceptions.InitializationError( 'Attempted to get LocalFirstBinaryManager without prior ' 'initialization.') return cls._instance
def LocalPath(binary_name, arch, os_name, os_version=None): """ Return a local path to the given binary name, or None if an executable cannot be found. Will not download the executable. """ if _binary_manager is None: raise exceptions.InitializationError( 'Called LocalPath with uninitialized binary manager.') return _binary_manager.LocalPath(binary_name, arch, os_name, os_version)
def FetchPath(binary_name, arch, os_name, os_version=None): """ Return a path to the appropriate executable for <binary_name>, downloading from cloud storage if needed, or None if it cannot be found. """ if _binary_manager is None: raise exceptions.InitializationError( 'Called FetchPath with uninitialized binary manager.') return _binary_manager.FetchPath(binary_name, arch, os_name, os_version)
def FetchPath(binary_name, os_name, arch, os_version=None): """ Return a path to the appropriate executable for <binary_name>, downloading from cloud storage if needed, or None if it cannot be found. """ if GetBinaryManager() is None: raise exceptions.InitializationError( 'Called FetchPath with uninitialized binary manager.') return GetBinaryManager().FetchPath( binary_name, 'linux' if _IsChromeOSLocalMode(os_name) else os_name, arch, os_version)
def InitDependencyManager(environment_config): global _dependency_manager if _dependency_manager: raise exceptions.InitializationError( 'Trying to re-initialize the binary manager with config %s' % environment_config) configs = [dependency_manager.BaseConfig(TELEMETRY_PROJECT_CONFIG)] if environment_config: configs.insert(0, dependency_manager.BaseConfig(environment_config)) _dependency_manager = dependency_manager.DependencyManager(configs)
def LocalPath(binary_name, arch, platform): """ Return a local path to the given binary name, or None if an executable cannot be found. Will not download the executable. """ logging.debug('Called LocalPath for binary: %s on platform: %s and arch: ' '%s' % (binary_name, platform, arch)) if _dependency_manager is None: raise exceptions.InitializationError( 'Called LocalPath with uninitialized binary manager.') return _dependency_manager.LocalPath(binary_name, '%s_%s' % (platform, arch))
def FetchPath(binary_name, arch, platform): """ Return a path to the appropriate executable for <binary_name>, downloading from cloud storage if needed, or None if it cannot be found. """ logging.info('Called FetchPath for binary: %s on platform: %s and arch: %s' % (binary_name, platform, arch)) if _dependency_manager is None: raise exceptions.InitializationError( 'Called FetchPath with uninitialized binary manager.') return _dependency_manager.FetchPath( binary_name, '%s_%s' % (platform, arch), try_support_binaries=True)
def InitDependencyManager(client_configs): if GetBinaryManager(): raise exceptions.InitializationError( 'Trying to re-initialize the binary manager with config %s' % client_configs) configs = [] if client_configs: configs += client_configs configs += [TELEMETRY_PROJECT_CONFIG, CHROME_BINARY_CONFIG] SetBinaryManager(binary_manager.BinaryManager(configs)) devil_env.config.Initialize()
def InitDependencyManager(environment_config): global _binary_manager if _binary_manager: raise exceptions.InitializationError( 'Trying to re-initialize the binary manager with config %s' % environment_config) configs = [base_config.BaseConfig(TELEMETRY_PROJECT_CONFIG), base_config.BaseConfig(CHROME_BINARY_CONFIG)] if environment_config: configs.insert(0, base_config.BaseConfig(environment_config)) _binary_manager = binary_manager.BinaryManager(configs) devil_env.config.Initialize()
def InitDependencyManager(client_configs): global _binary_manager # pylint: disable=global-statement if _binary_manager: raise exceptions.InitializationError( 'Trying to re-initialize the binary manager with config %s' % client_configs) configs = [] if client_configs: configs += client_configs configs += [TELEMETRY_PROJECT_CONFIG, CHROME_BINARY_CONFIG] _binary_manager = binary_manager.BinaryManager(configs) devil_env.config.Initialize()
def Init(cls, build_dir, browser_binary, os_name, arch, ignored_dependencies=None, os_version=None): """Initializes the singleton. Args: See constructor. """ if not cls.NeedsInit(): raise exceptions.InitializationError( 'Tried to re-initialize LocalFirstBinarymanager with build dir %s ' 'and browser binary %s' % (build_dir, browser_binary)) ignored_dependencies = ignored_dependencies or [] cls._instance = LocalFirstBinaryManager(build_dir, browser_binary, os_name, arch, ignored_dependencies, os_version)