def get_media_config(self, root): config = MediasysConfig() distroconf = config.get_any_distro() layoutconf = config.get_any_layout() distroconf.root = root distroconf.recently_removed_dir = self.recently_removed_dir distro = distromod.get_distro(distroconf, layoutconf, config) config.recently_removed_dir = self.testrecentlyremoved_dir media = self.media_class(self.testrepomainrelease_dir, distroconf) return media, distroconf, distro
def get_distro(self, name, root=None): """Parses configuration and finds all distributions in media configuration""" from mediasys.distro import get_distro, Distroset, NoSuchDistro for secname in self._config.sections(): fields = secname.split(None, 1) if len(fields) > 1 and fields[0] == "distro": candname = fields[1] if name != candname: continue distroconf = Distroconf(self, secname, self._anydistro) distroconf.name = name if root is not None: # why not more options? distroconf.root = root try: layoutconf = self._layoutconfs[distroconf.layout] except KeyError: raise ConfigError("unknown layout %r, referred by " "distro %r" % (name, distroconf.layout)) distro = get_distro(distroconf, layoutconf, self) return distro raise NoSuchDistro