def __init__(self, config, xml=None, ovl_dict=None, ignore = 0): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) >>> import xml.etree.ElementTree as ET # Python 2.5 >>> document =ET.parse(here + '/../tests/testfiles/global-overlays.xml') >>> overlays = document.findall('overlay') + document.findall('repo') >>> from layman.output import Message >>> output = Message() >>> a = Overlay({'output': output}, overlays[0]) >>> a.name 'wrobel' >>> a.is_official() True >>> list(a.source_uris()) ['https://overlays.gentoo.org/svn/dev/wrobel'] >>> a.owner_email '*****@*****.**' >>> a.description 'Test' >>> a.priority 10 >>> b = Overlay({'output': output}, overlays[1]) >>> b.is_official() False ''' self.config = config self.output = config['output'] self._encoding_ = get_encoding(self.output) if xml is not None: self.from_xml(xml, ignore) elif ovl_dict is not None: self.from_dict(ovl_dict, ignore)
def __init__(self, config): self.config = config self.output = self.config['output'] if not self.config['width']: self.width = terminal_width() - 1 else: self.width = self.config['width'] self.srclen = self.width - 43 self._encoding_ = get_encoding(self.output) if config['verbose']: self.my_lister = self.short_list # self.long_list else: self.my_lister = self.short_list
def __init__(self, config): self.config = config self.output = self.config['output'] if not self.config['width']: self.width = terminal_width()-1 else: self.width = self.config['width'] self.srclen = self.width - 43 self._encoding_ = get_encoding(self.output) if config['verbose']: self.my_lister = self.short_list # self.long_list else: self.my_lister = self.short_list
def __init__(self, config, xml=None, ovl_dict=None, ignore = 0): self.config = config self.output = config['output'] self.module_controller = Modules(path=MOD_PATH, namepath='layman.overlays.modules', output=self.output) self._encoding_ = get_encoding(self.output) if xml is not None: self.from_xml(xml, ignore) elif ovl_dict is not None: self.from_dict(ovl_dict, ignore)
def __init__(self, config, json=None, ovl_dict=None, xml=None, ignore=0): self.config = config self.output = config['output'] self.module_controller = Modules(path=MOD_PATH, namepath='layman.overlays.modules', output=self.output) self._encoding_ = get_encoding(self.output) if xml is not None: self.from_xml(xml, ignore) elif ovl_dict is not None: self.from_dict(ovl_dict, ignore) elif json is not None: self.from_json(json, ignore)