本文整理汇总了Python中module.Module.configure方法的典型用法代码示例。如果您正苦于以下问题:Python Module.configure方法的具体用法?Python Module.configure怎么用?Python Module.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module.Module
的用法示例。
在下文中一共展示了Module.configure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: configure
# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import configure [as 别名]
def configure(self, config):
Module.configure(self, config)
if not self.version:
self.version = m.ReadModuleName()
# Import appropriate the ADAM module (or package).
module = 'mpx.ion.adam.adam' + self.version
command = compile('import ' + module,
'mpx.ion.adam.unknown.configure()', 'exec')
eval(command)
# Get the module's factory and instanciate the "real" class.
command = module + '.factory'
adam_factory = eval(command, globals(), locals())
self.instance = adam_factory()
# Scary stuff. Detach this ion from our parent, configure the real
# instance (thus attaching it to the parent) and then morph this
# instance to behave like the real instance (in case anyone has a
# handle to this instance).
try:
self.parent._del_child(self.name)
self.instance.configure(config)
attributes = vars(self.instance.__class__)
attributes.update(vars(self.instance))
for attrribute in attributes:
setattr(self, attrribute, getattr(self.instance, attrribute))
except:
msglog.exception()
# The scary stuff failed, reattach to the parent.
try:
self.parent._del_child(self.instance.name)
except:
pass
self.parent._add_child(self)
示例2: scan
# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import configure [as 别名]
def scan(self):
for addr in range(0,0x100):
try:
m = Module()
m.configure({'name':'adamXXXX', 'parent':self,
'line_handler':self, 'address':addr})
print '0x%02X' % addr, '(%3d)' % addr, m.ReadModuleName()
except EIOError:
print "."
del m
示例3: do_build
# 需要导入模块: from module import Module [as 别名]
# 或者: from module.Module import configure [as 别名]
def do_build(module_configs, log_dir, options):
result = BuildResult()
nb_modules = len(module_configs)
for idx, config in enumerate(module_configs):
name = config.flat_get("name")
assert name
flog.h1("%d/%d %s" % (idx + 1, nb_modules, name))
module = Module(config)
log_file_name = os.path.join(log_dir, name.replace("/", "_") + ".log")
log_file = open(log_file_name, "w")
runner = Runner(log_file, options.verbose)
# update/checkout
if options.switch_branch and module.has_checkout():
module.switch_branch(runner)
if not options.no_src:
try:
if module.has_checkout():
module.update(runner)
else:
module.checkout(runner)
except BatchBuildError, exc:
flog.error("%s failed to update/checkout: %s", name, exc)
flog.p("See %s", log_file_name)
result.vcs_fails.append([name, str(exc), log_file_name])
nanotify.notify(name, "Failed to update/checkout", icon="dialog-warning")
if options.fatal:
return result
# Build
try:
if not options.src_only:
if options.refresh_build:
module.refresh_build()
module.configure(runner)
module.build(runner)
module.install(runner)
nanotify.notify(name, "Build successfully", icon="dialog-ok")
except BatchBuildError, exc:
flog.error("%s failed to build: %s", name, exc)
flog.p("See %s", log_file_name)
result.build_fails.append([name, str(exc), log_file_name])
nanotify.notify(name, "Failed to build", icon="dialog-error")
if options.fatal:
return result