本文整理汇总了Python中waflib.Task.update_outputs方法的典型用法代码示例。如果您正苦于以下问题:Python Task.update_outputs方法的具体用法?Python Task.update_outputs怎么用?Python Task.update_outputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Task
的用法示例。
在下文中一共展示了Task.update_outputs方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
if not getattr(self,'rule',None):
return
name=str(getattr(self,'name',None)or self.target or self.rule)
cls=Task.task_factory(name,self.rule,getattr(self,'vars',[]),shell=getattr(self,'shell',True),color=getattr(self,'color','BLUE'))
tsk=self.create_task(name)
if getattr(self,'target',None):
if isinstance(self.target,str):
self.target=self.target.split()
if not isinstance(self.target,list):
self.target=[self.target]
for x in self.target:
if isinstance(x,str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir()
tsk.outputs.append(x)
if getattr(self,'install_path',None):
self.bld.install_files(self.install_path,tsk.outputs)
if getattr(self,'source',None):
tsk.inputs=self.to_nodes(self.source)
self.source=[]
if getattr(self,'scan',None):
cls.scan=self.scan
if getattr(self,'cwd',None):
tsk.cwd=self.cwd
if getattr(self,'update_outputs',None)or getattr(self,'on_results',None):
Task.update_outputs(cls)
if getattr(self,'always',None):
Task.always_run(cls)
for x in['after','before','ext_in','ext_out']:
setattr(cls,x,getattr(self,x,[]))
示例2: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
if not getattr(self,'rule',None):
return
name=str(getattr(self,'name',None)or self.target or getattr(self.rule,'__name__',self.rule))
try:
cache=self.bld.cache_rule_attr
except AttributeError:
cache=self.bld.cache_rule_attr={}
cls=None
if getattr(self,'cache_rule','True'):
try:
cls=cache[(name,self.rule)]
except KeyError:
pass
if not cls:
cls=Task.task_factory(name,self.rule,getattr(self,'vars',[]),shell=getattr(self,'shell',True),color=getattr(self,'color','BLUE'),scan=getattr(self,'scan',None))
if getattr(self,'scan',None):
cls.scan=self.scan
elif getattr(self,'deps',None):
def scan(self):
nodes=[]
for x in self.generator.to_list(getattr(self.generator,'deps',None)):
node=self.generator.path.find_resource(x)
if not node:
self.generator.bld.fatal('Could not find %r (was it declared?)'%x)
nodes.append(node)
return[nodes,[]]
cls.scan=scan
if getattr(self,'update_outputs',None):
Task.update_outputs(cls)
if getattr(self,'always',None):
Task.always_run(cls)
for x in('after','before','ext_in','ext_out'):
setattr(cls,x,getattr(self,x,[]))
if getattr(self,'cache_rule','True'):
cache[(name,self.rule)]=cls
if getattr(self,'cls_str',None):
setattr(cls,'__str__',self.cls_str)
if getattr(self,'cls_keyword',None):
setattr(cls,'keyword',self.cls_keyword)
tsk=self.create_task(name)
if getattr(self,'target',None):
if isinstance(self.target,str):
self.target=self.target.split()
if not isinstance(self.target,list):
self.target=[self.target]
for x in self.target:
if isinstance(x,str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir()
tsk.outputs.append(x)
if getattr(self,'install_path',None):
self.bld.install_files(self.install_path,tsk.outputs)
if getattr(self,'source',None):
tsk.inputs=self.to_nodes(self.source)
self.source=[]
if getattr(self,'cwd',None):
tsk.cwd=self.cwd
示例3: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
"""
Process the attribute ``rule``. When present, :py:meth:`waflib.TaskGen.process_source` is disabled::
def build(bld):
bld(rule='cp ${SRC} ${TGT}', source='wscript', target='bar.txt')
"""
if not getattr(self, 'rule', None):
return
# create the task class
name = str(getattr(self, 'name', None) or self.target or self.rule)
cls = Task.task_factory(name, self.rule,
getattr(self, 'vars', []),
shell=getattr(self, 'shell', True), color=getattr(self, 'color', 'BLUE'))
# now create one instance
tsk = self.create_task(name)
if getattr(self, 'target', None):
if isinstance(self.target, str):
self.target = self.target.split()
if not isinstance(self.target, list):
self.target = [self.target]
for x in self.target:
if isinstance(x, str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir() # if a node was given, create the required folders
tsk.outputs.append(x)
if getattr(self, 'install_path', None):
# from waf 1.5
# although convenient, it does not 1. allow to name the target file and 2. symlinks
# TODO remove in waf 1.7
self.bld.install_files(self.install_path, tsk.outputs)
if getattr(self, 'source', None):
tsk.inputs = self.to_nodes(self.source)
# bypass the execution of process_source by setting the source to an empty list
self.source = []
if getattr(self, 'scan', None):
cls.scan = self.scan
if getattr(self, 'cwd', None):
tsk.cwd = self.cwd
# TODO remove on_results in waf 1.7
if getattr(self, 'update_outputs', None) or getattr(self, 'on_results', None):
Task.update_outputs(cls)
if getattr(self, 'always', None):
Task.always_run(cls)
for x in ['after', 'before', 'ext_in', 'ext_out']:
setattr(cls, x, getattr(self, x, []))
示例4: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
if not getattr(self, "rule", None):
return
name = str(getattr(self, "name", None) or self.target or self.rule)
cls = Task.task_factory(
name,
self.rule,
getattr(self, "vars", []),
shell=getattr(self, "shell", True),
color=getattr(self, "color", "BLUE"),
)
tsk = self.create_task(name)
if getattr(self, "target", None):
if isinstance(self.target, str):
self.target = self.target.split()
if not isinstance(self.target, list):
self.target = [self.target]
for x in self.target:
if isinstance(x, str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir()
tsk.outputs.append(x)
if getattr(self, "install_path", None):
self.bld.install_files(self.install_path, tsk.outputs)
if getattr(self, "source", None):
tsk.inputs = self.to_nodes(self.source)
self.source = []
if getattr(self, "scan", None):
cls.scan = self.scan
if getattr(self, "cwd", None):
tsk.cwd = self.cwd
if getattr(self, "update_outputs", None) or getattr(self, "on_results", None):
Task.update_outputs(cls)
if getattr(self, "always", None):
Task.always_run(cls)
for x in ["after", "before", "ext_in", "ext_out"]:
setattr(cls, x, getattr(self, x, []))
示例5: trans_update
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
h_node=x.find_node(base2)
if h_node:
break
if h_node:
m_node=h_node.change_ext(k+'.moc')
break
if not h_node:
raise Errors.WafError('No source found for %r which is a moc file'%d)
task=self.create_moc_task(h_node,m_node)
moctasks.append(task)
self.run_after.update(set(moctasks))
self.moc_done=1
class trans_update(Task.Task):
run_str='${QT_LUPDATE} ${SRC} -ts ${TGT}'
color='BLUE'
Task.update_outputs(trans_update)
class XMLHandler(ContentHandler):
def __init__(self):
self.buf=[]
self.files=[]
def startElement(self,name,attrs):
if name=='file':
self.buf=[]
def endElement(self,name):
if name=='file':
self.files.append(str(''.join(self.buf)))
def characters(self,cars):
self.buf.append(cars)
@extension(*EXT_RCC)
def create_rcc_task(self,node):
rcnode=node.change_ext('_rc.cpp')
示例6: if
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
headers_list=[o for o in valatask.outputs if o.suffix()==".h"]
try:
self.install_vheader.source=headers_list
except AttributeError:
self.install_vheader=self.bld.install_files(valatask.header_path,headers_list,self.env)
vapi_list=[o for o in valatask.outputs if(o.suffix()in(".vapi",".deps"))]
try:
self.install_vapi.source=vapi_list
except AttributeError:
self.install_vapi=self.bld.install_files(valatask.vapi_path,vapi_list,self.env)
gir_list=[o for o in valatask.outputs if o.suffix()==".gir"]
try:
self.install_gir.source=gir_list
except AttributeError:
self.install_gir=self.bld.install_files(valatask.gir_path,gir_list,self.env)
valac=Task.update_outputs(valac)
def find_valac(self,valac_name,min_version):
valac=self.find_program(valac_name,var='VALAC')
try:
output=self.cmd_and_log(valac+' --version')
except Exception:
valac_version=None
else:
ver=re.search(r'\d+.\d+.\d+',output).group(0).split('.')
valac_version=tuple([int(x)for x in ver])
self.msg('Checking for %s version >= %r'%(valac_name,min_version),valac_version,valac_version and valac_version>=min_version)
if valac and valac_version<min_version:
self.fatal("%s version %r is too old, need >= %r"%(valac_name,valac_version,min_version))
self.env['VALAC_VERSION']=valac_version
return valac
def check_vala(self,min_version=(0,8,0),branch=None):
示例7: u
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
u(self.__class__.__name__)
u(self.env.get_flat('CMAKE_BLD_DIR'))
u(self.env.get_flat('CMAKE_TARGET'))
self.uid_ = m.digest()
return self.uid_
def __str__(self):
return '%s %s' % (self.cmake.name, self.cmake_target)
def keyword(self):
return 'CMake Build'
# allow tasks to depend on possible headers or other resources if the user
# declares outputs for the cmake build
cmake_build_task = Task.update_outputs(cmake_build_task)
cmake_build_task.original_post_run = cmake_build_task.post_run
def _cmake_build_task_post_run(self):
self.output_patterns = Utils.to_list(self.output_patterns)
if not self.output_patterns:
return self.original_post_run()
bldnode = self.cmake.bldnode
for node in bldnode.ant_glob(self.output_patterns, remove=False):
self.set_outputs(node)
return self.original_post_run()
cmake_build_task.post_run = _cmake_build_task_post_run
class CMakeConfig(object):
'''
CMake configuration. This object shouldn't be instantiated directly. Use
示例8: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
"""
Process the attribute ``rule``. When present, :py:meth:`waflib.TaskGen.process_source` is disabled::
def build(bld):
bld(rule='cp ${SRC} ${TGT}', source='wscript', target='bar.txt')
"""
if not getattr(self, 'rule', None):
return
# create the task class
name = str(getattr(self, 'name', None) or self.target or self.rule)
# or we can put the class in a cache for performance reasons
try:
cache = self.bld.cache_rule_attr
except AttributeError:
cache = self.bld.cache_rule_attr = {}
cls = None
if getattr(self, 'cache_rule', 'True'):
try:
cls = cache[(name, self.rule)]
except KeyError:
pass
if not cls:
cls = Task.task_factory(name, self.rule,
getattr(self, 'vars', []),
shell=getattr(self, 'shell', True), color=getattr(self, 'color', 'BLUE'),
scan = getattr(self, 'scan', None))
if getattr(self, 'scan', None):
cls.scan = self.scan
elif getattr(self, 'deps', None):
def scan(self):
nodes = []
for x in self.generator.to_list(getattr(self.generator, 'deps', None)):
node = self.generator.path.find_resource(x)
if not node:
self.generator.bld.fatal('Could not find %r (was it declared?)' % x)
nodes.append(node)
return [nodes, []]
cls.scan = scan
if getattr(self, 'update_outputs', None):
Task.update_outputs(cls)
if getattr(self, 'always', None):
Task.always_run(cls)
for x in ['after', 'before', 'ext_in', 'ext_out']:
setattr(cls, x, getattr(self, x, []))
if getattr(self, 'cache_rule', 'True'):
cache[(name, self.rule)] = cls
# now create one instance
tsk = self.create_task(name)
if getattr(self, 'target', None):
if isinstance(self.target, str):
self.target = self.target.split()
if not isinstance(self.target, list):
self.target = [self.target]
for x in self.target:
if isinstance(x, str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir() # if a node was given, create the required folders
tsk.outputs.append(x)
if getattr(self, 'install_path', None):
# from waf 1.5
# although convenient, it does not 1. allow to name the target file and 2. symlinks
# TODO remove in waf 1.7
self.bld.install_files(self.install_path, tsk.outputs)
if getattr(self, 'source', None):
tsk.inputs = self.to_nodes(self.source)
# bypass the execution of process_source by setting the source to an empty list
self.source = []
if getattr(self, 'cwd', None):
tsk.cwd = self.cwd
示例9: print
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
cmd,
cwd=self.env.GBENCHMARK_BUILD,
quiet=Context.BOTH,
)
return 0
except WafError as e:
print(e)
if hasattr(e, 'stderr'):
print('')
print(e.stderr)
return 1
def __str__(self):
return 'Google Benchmark'
gbenchmark_build = Task.always_run(Task.update_outputs(gbenchmark_build))
build_task = None
@feature('gbenchmark')
@before_method('process_use')
def append_gbenchmark_use(self):
self.use = self.to_list(getattr(self, 'use', []))
if 'GBENCHMARK' not in self.use:
self.use.append('GBENCHMARK')
@feature('gbenchmark')
@after_method('process_source')
def wait_for_gbenchmark_build(self):
global build_task
示例10: if
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
c_node = node.change_ext('.c')
valatask.outputs.append(c_node)
self.source.append(c_node)
if valatask.is_lib:
headers_list = [o for o in valatask.outputs if o.suffix() == ".h"]
self.install_vheader = self.bld.install_files(valatask.header_path, headers_list, self.env)
vapi_list = [o for o in valatask.outputs if (o.suffix() in (".vapi", ".deps"))]
self.install_vapi = self.bld.install_files(valatask.vapi_path, vapi_list, self.env)
gir_list = [o for o in valatask.outputs if o.suffix() == ".gir"]
self.install_gir = self.bld.install_files(valatask.gir_path, gir_list, self.env)
valac_task = Task.update_outputs(valac_task) # no decorators for python2 classes
@conf
def find_valac(self, valac_name, min_version):
"""
Find the valac program, and execute it to store the version
number in *conf.env.VALAC_VERSION*
:param valac_name: program name
:type valac_name: string or list of string
:param min_version: minimum version acceptable
:type min_version: tuple of int
"""
valac = self.find_program(valac_name, var='VALAC')
try:
output = self.cmd_and_log(valac + ' --version')
示例11: if
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
headers_list=[o for o in valatask.outputs if o.suffix()==".h"]
try:
self.install_vheader.source=headers_list
except AttributeError:
self.install_vheader=self.bld.install_files(valatask.header_path,headers_list,self.env)
vapi_list=[o for o in valatask.outputs if(o.suffix()in(".vapi",".deps"))]
try:
self.install_vapi.source=vapi_list
except AttributeError:
self.install_vapi=self.bld.install_files(valatask.vapi_path,vapi_list,self.env)
gir_list=[o for o in valatask.outputs if o.suffix()==".gir"]
try:
self.install_gir.source=gir_list
except AttributeError:
self.install_gir=self.bld.install_files(valatask.gir_path,gir_list,self.env)
valac_task=Task.update_outputs(valac_task)
def find_valac(self,valac_name,min_version):
valac=self.find_program(valac_name,var='VALAC')
try:
output=self.cmd_and_log(valac+' --version')
except Exception:
valac_version=None
else:
ver=re.search(r'\d+.\d+.\d+',output).group(0).split('.')
valac_version=tuple([int(x)for x in ver])
self.msg('Checking for %s version >= %r'%(valac_name,min_version),valac_version,valac_version and valac_version>=min_version)
if valac and valac_version<min_version:
self.fatal("%s version %r is too old, need >= %r"%(valac_name,valac_version,min_version))
self.env['VALAC_VERSION']=valac_version
return valac
def check_vala(self,min_version=(0,8,0),branch=None):
示例12: delattr
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
link = self.generator.link_task
except AttributeError:
pass
else:
if not tsk.outputs[0] in link.inputs:
link.inputs.append(tsk.outputs[0])
link.set_run_after(tsk)
# any change in the order of the input nodes may cause a recompilation
link.inputs.sort(key=lambda x: x.abspath())
# if you want to modify some flags
# you *must* have the task recompute the signature
self.env.append_value('CXXFLAGS', '-O2')
delattr(self, 'cache_sig')
return super(waflib.Tools.c.c, self).runnable_status()
return ret
@TaskGen.extension('.c')
def c_hook(self, node):
# re-bind the extension to this new class
return self.create_compiled_task('c2', node)
# modify the existing class to output the targets in the same directory as the original files
Task.update_outputs(c2)
Task.update_outputs(waflib.Tools.c.cprogram)
Task.update_outputs(waflib.Tools.c.cshlib)
Task.update_outputs(waflib.Tools.c.cstlib)
示例13: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
"""
Process the attribute ``rule``. When present, :py:meth:`waflib.TaskGen.process_source` is disabled::
def build(bld):
bld(rule='cp ${SRC} ${TGT}', source='wscript', target='bar.txt')
"""
if not getattr(self, "rule", None):
return
# create the task class
name = str(getattr(self, "name", None) or self.target or getattr(self.rule, "__name__", self.rule))
# or we can put the class in a cache for performance reasons
try:
cache = self.bld.cache_rule_attr
except AttributeError:
cache = self.bld.cache_rule_attr = {}
cls = None
if getattr(self, "cache_rule", "True"):
try:
cls = cache[(name, self.rule)]
except KeyError:
pass
if not cls:
cls = Task.task_factory(
name,
self.rule,
getattr(self, "vars", []),
shell=getattr(self, "shell", True),
color=getattr(self, "color", "BLUE"),
scan=getattr(self, "scan", None),
)
if getattr(self, "scan", None):
cls.scan = self.scan
elif getattr(self, "deps", None):
def scan(self):
nodes = []
for x in self.generator.to_list(getattr(self.generator, "deps", None)):
node = self.generator.path.find_resource(x)
if not node:
self.generator.bld.fatal("Could not find %r (was it declared?)" % x)
nodes.append(node)
return [nodes, []]
cls.scan = scan
if getattr(self, "update_outputs", None):
Task.update_outputs(cls)
if getattr(self, "always", None):
Task.always_run(cls)
for x in ("after", "before", "ext_in", "ext_out"):
setattr(cls, x, getattr(self, x, []))
if getattr(self, "cache_rule", "True"):
cache[(name, self.rule)] = cls
# now create one instance
tsk = self.create_task(name)
if getattr(self, "target", None):
if isinstance(self.target, str):
self.target = self.target.split()
if not isinstance(self.target, list):
self.target = [self.target]
for x in self.target:
if isinstance(x, str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir() # if a node was given, create the required folders
tsk.outputs.append(x)
if getattr(self, "install_path", None):
self.bld.install_files(self.install_path, tsk.outputs)
if getattr(self, "source", None):
tsk.inputs = self.to_nodes(self.source)
# bypass the execution of process_source by setting the source to an empty list
self.source = []
if getattr(self, "cwd", None):
tsk.cwd = self.cwd
示例14: process_rule
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import update_outputs [as 别名]
def process_rule(self):
if not getattr(self, "rule", None):
return
name = str(getattr(self, "name", None) or self.target or getattr(self.rule, "__name__", self.rule))
try:
cache = self.bld.cache_rule_attr
except AttributeError:
cache = self.bld.cache_rule_attr = {}
cls = None
if getattr(self, "cache_rule", "True"):
try:
cls = cache[(name, self.rule)]
except KeyError:
pass
if not cls:
cls = Task.task_factory(
name,
self.rule,
getattr(self, "vars", []),
shell=getattr(self, "shell", True),
color=getattr(self, "color", "BLUE"),
scan=getattr(self, "scan", None),
)
if getattr(self, "scan", None):
cls.scan = self.scan
elif getattr(self, "deps", None):
def scan(self):
nodes = []
for x in self.generator.to_list(getattr(self.generator, "deps", None)):
node = self.generator.path.find_resource(x)
if not node:
self.generator.bld.fatal("Could not find %r (was it declared?)" % x)
nodes.append(node)
return [nodes, []]
cls.scan = scan
if getattr(self, "update_outputs", None):
Task.update_outputs(cls)
if getattr(self, "always", None):
Task.always_run(cls)
for x in ("after", "before", "ext_in", "ext_out"):
setattr(cls, x, getattr(self, x, []))
if getattr(self, "cache_rule", "True"):
cache[(name, self.rule)] = cls
tsk = self.create_task(name)
if getattr(self, "target", None):
if isinstance(self.target, str):
self.target = self.target.split()
if not isinstance(self.target, list):
self.target = [self.target]
for x in self.target:
if isinstance(x, str):
tsk.outputs.append(self.path.find_or_declare(x))
else:
x.parent.mkdir()
tsk.outputs.append(x)
if getattr(self, "install_path", None):
self.bld.install_files(self.install_path, tsk.outputs)
if getattr(self, "source", None):
tsk.inputs = self.to_nodes(self.source)
self.source = []
if getattr(self, "cwd", None):
tsk.cwd = self.cwd