本文整理汇总了Python中jockey.handlers.KernelModuleHandler.enabled方法的典型用法代码示例。如果您正苦于以下问题:Python KernelModuleHandler.enabled方法的具体用法?Python KernelModuleHandler.enabled怎么用?Python KernelModuleHandler.enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jockey.handlers.KernelModuleHandler
的用法示例。
在下文中一共展示了KernelModuleHandler.enabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enabled
# 需要导入模块: from jockey.handlers import KernelModuleHandler [as 别名]
# 或者: from jockey.handlers.KernelModuleHandler import enabled [as 别名]
def enabled(self):
# See if nvidia (e.g. nvidia-current) is the current alternative
target_alternative = self._alternatives.get_alternative_by_name(self.package)
current_alternative = self._alternatives.get_current_alternative()
other_target_alternative = self._other_alternatives.get_alternative_by_name(self.package)
other_current_alternative = self._other_alternatives.get_current_alternative()
logging.debug('NVidia(%s).enabled(): target_alt %s current_alt %s other target alt %s other current alt %s',
self.module, target_alternative, current_alternative,
other_target_alternative, other_current_alternative)
if current_alternative is None:
return False
if current_alternative != target_alternative or \
other_current_alternative != other_target_alternative:
logging.debug('%s is not the alternative in use', self.module)
return False
#if self.xorg_conf has NoneType, AttributeError will be raised
if not self.xorg_conf:
logging.debug('%s: xkit object does not exist!', self.module)
return False
# Make sure that neither the alias nor the actual module are blacklisted
if OSLib.inst.module_blacklisted(self._module_alias) or OSLib.inst.module_blacklisted(self.module):
logging.debug('%s is blacklisted, so not treating as enabled', self.module)
return False
kmh_enabled = KernelModuleHandler.enabled(self)
logging.debug('KMH enabled: %s', str(kmh_enabled))
return KernelModuleHandler.enabled(self)
示例2: enabled
# 需要导入模块: from jockey.handlers import KernelModuleHandler [as 别名]
# 或者: from jockey.handlers.KernelModuleHandler import enabled [as 别名]
def enabled(self):
#if self.xorg_conf has NoneType, AttributeError will be raised
try:
devices = self.xorg_conf.globaldict['Device']
try:
driver = self.xorg_conf.getDriver('Device', 0)
except (XKit.xorgparser.OptionException, XKit.xorgparser.SectionException):
driver = None
if len(devices) == 0 or driver != 'nvidia':
return False
except AttributeError:
return False
return KernelModuleHandler.enabled(self)
示例3: enabled
# 需要导入模块: from jockey.handlers import KernelModuleHandler [as 别名]
# 或者: from jockey.handlers.KernelModuleHandler import enabled [as 别名]
def enabled(self):
km = KernelModuleHandler.enabled(self)
bcm = OSLib.inst.module_blacklisted("bcm43xx")
b43 = OSLib.inst.module_blacklisted("b43")
b43_legacy = OSLib.inst.module_blacklisted("b43legacy")
b43_loaded = (
KernelModuleHandler.module_loaded("bcm43xx")
or KernelModuleHandler.module_loaded("b43")
or KernelModuleHandler.module_loaded("b43legacy")
)
logging.debug(
"BroadcomWLHandler enabled(): kmod %s, bcm43xx: %s, b43: %s, b43legacy: %s"
% (
km and "enabled" or "disabled",
bcm and "blacklisted" or "enabled",
b43 and "blacklisted" or "enabled",
b43_legacy and "blacklisted" or "enabled",
)
)
return (km and not b43_loaded) or (km and bcm and b43 and b43_legacy)
示例4: enabled
# 需要导入模块: from jockey.handlers import KernelModuleHandler [as 别名]
# 或者: from jockey.handlers.KernelModuleHandler import enabled [as 别名]
def enabled(self):
return KernelModuleHandler.enabled(self)