def get(self): """Get video driver used by xorg""" list_video = getInstalledVideo('/') methods = ((getVideoFromXorgLog,('/',list_video)), (getVideoFromXorgConf,('/',)), (getVideoFromModules,()), (getVideoFromCmdLine,()), (getVideoFromVendor,(self.Get('hr_video'),list_video))) for func,args in methods: drv = func(*args) if drv in list_video: return drv return "other"
def check(self,value): if self.Get('cl_action') == 'system': availDrvs = self.Get('os_install_x11_video_available') if not value in availDrvs: raise VariableError(_("Only %s drivers are available")% ",".join(availDrvs)) else: if not value in getInstalledVideo(prefix="/") and \ not value in ("auto","other"): error =_("video driver %s is unavailable")%value if value in self.pkgDrvMap: error += ". " + (_("Install driver %s with:") %self.pkgDrvMap[value][0]) error += "\n" + ("emerge %s"%self.pkgDrvMap[value][1]) raise VariableError(error)