Browse Source

Add isPkgInstalled and fix video for server.

develop
Mike Hiretsky 11 years ago
parent
commit
6325f31c51
  1. 5
      pym/cl_fill.py
  2. 14
      pym/cl_utils.py

5
pym/cl_fill.py

@ -24,7 +24,7 @@ from cl_vars_share import varsShare, clLocale
from os.path import exists as pathexists
from os import path
from cl_utils import isMount, genpassword, getAvailableX11Drivers, \
listDirectory
listDirectory,isPkgInstalled
from encrypt import getHash
class fillVars(varsShare):
@ -447,7 +447,8 @@ class fillVars(varsShare):
videoVal = self.getValueFromCmdLine("calculate","video")
videoVal = {'i915':'intel'}.get(videoVal,videoVal)
if videoVal in list_avialable_drivers:
if not isPkgInstalled('xorg-server') or \
videoVal in list_avialable_drivers:
return videoVal
workedModules = map(lambda x:x[0],
filter(lambda x:x[1].isdigit() and int(x[1])>0,

14
pym/cl_utils.py

@ -894,6 +894,20 @@ def getPkgUses(fullpkg):
filter(lambda x:x,
iuse)))
def isPkgInstalled(pkg,prefix='/'):
"""Check is package installed"""
pkgDir = path.join(prefix,'var/db/pkg')
if "/" in pkg:
category,op,pkg = pkg.partition('/')
return bool(
filter(lambda x:x.startswith(pkg),
listDirectory(path.join(pkgDir,category))))
else:
return bool(
filter(lambda x: filter(lambda y:y.startswith(pkg),
listDirectory(x)),
listDirectory(pkgDir,fullPath=True)))
def getPkgActiveUses(fullpkg):
"""Get active uses from package"""
res = getPkgUses(fullpkg)

Loading…
Cancel
Save