Browse Source

Optimize os_x11_video_drv

develop
Mike Hiretsky 11 years ago
parent
commit
0db15edb6c
  1. 11
      pym/cl_fill.py
  2. 7
      pym/cl_utils.py

11
pym/cl_fill.py

@ -23,7 +23,7 @@ import cl_overriding
from cl_vars_share import varsShare, clLocale
from os.path import exists as pathexists
from os import path
from cl_utils import isMount, genpassword
from cl_utils import isMount, genpassword, getAvailableX11Drivers
from encrypt import getHash
class fillVars(varsShare):
@ -435,17 +435,10 @@ class fillVars(varsShare):
def get_os_x11_video_drv(self):
"""Get video driver used by xorg"""
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
xorg_conf = '/etc/X11/xorg.conf'
# Try analize Xorg.{DISPLAY}.log
display = os.environ.get('DISPLAY')
if path.exists(xorg_modules_dir):
list_avialable_drivers = \
map(lambda x: x[:-7],
filter(lambda x: x.endswith('_drv.so'),
os.listdir(xorg_modules_dir)))
else:
list_avialable_drivers = []
list_avialable_drivers = getAvailableX11Drivers()
if display and list_avialable_drivers:
reDriver = re.compile('|'.join(map(lambda x: "%s_drv.so"%x,
list_avialable_drivers)))

7
pym/cl_utils.py

@ -895,3 +895,10 @@ def getSquashList():
else:
return map(lambda x:{"lzma":"xz"}.get(x,x),
list(set(usesSquashFs) & wantMethod))
def getAvailableX11Drivers():
"""Get available x11 drivers"""
xorg_modules_dir = '/usr/lib/xorg/modules/drivers'
return map(lambda x: x[:-7],
filter(lambda x:x.endswith('_drv.so'),
listDirectory(xorg_modules_dir)))
Loading…
Cancel
Save