def getVersionFromMetapackage(self,systemroot,shortname): """Get version from meta package""" for pkg in ("app-misc/calculate-meta","app-misc/%s-meta"%shortname): calcMeta = isPkgInstalled(pkg,systemroot) if calcMeta: return calcMeta[0]['PV'] return None
def get(self): image = self.Get('cl_image') if image: with image as distr: distrPath = image.getDirectory() if isPkgInstalled('xorg-server',prefix=distrPath): return sorted(filter(self.supported.__contains__, getAvailableVideo(prefix=distrPath)))+['other'] return []
def get(self): try: image = self.Get('cl_image') if image: with image as distr: distrPath = image.getDirectory() if isPkgInstalled('xorg-server',prefix=distrPath): return "yes" except: pass return "no"
def get(self): category = isPkgInstalled(self.Get("cl_core_pkg_name")) if category: category = category[0].rpartition("/")[2] else: choice = self.choice() if len(choice) == 1: return choice[0] else: category = "" return category
def get(self): mapNetConf = (('networkmanager','net-misc/networkmanager', _("NetworkManager")), ('openrc','',_('OpenRC'))) image = self.Get('cl_image') if image: with image as distr: distrPath = image.getDirectory() return map(itemgetter(0,2), filter(lambda x:not x[1] or isPkgInstalled(x[1], prefix=distrPath), mapNetConf)) return sorted(map(itemgetter(0,2),mapNetConf[-1:]),key=itemgetter(1))
def check(self,value): if value == "on": if self.Get('os_linux_system') != "server": raise VariableError( _("PXE install is available for Calculate Directory Server only")+'.') for pkg in ['net-misc/dhcp','net-ftp/tftp-hpa','net-fs/nfs-utils']: if not isPkgInstalled(pkg): raise VariableError( _("For PXE install, you need to install package %s") %pkg) try: config = cl_template.iniParser('/etc/calculate/calculate.env') val = config.getVar('server','sr_dhcp_set') if val.encode('utf-8') == "on": return except: pass raise VariableError( _("PXE install is only available if the DHCP service has been configured first"))
def get(self): widthVal = self.Get('os_x11_width') heightVal = self.Get('os_x11_height') if not widthVal or not heightVal: return "" width = int(widthVal) height = int(heightVal) gep = sqrt(height**2+width**2) k = float(width)/float(height) for themePkg in ['media-gfx/cldx-themes', 'media-gfx/cld-themes', 'media-gfx/cldg-themes']: installed = isPkgInstalled(themePkg, prefix=self.Get('cl_chroot_path')) if installed and \ getTupleVersion(installed[0]['PV']) < getTupleVersion("12"): res = [(1024,600), (1024,768), (1280,1024), (1280,800), (1366,768), (1440,900), (1600,1200), (1680,1050), (1920,1200)] break else: res = [(1024,576), (1024,600), (1024,768), (1200,800), (1280,1024), (1280,720), (1280,768), (1280,800), (1360,768), (1366,768), (1368,768), (1400,1050), (1440,900), (1600,1200), (1600,768), (1600,900), (1680,1050), (1680,945), (1920,1080), (1920,1200), (2048,1152), (2560,1440), (2560,1600), (640,480), (800,480) ] bestRes = min(res, key=lambda x:(abs(x[0]/float(x[1])-k), abs(gep-sqrt(x[0]**2+x[1]**2)))) return "%sx%s"%bestRes
def get(self): pkg = isPkgInstalled("%s/%s" % (self.Get("cl_core_pkg_category"), self.Get("cl_core_pkg_name"))) if pkg: return sorted(pkg, key=lambda x: getTupleVersion(x["PVR"]))[-1]["PVR"] return ""