def __init__(self, config=None): self.config = config if self.config: reload_config(self.config) self.layman_inst = LaymanAPI(config=self.config) self.output = self.config.get_option('output') self.overlay = {} self.overlays = [] self.overlays_available = self.layman_inst.get_available() self.supported_types = list(self.layman_inst.supported_types())
def __call__(self, overlay_package=None, path=None): if not overlay_package: self.args_parser() options = {} for key in vars(self.args): options[key] = vars(self.args)[key] self.config = OptionConfig(options=options) reload_config(self.config) self.auto_complete = False self.list_info = self.config.get_option('list_autocomplete') self.no_extra = self.config.get_option('no_extra') self.sudo = self.config.get_option('sudo') if self.list_info: self.list_templates() if self.args.set_autocomplete: if 'ALL' in self.args.set_autocomplete: self.templates = AUTOCOMPLETE_TEMPLATE.keys() self.auto_complete = True else: self.templates = self.args.set_autocomplete self.auto_complete = True msg = 'How many overlays would you like to create?: ' for x in range(1, int(get_input(msg)) + 1): self.output.notice('') self.output.info('Overlay #%(x)s: ' % ({'x': str(x)})) self.output.info('~~~~~~~~~~~~~') self.required = copy.deepcopy(COMPONENT_DEFAULTS) if not self.no_extra: self.output.notice('') self.update_required() self.output.notice('') self.get_overlay_components() ovl = Overlay.Overlay(config=self.config, ovl_dict=self.overlay, ignore=1) self.overlays.append((self.overlay['name'], ovl)) else: ovl_name, ovl = overlay_package self.overlays.append((ovl_name, ovl)) result = self.write(path) return result
def __call__(self, overlay_package=None, path=None): if not overlay_package: self.args_parser() options = {} for key in vars(self.args): options[key] = vars(self.args)[key] self.config = OptionConfig(options=options) reload_config(self.config) self.auto_complete = False self.list_info = self.config.get_option('list_autocomplete') self.no_extra = self.config.get_option('no_extra') self.sudo = self.config.get_option('sudo') if self.list_info: self.list_templates() if self.args.set_autocomplete: if 'ALL' in self.args.set_autocomplete: self.templates = AUTOCOMPLETE_TEMPLATE.keys() self.auto_complete = True else: self.templates = self.args.set_autocomplete self.auto_complete = True msg = 'How many overlays would you like to create?: ' for x in range(1, int(get_input(msg))+1): self.output.notice('') self.output.info('Overlay #%(x)s: ' % ({'x': str(x)})) self.output.info('~~~~~~~~~~~~~') self.required = copy.deepcopy(COMPONENT_DEFAULTS) if not self.no_extra: self.output.notice('') self.update_required() self.output.notice('') self.get_overlay_components() ovl = Overlay.Overlay(config=self.config, ovl_dict=self.overlay, ignore=1) self.overlays.append((self.overlay['name'], ovl)) else: ovl_name, ovl = overlay_package self.overlays.append((ovl_name, ovl)) result = self.write(path) return result
def _get_layman_api(self): ''' Initializes layman api. @rtype layman.api.LaymanAPI instance ''' # Make it so that we aren't initializing the # LaymanAPI instance if it already exists and # if the current storage location hasn't been # changed for the new repository. self.storage = self.repo.location.replace(self.repo.name, '') if self._layman and self.storage in self.current_storage: return self._layman config = BareConfig() configdir = {'configdir': config.get_option('configdir')} self.message = Message(out=sys.stdout, err=sys.stderr) self.current_storage = self.storage options = { 'config': config.get_option('config') % (configdir), 'quiet': self.settings.get('PORTAGE_QUIET'), 'quietness': config.get_option('quietness'), 'overlay_defs': config.get_option('overlay_defs') % (configdir), 'output': self.message, 'nocolor': self.settings.get('NOCOLOR'), 'root': self.settings.get('EROOT'), 'storage': self.current_storage, 'verbose': self.settings.get('PORTAGE_VERBOSE'), 'width': self.settings.get('COLUMNWIDTH'), } self.config = OptionConfig(options=options, root=options['root']) # Reloads config to read custom overlay # xml files. reload_config(self.config) layman_api = LaymanAPI(self.config, report_errors=True, output=self.config['output'] ) self._layman = layman_api return layman_api
def _get_layman_api(self): ''' Initializes layman api. @rtype layman.api.LaymanAPI instance ''' # Make it so that we aren't initializing the # LaymanAPI instance if it already exists and # if the current storage location hasn't been # changed for the new repository. self.storage = self.repo.location.replace(self.repo.name, '') if self._layman and self.storage in self.current_storage: return self._layman config = BareConfig() configdir = {'configdir': config.get_option('configdir')} self.message = Message(out=sys.stdout, err=sys.stderr) self.current_storage = self.storage options = { 'config': config.get_option('config') % (configdir), 'quiet': self.settings.get('PORTAGE_QUIET'), 'quietness': config.get_option('quietness'), 'overlay_defs': config.get_option('overlay_defs') % (configdir), 'output': self.message, 'nocolor': self.settings.get('NOCOLOR'), 'root': self.settings.get('EROOT'), 'storage': self.current_storage, 'verbose': self.settings.get('PORTAGE_VERBOSE'), 'width': self.settings.get('COLUMNWIDTH'), } self.config = OptionConfig(options=options, root=options['root']) # Reloads config to read custom overlay # xml files. reload_config(self.config) layman_api = LaymanAPI(self.config, report_errors=True, output=self.config['output']) self._layman = layman_api return layman_api