本文整理汇总了Python中waflib.Utils.str_to_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.str_to_dict方法的具体用法?Python Utils.str_to_dict怎么用?Python Utils.str_to_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.str_to_dict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runnable_status
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import str_to_dict [as 别名]
def runnable_status(self):
'''
self.pars are populated in runnable_status - because this function is being
run *before* both self.pars "consumers" - scan() and run()
set output_dir (node) for the output
'''
for x in self.run_after:
if not x.hasrun:
return Task.ASK_LATER
if not getattr(self, 'pars', None):
txt = self.inputs[0].read()
txt = re_nl.sub('', txt)
self.pars = Utils.str_to_dict(txt)
if not self.pars.get('OUTPUT_DIRECTORY'):
self.pars['OUTPUT_DIRECTORY'] = self.inputs[0].parent.get_bld().abspath()
if not self.pars.get('INPUT'):
self.pars['INPUT'] = self.inputs[0].parent.abspath()
if not getattr(self, 'output_dir', None):
self.output_dir = self.generator.bld.root.find_dir(self.pars['OUTPUT_DIRECTORY'])
self.signature()
return Task.Task.runnable_status(self)
示例2: runnable_status
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import str_to_dict [as 别名]
def runnable_status(self):
"""
self.pars are populated in runnable_status - because this function is being
run *before* both self.pars "consumers" - scan() and run()
set output_dir (node) for the output
"""
for x in self.run_after:
if not x.hasrun:
return Task.ASK_LATER
if not getattr(self, "pars", None):
txt = self.inputs[0].read()
txt = re_nl.sub("", txt)
self.pars = Utils.str_to_dict(txt)
if not self.pars.get("OUTPUT_DIRECTORY"):
self.pars["OUTPUT_DIRECTORY"] = self.inputs[0].parent.get_bld().abspath()
if not self.pars.get("INPUT"):
self.pars["INPUT"] = self.inputs[0].parent.abspath()
if not getattr(self, "output_dir", None):
bld = self.generator.bld
# First try to find an absolute path, then find or declare a relative path
self.output_dir = bld.root.find_dir(self.pars["OUTPUT_DIRECTORY"])
if not self.output_dir:
self.output_dir = bld.path.find_or_declare(self.pars["OUTPUT_DIRECTORY"])
self.signature()
return Task.Task.runnable_status(self)
示例3: run
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import str_to_dict [as 别名]
def run(self):
src = self.inputs[0]
sbf = self.inputs[0].change_ext('.sbf').get_bld()
sbf.parent.mkdir()
cmd = '%s -b %s -I %s -c ./ %s' % (self.env.SIP_BIN, sbf.abspath(), src.parent.abspath(), src.abspath())
cwd = src.parent.get_bld().abspath()
self.generator.bld.exec_command(cmd, cwd=cwd)
sbf_data = Utils.str_to_dict(sbf.read())
headers = Utils.to_list(sbf_data['headers'])
sources = Utils.to_list(sbf_data['sources'])
src_dir = src.parent.get_bld()
self.outputs = [src_dir.find_or_declare(x) for x in sources]
self.generator.bld.raw_deps[self.uid()] = [self.signature()] + self.outputs
self.add_c_tasks(self.outputs)