本文整理汇总了Python中waflib.Task.Task方法的典型用法代码示例。如果您正苦于以下问题:Python Task.Task方法的具体用法?Python Task.Task怎么用?Python Task.Task使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Task
的用法示例。
在下文中一共展示了Task.Task方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_command
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def apply_command(self):
#self.meths.remove('apply_core')
# create the task
task = self.create_task('command')
setattr(task, "dep_vars", getattr(self, "dep_vars", None))
# process the sources
inputs = []
for node in self.source:
inputs.append(node)
task.set_inputs(inputs)
task.set_outputs([self.path.find_or_declare(tgt) for tgt in self.to_list(self.target)])
self.source = ''
#Task.file_deps = Task.extract_deps
# class command_taskgen(task_gen):
# def __init__(self, *k, **kw):
# task_gen.__init__(self, *k, **kw)
# self.features.append('command')
示例2: check_invalid_constraints
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def check_invalid_constraints(self):
feat=set([])
for x in list(TaskGen.feats.values()):
feat.union(set(x))
for(x,y)in TaskGen.task_gen.prec.items():
feat.add(x)
feat.union(set(y))
ext=set([])
for x in TaskGen.task_gen.mappings.values():
ext.add(x.__name__)
invalid=ext&feat
if invalid:
Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method'%list(invalid))
for cls in list(Task.classes.values()):
for x in('before','after'):
for y in Utils.to_list(getattr(cls,x,[])):
if not Task.classes.get(y,None):
Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__))
if getattr(cls,'rule',None):
Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__)
示例3: apply_link
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def apply_link(self):
for x in self.features:
if x=='cprogram'and'cxx'in self.features:
x='cxxprogram'
elif x=='cshlib'and'cxx'in self.features:
x='cxxshlib'
if x in Task.classes:
if issubclass(Task.classes[x],link_task):
link=x
break
else:
return
objs=[t.outputs[0]for t in getattr(self,'compiled_tasks',[])]
self.link_task=self.create_task(link,objs)
self.link_task.add_target(self.target)
try:
inst_to=self.install_path
except AttributeError:
inst_to=self.link_task.__class__.inst_to
if inst_to:
self.install_task=self.bld.install_files(inst_to,self.link_task.outputs[:],env=self.env,chmod=self.link_task.chmod,task=self.link_task)
示例4: create_moc_task
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def create_moc_task(self,h_node,m_node):
try:
moc_cache=self.generator.bld.moc_cache
except AttributeError:
moc_cache=self.generator.bld.moc_cache={}
try:
return moc_cache[h_node]
except KeyError:
tsk=moc_cache[h_node]=Task.classes['moc'](env=self.env,generator=self.generator)
tsk.set_inputs(h_node)
tsk.set_outputs(m_node)
if self.generator:
self.generator.tasks.append(tsk)
gen=self.generator.bld.producer
gen.outstanding.insert(0,tsk)
gen.total+=1
return tsk
示例5: create_moc_task
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def create_moc_task(self,h_node,m_node):
try:
moc_cache=self.generator.bld.moc_cache
except AttributeError:
moc_cache=self.generator.bld.moc_cache={}
try:
return moc_cache[h_node]
except KeyError:
tsk=moc_cache[h_node]=Task.classes['moc'](env=self.env,generator=self.generator)
tsk.set_inputs(h_node)
tsk.set_outputs(m_node)
if self.generator:
self.generator.tasks.append(tsk)
gen=self.generator.bld.producer
gen.outstanding.insert(0,tsk)
gen.total+=1
return tsk
else:
delattr(self,'cache_sig')
示例6: check_invalid_constraints
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def check_invalid_constraints(self):
feat=set([])
for x in list(TaskGen.feats.values()):
feat.union(set(x))
for(x,y)in TaskGen.task_gen.prec.items():
feat.add(x)
feat.union(set(y))
ext=set([])
for x in TaskGen.task_gen.mappings.values():
ext.add(x.__name__)
invalid=ext&feat
if invalid:
Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method'%list(invalid))
for cls in list(Task.classes.values()):
if sys.hexversion>0x3000000 and issubclass(cls,Task.Task)and isinstance(cls.hcode,str):
raise Errors.WafError('Class %r has hcode value %r of type <str>, expecting <bytes> (use Utils.h_cmd() ?)'%(cls,cls.hcode))
for x in('before','after'):
for y in Utils.to_list(getattr(cls,x,[])):
if not Task.classes.get(y,None):
Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__))
if getattr(cls,'rule',None):
Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__)
示例7: get_build_iterator
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def get_build_iterator(self):
self.cur=0
if self.targets and self.targets!='*':
(self._min_grp,self._exact_tg)=self.get_targets()
global lazy_post
if self.post_mode!=POST_LAZY:
while self.cur<len(self.groups):
self.post_group()
self.cur+=1
self.cur=0
while self.cur<len(self.groups):
if self.post_mode!=POST_AT_ONCE:
self.post_group()
tasks=self.get_tasks_group(self.cur)
Task.set_file_constraints(tasks)
Task.set_precedence_constraints(tasks)
self.cur_tasks=tasks
self.cur+=1
if not tasks:
continue
yield tasks
while 1:
yield[]
示例8: apply_cmd
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def apply_cmd(self):
"call a command everytime"
if not self.fun: raise Errors.WafError('cmdobj needs a function!')
tsk = Task.TaskBase()
tsk.fun = self.fun
tsk.env = self.env
self.tasks.append(tsk)
tsk.install_path = self.install_path
示例9: __init__
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def __init__(self, env, command, command_node, command_args, stdin, stdout, cwd, os_env, stderr):
Task.Task.__init__(self, env=env)
assert isinstance(command, (str, Node.Node))
self.command = command
self.command_args = command_args
self.stdin = stdin
self.stdout = stdout
self.cwd = cwd
self.os_env = os_env
self.stderr = stderr
if command_node is not None: self.dep_nodes = [command_node]
self.dep_vars = [] # additional environment variables to look
示例10: __init__
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def __init__(self, env, generator):
Task.Task.__init__(self, env=env, normal=1, generator=generator)
示例11: compile_may_start
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def compile_may_start(self):
if not getattr(self, 'flag_deps', ''):
self.flag_deps = 1
# the evil part is that we can only compute the dependencies after the
# source files can be read (this means actually producing the source files)
bytecode = getattr(self, 'bytecode', '')
if bytecode: alltasks = self.generator.bytecode_tasks
else: alltasks = self.generator.native_tasks
try:
self.signature() # ensure that files are scanned - unfortunately
except:
return Task.ASK_LATER
tree = self.generator.bld
env = self.env
for node in self.inputs:
lst = tree.node_deps[self.uid()]
for depnode in lst:
for t in alltasks:
if t == self: continue
if depnode in t.inputs:
self.set_run_after(t)
# TODO necessary to get the signature right - for now
delattr(self, 'cache_sig')
try:
self.signature()
except:
return Task.ASK_LATER
return Task.Task.runnable_status(self)
示例12: link_may_start
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def link_may_start(self):
if getattr(self, 'bytecode', 0): alltasks = self.generator.bytecode_tasks
else: alltasks = self.generator.native_tasks
for x in alltasks:
if not x.hasrun:
return Task.ASK_LATER
if not getattr(self, 'order', ''):
# now reorder the inputs given the task dependencies
# this part is difficult, we do not have a total order on the tasks
# if the dependencies are wrong, this may not stop
seen = []
pendant = []+alltasks
while pendant:
task = pendant.pop(0)
if task in seen: continue
no_deps_remain = True
for x in task.run_after:
if not x in alltasks:
continue
if not x in seen:
no_deps_remain = False
break
if no_deps_remain: seen.append(task)
else: pendant.append(task)
self.inputs = [x.outputs[0] for x in seen]
self.order = 1
return Task.Task.runnable_status(self)
示例13: runnable_status
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def runnable_status(self):
for t in self.run_after:
if not t.hasrun:
return Task.ASK_LATER
if not self.inputs:
global JAR_RE
try:
self.inputs=[x for x in self.basedir.ant_glob(JAR_RE,remove=False)if id(x)!=id(self.outputs[0])]
except Exception:
raise Errors.WafError('Could not find the basedir %r for %r'%(self.basedir,self))
return super(jar_create,self).runnable_status()
示例14: runnable_status
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def runnable_status(self):
for x in self.outputs:
x.sig=Utils.h_file(x.abspath())
return Task.SKIP_ME
示例15: __init__
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import Task [as 别名]
def __init__(self,*k,**kw):
Task.Task.__init__(self,*k,**kw)
self.moc_done=0